Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eslint-plugin): add extension rule `padding-line-between-stateme…
…nts` (#3418)
- Loading branch information
Showing
7 changed files
with
5,927 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
packages/eslint-plugin/docs/rules/padding-line-between-statements.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# require or disallow padding lines between statements (`padding-line-between-statements`) | ||
|
||
## Rule Details | ||
|
||
This rule extends the base [`eslint/padding-line-between-statements`](https://eslint.org/docs/rules/padding-line-between-statements) rule. | ||
|
||
**It adds support for TypeScript constructs such as `interface` and `type`.** | ||
|
||
## How to use | ||
|
||
```jsonc | ||
{ | ||
// note you must disable the base rule as it can report incorrect errors | ||
"padding-line-between-statements": "off", | ||
"@typescript-eslint/padding-line-between-statements": [ | ||
"error", | ||
{ | ||
"blankLine": "always", | ||
"prev": "var", | ||
"next": "return" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
```jsonc | ||
{ | ||
// Example - Add blank lines before interface and type definitions. | ||
// note you must disable the base rule as it can report incorrect errors | ||
"padding-line-between-statements": "off", | ||
"@typescript-eslint/padding-line-between-statements": [ | ||
"error", | ||
{ | ||
"blankLine": "always", | ||
"prev": "*", | ||
"next": ["interface", "type"] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
See [`eslint/padding-line-between-statements` options](https://eslint.org/docs/rules/padding-line-between-statements#options). | ||
|
||
**Note** - In addition to options provided by ESLint, we have also added options for `interface` and `type`. | ||
|
||
<sup>Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/padding-line-between-statements.md)</sup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.