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

tools: update eslint to v1.x #2286

Closed
wants to merge 6 commits into from
Closed

tools: update eslint to v1.x #2286

wants to merge 6 commits into from

Conversation

targos
Copy link
Member

@targos targos commented Aug 1, 2015

This is still a WIP.

I create the PR now because there are several issues to discuss:

  • The no-reserved-keys rule has been removed. It is kind of replaced by quote-props but to enable this rule, we need to choose how we want deal with quotes on object properties. The consistent option seems to be the most conservative one if the goal is to limit changes in our code.
  • The indent rule changed quite a lot and has now options to control the indentation of specific cases:
    • SwitchCase: I set it to 1, meaning that the case statements need 1 level of indent (== 2 spaces) compared to the switch. There are a few places where we don't follow this rule, like here.
    • VariableDeclarator: I set it to 2. This allows us to align multiple variable declarations with var or let like:
var x = 0,
    y = 1,
    z = 2;

I haven't pushed the lib and test changes yet because I think there are some problems in eslint with the indent rule. I'll reference this PR when I file the issues.

@silverwind
Copy link
Contributor

I don't think we need quote-props, it's only useful in ES3 environments.

@targos
Copy link
Member Author

targos commented Aug 1, 2015

So we just remove no-reserved-keys ? I'm fine with that.

@silverwind
Copy link
Contributor

Patch doesn't seem to apply cleanly for me:

error: tools/eslint/node_modules/debug/node_modules/ms/History.md: already exists in working directory

Did you install the new eslint with NODE_ENV=production? I forgot that when updating the last time, so it might be best to git rm / git add everything in tools/eslint now.

@targos
Copy link
Member Author

targos commented Aug 1, 2015

I did this:

rm -rf tools/eslint
npm install eslint
mv node_modules/eslint tools/eslint
rm -rf node_modules

@silverwind
Copy link
Contributor

So we just remove no-reserved-keys ? I'm fine with that.

Yeah. You could experiment with these options thought:

quote-props: [2, "as-needed"]
quote-props: [2, "consistent-as-needed"]

@silverwind
Copy link
Contributor

Also, please remove escape and unescape from the globals, they're not needed anymore.

@targos
Copy link
Member Author

targos commented Aug 1, 2015

I have one remaining issue with the indent rule and I don't know if it's on our side or eslint's:

exec('python -c "print 200000*\'C\'"', {maxBuffer: 1000},
     function(err, stdout, stderr) {
       assert.ok(err);
       assert.ok(/maxBuffer/.test(err.message));
     });
  5:8  error  Expected indentation of 8 characters but found 7  indent
  6:8  error  Expected indentation of 8 characters but found 7  indent
  7:7  error  Expected indentation of 6 characters but found 5  indent

@targos
Copy link
Member Author

targos commented Aug 1, 2015

Also, please remove escape and unescape from the globals, they're not needed anymore.

done

@silverwind
Copy link
Contributor

I have one remaining

If that's the only case, I'd say refactor to a function expression (const cb = function() { ... }).

@silverwind
Copy link
Contributor

npm install eslint

You could make that NODE_ENV=production npm install eslint so devDependencies don't get pulled. Keeps the size of our git tree low, and I don't think we're going to run ESLint unit tests and such :)

@silverwind
Copy link
Contributor

Also, I'd suggest doing git rm -r tools/eslint && rm -rf tools/eslint before and git add tools/eslint/* after, so leftover files aren't kept in the tree.

@targos
Copy link
Member Author

targos commented Aug 1, 2015

You could make that NODE_ENV=production npm install eslint so devDependencies don't get pulled.

Isn't it the default behavior ? I don't see dev deps in tools/eslint/node_modules

