newline-after-var: false negative if semicolon is moved to a new line
See original GitHub issueTell us about your environment
- ESLint Version: 3.13.1
- Node Version: 7.4.0
- npm Version: 4.1.1
What parser (default, Babel-ESLint, etc.) are you using? babel-eslint
Please show your full configuration:
{
"rules": {
"newline-after-var": "error",
"no-extra-semi": "error",
"semi-spacing": "error",
"semi": "error"
}
}
What did you do? Please include the actual source code causing the issue.
import angular from 'angular';
import homeComponent from './home.component';
import uiRouter from 'angular-ui-router';
const homeModule = angular
.module('home', [
uiRouter,
])
.component('home', homeComponent)
;
export default homeModule.name;
What did you expect to happen?
newline-after-var
should not report error
What actually happened? Please include the actual, raw output from ESLint.
5:1 error Expected blank line after variable declarations newline-after-var
The problem is the semicolon moved to the new line: if semicolon is in the line that starts with .component(
the rule does not report error.
No other rule reports error in this case including 3 semicolon-related ones I noticed in configuration section (my config is much bigger than the 4 rules I mentioned but other rules does not affect the case).
The reason semicolon is moved to a new line is purely VCS-related. I don’t want my diff to show that line starting with .component(
was changed if any other chained method is added (which in this case means: if other mart of angular the module is added)
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
@platinumazure Thank you! Favorited ASTExplorer! Learning every day through open source ^^ pretty new around Js!
@platinumazure thank you for checking that.
@not-an-aardvark can you think of how to preserve the behaviour you mentioned yet to be able to cover may case?