Skip to content

tools: alignment of variable assignments that span multiple lines#6242

Closed
Trott wants to merge 2 commits into
nodejs:masterfrom
Trott:align
Closed

tools: alignment of variable assignments that span multiple lines#6242
Trott wants to merge 2 commits into
nodejs:masterfrom
Trott:align

Conversation

@Trott

@Trott Trott commented Apr 16, 2016

Copy link
Copy Markdown
Member
Checklist
  • tests and code linting passes
  • the commit message follows commit guidelines
Affected core subsystem(s)

tools, test, lib

Description of change

Since I always mess up the alignment in variable assignments, forcing
@bnoordhuis to provide nits for my pull requests, let's have a lint rule
so that I can be told by the linter instead.

Trott added 2 commits April 15, 2016 21:21
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.
Enforce alignment/indentation on variable assignments that span multiple
lines.
@Trott Trott added the tools Issues and PRs related to the tools directory. label Apr 16, 2016
@Trott

Trott commented Apr 16, 2016

Copy link
Copy Markdown
Member Author

@Trott

Trott commented Apr 16, 2016

Copy link
Copy Markdown
Member Author

CI is green except for that pesky test-http-agent test.

KHg=
-----END CERTIFICATE-----`;

var key =

@bnoordhuis bnoordhuis Apr 16, 2016

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You could make these const while you're here. Just a suggestion, though.

EDIT: OTOH, that's mixing disparate changes. Feel free to disregard.

@bnoordhuis

Copy link
Copy Markdown
Member

Nice. LGTM.

context.report(node, msg);
}

function testDecleration(context, node) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/testDecleration/testDeclaration/

@jbergstroem

Copy link
Copy Markdown
Member

LGTM

1 similar comment
@jasnell

jasnell commented Apr 18, 2016

Copy link
Copy Markdown
Member

LGTM

@jasnell

jasnell commented Apr 19, 2016

Copy link
Copy Markdown
Member

Fixing the type @mscdex points out on landing...

jasnell pushed a commit that referenced this pull request Apr 19, 2016
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell pushed a commit that referenced this pull request Apr 19, 2016
Enforce alignment/indentation on variable assignments that span multiple
lines.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell

jasnell commented Apr 19, 2016

Copy link
Copy Markdown
Member

Landed in 3160073 and ca69833

@jasnell jasnell closed this Apr 19, 2016
MylesBorins pushed a commit that referenced this pull request Apr 19, 2016
Enforce alignment/indentation on variable assignments that span multiple
lines.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
Enforce alignment/indentation on variable assignments that span multiple
lines.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Apr 20, 2016
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.

PR-URL: nodejs#6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Apr 20, 2016
Enforce alignment/indentation on variable assignments that span multiple
lines.

PR-URL: nodejs#6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
Enforce alignment/indentation on variable assignments that span multiple
lines.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Apr 20, 2016
MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
Enforce alignment/indentation on variable assignments that span multiple
lines.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
This was referenced Apr 21, 2016
MylesBorins pushed a commit that referenced this pull request Apr 21, 2016
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 21, 2016
Enforce alignment/indentation on variable assignments that span multiple
lines.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request Apr 25, 2016
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.

PR-URL: nodejs#6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request Apr 25, 2016
Enforce alignment/indentation on variable assignments that span multiple
lines.

PR-URL: nodejs#6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell pushed a commit that referenced this pull request Apr 26, 2016
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell pushed a commit that referenced this pull request Apr 26, 2016
Enforce alignment/indentation on variable assignments that span multiple
lines.

PR-URL: #6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
@mscdex

mscdex commented Apr 27, 2016

Copy link
Copy Markdown
Contributor

@Trott This change is causing linter issues due to the use of the default parameters. For example:

/usr/home/iojs/build/workspace/node-test-linter/tools/eslint-rules/align-multiline-assignment.js:10
function getBinaryExpressionStarts(binaryExpression, starts = []) {
                                                            ^

SyntaxError: Unexpected token =
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.get (/usr/home/iojs/build/workspace/node-test-linter/tools/eslint/lib/rules.js:70:16)
    at getRuleOptionsSchema (/usr/home/iojs/build/workspace/node-test-linter/tools/eslint/lib/config/config-validator.js:33:22)
    at validateRuleOptions (/usr/home/iojs/build/workspace/node-test-linter/tools/eslint/lib/config/config-validator.js:70:18)

@Trott

Trott commented Apr 27, 2016

Copy link
Copy Markdown
Member Author

That's weird. Default parameters are in the current node and presumably that CI is using current master with the current version of v8 that we have in master...

@Trott

Trott commented Apr 27, 2016

Copy link
Copy Markdown
Member Author

@mscdex Looks like the a problem might be in the lint-ci job. If I introduce a lint error into the code, make jslint runs fine, but make lint-ci returns no errors and exits with a successful code.

@silverwind

Copy link
Copy Markdown
Contributor

@Trott I also see it locally, even when running eslint directly:

$ node tools/eslint/bin/eslint.js --rulesdir tools/eslint-rules test/doctool
Unexpected token =
SyntaxError: Unexpected token =
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.get (/Users/silverwind/git/node/tools/eslint/lib/rules.js:70:16)
    at getRuleOptionsSchema (/Users/silverwind/git/node/tools/eslint/lib/config/config-validator.js:33:22)
    at validateRuleOptions (/Users/silverwind/git/node/tools/eslint/lib/config/config-validator.js:70:18)

Maybe it's an ESLint bug?

@silverwind

Copy link
Copy Markdown
Contributor

Nevermind, my local node was not 6.0.0 yet, working now.

@Trott

Trott commented Apr 28, 2016

Copy link
Copy Markdown
Member Author

For the record, the issue is that the VM in CI that does linting uses the system Node.js rather than compiling it from source. It does this so that the linting will finish quickly. There's a PR in to back out the default parameter in our custom lint rule. When it lands, this will be a non-issue again.

@MylesBorins

Copy link
Copy Markdown
Contributor

@Trott this will need to be manually backported

@Trott Trott mentioned this pull request May 18, 2016
@Trott

Trott commented May 18, 2016

Copy link
Copy Markdown
Member Author

@thealphanerd Here you go: #6869

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.

7 participants