suggest doing git rm -r tools/eslint && rm -rf tools/eslint before and git add tools/eslint/* after

I did it like that on last update, thanks for the tip !

@silverwind
Copy link
Contributor

Isn't it the default behavior ?

You're right, I think npm did at some point install devDependencies when that variable wasn't set, but it seems fine now.

@Fishrock123
Copy link
Contributor

Does this replace #2205, or does #2205 now depend on this?

@targos
Copy link
Member Author

targos commented Aug 1, 2015

#2205 depends on this.

@Fishrock123
Copy link
Contributor

I'm not sure about the switch/case: thing. Do we only have non-indented version in those two tests?

@targos
Copy link
Member Author

targos commented Aug 1, 2015

@Fishrock123

Yes those tests are the only ones with non indented switch cases.

(Do not lose too much time reviewing until eslint is fixed upstream)

@Fishrock123 Fishrock123 added the tools Issues and PRs related to the tools directory. label Aug 1, 2015
@targos targos force-pushed the eslint branch 2 times, most recently from 56fe182 to b18a2e9 Compare August 8, 2015 09:25
@targos targos changed the title tools: update eslint to v1.0.0 tools: update eslint to v1.x Aug 8, 2015
@targos
Copy link
Member Author

targos commented Aug 8, 2015

Updated to v1.1.0. A bunch of issues have been fixed but there are new ones :(

@silverwind
Copy link
Contributor

Still blocked on eslint/eslint#3173 from what I followed.

MylesBorins pushed a commit that referenced this pull request Jan 28, 2016
With an indentation style of two spaces, it is not possible to indent
multiline variable declarations by four spaces. Instead, the var keyword
is used on every new line.
Use const instead of var where applicable for changed lines.

PR-URL: #2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 28, 2016
MylesBorins pushed a commit that referenced this pull request Jan 28, 2016
Replace var keyword with const or let.

PR-URL: #2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 11, 2016
On case-insensitive platorms, the Debug/ rule catches the debug module
under npm and eslint.

PR-URL: #2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 11, 2016
PR-URL: #2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 11, 2016
The no-reserved-keys rule doesn't exist anymore and we don't need ES3
compatibility.
escape and unescape are now known by eslint.
--reset flag was removed and it is now the default behavior.

PR-URL: #2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 11, 2016
With an indentation style of two spaces, it is not possible to indent
multiline variable declarations by four spaces. Instead, the var keyword
is used on every new line.
Use const instead of var where applicable for changed lines.

PR-URL: #2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 11, 2016
MylesBorins pushed a commit that referenced this pull request Feb 11, 2016
Replace var keyword with const or let.

PR-URL: #2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 11, 2016
On case-insensitive platorms, the Debug/ rule catches the debug module
under npm and eslint.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 11, 2016
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 11, 2016
The no-reserved-keys rule doesn't exist anymore and we don't need ES3
compatibility.
escape and unescape are now known by eslint.
--reset flag was removed and it is now the default behavior.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 11, 2016
With an indentation style of two spaces, it is not possible to indent
multiline variable declarations by four spaces. Instead, the var keyword
is used on every new line.
Use const instead of var where applicable for changed lines.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 11, 2016
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 11, 2016
Replace var keyword with const or let.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Feb 11, 2016
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 15, 2016
On case-insensitive platorms, the Debug/ rule catches the debug module
under npm and eslint.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 15, 2016
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 15, 2016
The no-reserved-keys rule doesn't exist anymore and we don't need ES3
compatibility.
escape and unescape are now known by eslint.
--reset flag was removed and it is now the default behavior.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 15, 2016
With an indentation style of two spaces, it is not possible to indent
multiline variable declarations by four spaces. Instead, the var keyword
is used on every new line.
Use const instead of var where applicable for changed lines.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 15, 2016
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Feb 15, 2016
Replace var keyword with const or let.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
On case-insensitive platorms, the Debug/ rule catches the debug module
under npm and eslint.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
The no-reserved-keys rule doesn't exist anymore and we don't need ES3
compatibility.
escape and unescape are now known by eslint.
--reset flag was removed and it is now the default behavior.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
With an indentation style of two spaces, it is not possible to indent
multiline variable declarations by four spaces. Instead, the var keyword
is used on every new line.
Use const instead of var where applicable for changed lines.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
Replace var keyword with const or let.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.