-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
newline-after-import
deosn't take care of comments
#2151
Comments
From where do you form this expectation? The docs don't have any examples with comments, nor do the tests. The goal of the rule is to ensure that there's some spacing between imports and non-imports - arguably a comment suffices. |
I come to this issue for the exact same problem. In the OP's case, I'd expect import { join } from "path";
/**
*
*/
console.log(); The examples and tests may not include comment into consideration but I find it more intuitive and more clear if there's an empty line after all the import statements. After all, I believe it's the intention of the rule. For example, the following annoying example doesn't make sense to me but it's a pass today: import something from 'somewhere';
// it's a very looooooooooooooooooooooooooooooooooooog comment
console.log('is it a good quality code?') |
A PR to add an option to make comments not be counted as an empty line would be appreciated. |
This comment has been minimized.
This comment has been minimized.
Hey! I would like to work on this. |
Go for it! |
The
newline-after-import
rule doesn't hit if the import-statements are immediately followed by comments:This piece of code is expected to produce an error, but it doesn't:
The text was updated successfully, but these errors were encountered: