Skip to content
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

Fix false positives for style attributes in no-missing-end-of-source-newline #3410

Closed
trollepierre opened this issue Jun 21, 2018 · 1 comment

Comments

@trollepierre
Copy link

Since version 9.3.0 (not in version 9.2.1), the rule 'no-missing-end-of-source-newline' is provoking strange behavior in my code.

 <v-layout
      :class="serviceStatusClass"
      style="flex:0;"
      class="table-row"
      row>

becomes

<v-layout
      :class="serviceStatusClass"
      style="flex:0;
"
      class="table-row"
      row>

Which rule, if any, is the bug related to?

no-missing-end-of-source-newline

What stylelint configuration is needed to reproduce the bug?

nothing particular

Which version of stylelint are you using?

I was in 9.2.1. I pass in 9.3.0

How are you running stylelint: CLI, PostCSS plugin, Node API?

e.g. "CLI with stylelint src/**/*.vue src/**/*.css src/**/*.scss"

Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?

in Vue component

What did you expect to happen?

"No problem to be flagged and no autofix ."

@jeddy3 jeddy3 changed the title 'no-missing-end-of-source-newline' strange behavior Fix false positives for style attributes in no-missing-end-of-source-newline Jun 23, 2018
@jeddy3
Copy link
Member

jeddy3 commented Jun 23, 2018

@trollepierre Thanks for the report and for using the template.

As a way of an explanation...

Historically, there has been a 1 to 1 mapping with what we call a "source" and a file on the file system. This assumption is no longer valid with the introduction of syntaxes that extract multiple sources from within files e.g. from style attributes within .vue files. I think the way these syntaxes work is correct, though. As such, not all rules/plugins will be applicable to all syntaxes.

It's the responsibility of the user to configure stylelint accordingly. Turning on only rules that are applicable to the syntaxes they are linting. The introduction of an overrides property within the configuration object, as proposed in #3128, would help give users the control to do this on a more granular level.

@trollepierre Sorry about the unexpected change in behaviour. It was an unintended side effect of our ongoing work to support linting CSS within things like .vue files. Until the overrides feature is added you can either:

  1. turn off the rule entirely i.e. no-missing-end-of-source-newline: null
  2. use this workaround to turn the rule off for just .vue files.

It feels like the need for a overrides property is more pressing now, so feel free to jump into that issue if you've time to help contribute it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants