'one-var' doesn't respect 'separateRequires' option with 'always' or 'consecutive'
See original GitHub issueTell us about your environment
- ESLint Version: 4.19.1
- Node Version: 8.11.1
- npm Version: 5.8.0
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Configuration
module.exports = {
'root': true,
'extends': [],
'parserOptions': {
'ecmaVersion': 8
},
'env': {
'es6': true,
'node': true
},
'rules': {
'no-mixed-requires': [2, { 'allowCall': false }],
'one-var': [2, { 'var': 'consecutive', 'separateRequires': true }],
}
};
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
Took code from https://eslint.org/docs/rules/one-var#var-let-and-const under the separateRequires
block.
var foo = require('foo');
var bar = 'bar';
var foo = require('foo'),
bar = require('bar');
Ran through Webstorm, which I presume just runs the configured package (which is the correct path) against the current file.
What did you expect to happen? No errors are flagged.
What actually happened? Please include the actual, raw output from ESLint.
2 errors are flagged: The first bar
variable wants to be joined with the first foo
. The second foo/bar block wants to be joined with the first block. Interestingly if you make the consecutive
option an always
, the first error goes away.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:12 (9 by maintainers)
Top GitHub Comments
Would like to work on this.
Agree. This looks like a bug. Easier example to reproduce: