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
'ImportDeclaration': 'never', is not enforced. #14024
Comments
Please note that the docs are very explicit about what is supposed to happen here: And there's definitively a line break between these braces: import { defineComponent, ref, // looks like a line break to me!
PropType } from 'vue' |
Hi @TheDutchCoder, thanks for the issue! This rule enforces linebreaks after In this case, it works as intended, since there's no linebreak between There are examples of correct code for this rule with the "never" option with linebreaks inside but not after /*eslint object-curly-newline: ["error", "never"]*/
let d = {foo: 1,
bar: 2};
let e = {foo: function() {
dosomething();
}}; |
Thanks for replying! The rule clearly says "inside" braces, so maybe the output is intended, but then the description of the rule is incorrect. Regardless, what would be the rule to make sure no line breaks are allowed, well, inside the braces? ;) |
I agree that the wording isn't clear, a PR to clarify this would be welcome!
We don't have a rule to disallow linebreaks inside braces of named imports in the core set of rules. Given our rules policies, I think the best course of action would be to create a custom rule or a plugin. |
@TheDutchCoder did you start writing a custom rule for this? I'll be happy to try. |
Yes, I think it's a good idea to clarify what "inside braces" means for this rule, or to reword it. |
Isn't better to replace inside braces with for braces? sentences change like this:
|
I think it would be best to say "after" and "before", like in rule details of array-bracket-newline. |
I'm going to do this, give me one day. |
Tell us about your environment
What parser (default,
@babel/eslint-parser
,@typescript-eslint/parser
, etc.) are you using?default
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
This is in a .vue SFC, within the script tag.
ESlint is ran from within VSCode.
What did you expect to happen?
The import to not allow line breaks, because
'ImportDeclaration': 'never',
is set.What actually happened? Please include the actual, raw output from ESLint.
Line breaks aren't throwing an error.
Are you willing to submit a pull request to fix this bug?
I have no knowledge of eslint internals, but sure, if I can help, more than willing to!
The text was updated successfully, but these errors were encountered: