Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat(eslint-plugin): [lines-around-comment] add extension rule#5327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
24 commits Select commitHold shift + click to select a range
b3b6319
replicate eslint rule and add base test case
chbdetta62efad9
port the eslint lines-around-comment
chbdettac2433b4
check for comment in interface and allow options
chbdettad97237e
check for comment in type literals and allow options
chbdettae9df0ec
add lines-around-comment in index
chbdetta14db2f7
add lines-around-comment in all config
chbdetta7f2661f
add lines-around-comment doc
chbdetta30825c6
delegate non-TS check to the base rule
chbdettab153dba
Merge branch 'main' into main
chbdetta793d2e7
fix lint errors
chbdetta3b74231
fix doc lint errors
chbdettab367c61
address comments
chbdettab763e3a
address jsdoc comments
chbdetta59541ed
proper comment language
chbdettaf92776d
Update packages/eslint-plugin/src/rules/lines-around-comment.ts
chbdetta01371be
remove irrevalant lines and improve test cov
chbdetta7a39437
skip more cases
chbdetta567420a
add enum and module tests
chbdetta9cf58f2
implement enum and module
chbdetta88584c6
improve coverage
chbdettaade17f3
Merge branch 'main' of github.com:chbdetta/typescript-eslint into main
chbdettab6b475a
remove ESilnt base rule test casese
chbdettaf32e927
improve coverage
chbdetta75bf6ea
Merge branch 'main' into main
JoshuaKGoldbergFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletionspackages/eslint-plugin/docs/rules/lines-around-comment.md
This file contains hidden or 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,41 @@ | ||
--- | ||
description: 'Require empty lines around comments.' | ||
--- | ||
> 🛑 This file is source code, not the primary documentation location! 🛑 | ||
> | ||
> See **https://typescript-eslint.io/rules/lines-around-comment** for documentation. | ||
## Rule Details | ||
This rule extends the base [`eslint/lines-around-comment`](https://eslint.org/docs/rules/lines-around-comment) rule. | ||
It adds support for TypeScript syntax. | ||
See the [ESLint documentation](https://eslint.org/docs/rules/lines-around-comment) for more details on the `comma-dangle` rule. | ||
## Rule Changes | ||
```jsonc | ||
{ | ||
// note you must disable the base rule as it can report incorrect errors | ||
"lines-around-comment": "off", | ||
"@typescript-eslint/lines-around-comment": ["error"] | ||
} | ||
``` | ||
In addition to the options supported by the `lines-around-comment` rule in ESLint core, the rule adds the following options: | ||
## Options | ||
- `allowInterfaceStart: true` doesn't require a blank line after the interface body block start | ||
- `allowInterfaceEnd: true` doesn't require a blank line before the interface body block end | ||
- `allowTypeStart: true` doesn't require a blank line after the type literal block start | ||
- `allowTypeEnd: true` doesn't require a blank line after the type literal block end | ||
[See the other options allowed](https://eslint.org/docs/rules/comma-dangle#options) | ||
<sup> | ||
Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/main/docs/rules/lines-around-comment.md) | ||
</sup> |
2 changes: 2 additions & 0 deletionspackages/eslint-plugin/src/configs/all.ts
This file contains hidden or 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
2 changes: 2 additions & 0 deletionspackages/eslint-plugin/src/rules/index.ts
This file contains hidden or 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.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.