question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'one-var' doesn't respect 'separateRequires' option with 'always' or 'consecutive'

See original GitHub issue

Tell 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:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
sstern6commented, Oct 5, 2018

Would like to work on this.

2reactions
ilyavolodincommented, Jun 20, 2018

Agree. This looks like a bug. Easier example to reproduce:

/* eslint one-var: [2, { separateRequires: true, var: "always" }] */
var bar = 'bar';

var foo = require('foo');
Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix: Adds conditional for separateRequires in one-var ... - GitHub
Successfully merging this pull request may close these issues. 'one-var' doesn't respect 'separateRequires' option with 'always' or 'consecutive ...
Read more >
GNU make
If the makefiles specify a double-colon rule to remake a file with a recipe but no prerequisites, that file will always be remade...
Read more >
HAProxy version 2.2.22 - Configuration Manual - GitHub Pages
In modern configurations, some arguments require the use of some characters that were previously considered as pure delimiters.
Read more >
Ubuntu Manpage: stap - systemtap script translator/driver
It allows source code points or events in the system to be associated with handlers, which are subroutines that are executed synchronously. It...
Read more >
NCO 5.1.4-alpha04 User Guide - NCO netCDF Operators
Each NCO operator (e.g., ncks ) takes netCDF input file(s), ... The list of illustrious institutions that do not endorse NCO continues to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found