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: apply stricter indentation rules to tools #13758

Closed
wants to merge 3 commits into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Jun 18, 2017

ESLint 4.0.0 provides stricter (and more granular) indentation checking
than previous versions. Apply the stricter indentation rules to the
tools directory.

In preparation for applying the more strict indentation linting
available in ESLint 4.0.0, correct minor indentation issues in
tools/eslint-rules/required-modules.js.

This is the only file with indentation that does not conform to the
stricter checks.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

tools

@Trott Trott added the tools Issues and PRs related to the tools directory. label Jun 18, 2017
@@ -77,13 +77,13 @@ module.exports = function(context) {
function(module) {
return foundModules.indexOf(module === -1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR: Should this line be return foundModules.indexOf(module) === -1; instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or even requiredModules.filter(module => !foundModules.includes(module))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, fixed.

@gibfahn
Copy link
Member

gibfahn commented Jun 18, 2017

Oh cool, I wonder how this applies to test/...

./node tools/eslint/bin/eslint.js --cache --rulesdir=tools/eslint-rules --ext=.js test
✖ 2460 problems (2460 errors, 0 warnings)
  2460 errors, 0 warnings potentially fixable with the `--fix` option.

Okay, wonder how many can be --fix ed

./node tools/eslint/bin/eslint.js --cache --fix --rulesdir=tools/eslint-rules --ext=.js test
✖ 1923 problems (1923 errors, 0 warnings)
  1917 errors, 0 warnings potentially fixable with the `--fix` option.

@not-an-aardvark do you know why things like this can't be --fixed? Is it just a question of someone implementing it, or is is more complex (i.e. the surrounding lines would have to be refactored)?

/Users/gib/wrk/com/node/test/sequential/test-pipe.js
  104:1  error  Expected indentation of 6 spaces but found 4  indent
  105:1  error  Expected indentation of 6 spaces but found 4  indent
  106:9  error  Expected indentation of 6 spaces but found 8  indent-legacy
  107:9  error  Expected indentation of 6 spaces but found 8  indent-legacy
  108:7  error  Expected indentation of 4 spaces but found 6  indent-legacy
  109:1  error  Expected indentation of 4 spaces but found 2  indent

@targos
Copy link
Member

targos commented Jun 18, 2017

I guess you need to disable indent-legacy.

@gibfahn
Copy link
Member

gibfahn commented Jun 18, 2017

Looking at the docs, I thought indent was a superset of indent-legacy, so I assumed that wouldn't be an issue, but I could be wrong.

@not-an-aardvark
Copy link
Contributor

It is mostly a superset, but I think there are a few cases where indent-legacy has a bug and tries to enforce the wrong indentation.

In preparation for applying the more strict indentation linting
available in ESLint 4.0.0, correct minor indentation issues in
tools/eslint-rules/required-modules.js.

This is the only file with indentation that does not conform to the
stricter checks.
ESLint 4.0.0 provides stricter (and more granular) indentation checking
than previous versions. Apply the stricter indentation rules to the
tools directory.
Fix previously-unnoticed typo in `required-modules.js`.

Refs: nodejs#13758 (comment)
@Trott
Copy link
Member Author

Trott commented Jun 19, 2017

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Trott added a commit to Trott/io.js that referenced this pull request Jun 23, 2017
In preparation for applying the more strict indentation linting
available in ESLint 4.0.0, correct minor indentation issues in
tools/eslint-rules/required-modules.js.

This is the only file with indentation that does not conform to the
stricter checks.

PR-URL: nodejs#13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Trott added a commit to Trott/io.js that referenced this pull request Jun 23, 2017
ESLint 4.0.0 provides stricter (and more granular) indentation checking
than previous versions. Apply the stricter indentation rules to the
tools directory.

PR-URL: nodejs#13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Trott added a commit to Trott/io.js that referenced this pull request Jun 23, 2017
Fix previously-unnoticed typo in `required-modules.js`.

Refs: nodejs#13758 (comment)
PR-URL: nodejs#13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@Trott
Copy link
Member Author

Trott commented Jun 23, 2017

Landed in 491f838, ea36609, and 25b4d87

@Trott Trott closed this Jun 23, 2017
@addaleax addaleax mentioned this pull request Jun 24, 2017
addaleax pushed a commit that referenced this pull request Jun 24, 2017
In preparation for applying the more strict indentation linting
available in ESLint 4.0.0, correct minor indentation issues in
tools/eslint-rules/required-modules.js.

This is the only file with indentation that does not conform to the
stricter checks.

PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
addaleax pushed a commit that referenced this pull request Jun 24, 2017
ESLint 4.0.0 provides stricter (and more granular) indentation checking
than previous versions. Apply the stricter indentation rules to the
tools directory.

PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
addaleax pushed a commit that referenced this pull request Jun 24, 2017
Fix previously-unnoticed typo in `required-modules.js`.

Refs: #13758 (comment)
PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@addaleax addaleax mentioned this pull request Jun 24, 2017
@MylesBorins
Copy link
Contributor

This does not land cleanly in LTS. Please feel free to manually backport. Please also feel free to replace the backport request label with do-not-land if it shouldn't land

@Trott
Copy link
Member Author

Trott commented Jul 18, 2017

@MylesBorins Some required stuff probably landed in the last 12 hours, as all three commits here cherry-pick cleanly for me to v6.x-staging now. Can you try again?

@MylesBorins
Copy link
Contributor

@Trott getting failures when landing this

/usr/local/opt/python/bin/python2.7 tools/test.py --mode=release -J \
		doctool inspector known_issues message pseudo-tty parallel sequential addons
[02:04|% 100|+ 1357|-   0]: Done
/Applications/Xcode.app/Contents/Developer/usr/bin/make lint
Running JS linter...
./node tools/eslint/bin/eslint.js --cache --rulesdir=tools/eslint-rules \
	  benchmark lib test tools
/Users/mborins/code/node/v6.x/tools/.eslintrc.yaml:
	Configuration for rule "indent" is invalid:
	Value "off" is the wrong type.

Error: /Users/mborins/code/node/v6.x/tools/.eslintrc.yaml:
	Configuration for rule "indent" is invalid:
	Value "off" is the wrong type.

    at validateRuleOptions (/Users/mborins/code/node/v6.x/tools/eslint/lib/config/config-validator.js:109:15)
    at Object.keys.forEach.id (/Users/mborins/code/node/v6.x/tools/eslint/lib/config/config-validator.js:156:13)
    at Array.forEach (native)
    at Object.validate (/Users/mborins/code/node/v6.x/tools/eslint/lib/config/config-validator.js:155:35)
    at Object.load (/Users/mborins/code/node/v6.x/tools/eslint/lib/config/config-file.js:559:19)
    at loadConfig (/Users/mborins/code/node/v6.x/tools/eslint/lib/config.js:63:33)
    at getLocalConfig (/Users/mborins/code/node/v6.x/tools/eslint/lib/config.js:130:29)
    at Config.getConfig (/Users/mborins/code/node/v6.x/tools/eslint/lib/config.js:260:26)
    at hashOfConfigFor (/Users/mborins/code/node/v6.x/tools/eslint/lib/cli-engine.js:599:41)
    at executeOnFile (/Users/mborins/code/node/v6.x/tools/eslint/lib/cli-engine.js:648:32)

Trott added a commit to Trott/io.js that referenced this pull request Jul 19, 2017
In preparation for applying the more strict indentation linting
available in ESLint 4.0.0, correct minor indentation issues in
tools/eslint-rules/required-modules.js.

This is the only file with indentation that does not conform to the
stricter checks.

PR-URL: nodejs#13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Trott added a commit to Trott/io.js that referenced this pull request Jul 19, 2017
ESLint 4.0.0 provides stricter (and more granular) indentation checking
than previous versions. Apply the stricter indentation rules to the
tools directory.

PR-URL: nodejs#13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Trott added a commit to Trott/io.js that referenced this pull request Jul 19, 2017
Fix previously-unnoticed typo in `required-modules.js`.

Refs: nodejs#13758 (comment)
PR-URL: nodejs#13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@Trott
Copy link
Member Author

Trott commented Jul 19, 2017

@MylesBorins Backport in #14360

MylesBorins pushed a commit that referenced this pull request Jul 21, 2017
In preparation for applying the more strict indentation linting
available in ESLint 4.0.0, correct minor indentation issues in
tools/eslint-rules/required-modules.js.

This is the only file with indentation that does not conform to the
stricter checks.

Backport-PR-URL: #14360
PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 21, 2017
ESLint 4.0.0 provides stricter (and more granular) indentation checking
than previous versions. Apply the stricter indentation rules to the
tools directory.

Backport-PR-URL: #14360
PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 21, 2017
Fix previously-unnoticed typo in `required-modules.js`.

Backport-PR-URL: #14360
Refs: #13758 (comment)
PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 21, 2017
In preparation for applying the more strict indentation linting
available in ESLint 4.0.0, correct minor indentation issues in
tools/eslint-rules/required-modules.js.

This is the only file with indentation that does not conform to the
stricter checks.

Backport-PR-URL: #14360
PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 21, 2017
ESLint 4.0.0 provides stricter (and more granular) indentation checking
than previous versions. Apply the stricter indentation rules to the
tools directory.

Backport-PR-URL: #14360
PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 21, 2017
Fix previously-unnoticed typo in `required-modules.js`.

Backport-PR-URL: #14360
Refs: #13758 (comment)
PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jul 21, 2017
MylesBorins pushed a commit that referenced this pull request Jul 31, 2017
In preparation for applying the more strict indentation linting
available in ESLint 4.0.0, correct minor indentation issues in
tools/eslint-rules/required-modules.js.

This is the only file with indentation that does not conform to the
stricter checks.

Backport-PR-URL: #14360
PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 31, 2017
ESLint 4.0.0 provides stricter (and more granular) indentation checking
than previous versions. Apply the stricter indentation rules to the
tools directory.

Backport-PR-URL: #14360
PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 31, 2017
Fix previously-unnoticed typo in `required-modules.js`.

Backport-PR-URL: #14360
Refs: #13758 (comment)
PR-URL: #13758
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@Trott Trott deleted the tools-indenting branch January 13, 2022 22:45
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.

10 participants