Skip to content

Conversation

@Trott
Copy link
Member

ESLint 4.x has stricter linting than previous versions. We are currently
using the legacy indentation rules in the test directory. This commit
changes the indentation of files to comply with the stricter 4.x
linting and enable stricter linting in the test directory.

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

test tools

@TrottTrott added test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory. labels Jul 23, 2017
@nodejs-github-botnodejs-github-bot added async_hooks Issues and PRs related to the async hooks subsystem. dont-land-on-v4.x inspector Issues and PRs related to the V8 inspector protocol node-api Issues and PRs related to the Node-API. test Issues and PRs related to the tests. labels Jul 23, 2017
Copy link
Contributor

@XadillaXXadillaXJul 23, 2017

Choose a reason for hiding this comment

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

If we have to split parameters into several lines, I'd like to let first parameter use a new line also.

eg.

assert.strictEqual(addon.doInstanceOf(...),(theObjectinstanceoftheConstructor));

VS

assert.strictEqual(addon.doInstanceOf(...),(theObjectinstanceoftheConstructor));

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'll do it here and anywhere else someone flags in this PR, but not sure about everywhere because this sort of thing is all over our code base already and the churn would be extreme.

Copy link
Contributor

Choose a reason for hiding this comment

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

a tiny nit: may be off according to overall verbose style.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Oh, yes, and I'll make the same change in lib/.eslintrc.yaml too!

Copy link
Contributor

Choose a reason for hiding this comment

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

I am a bit confused here. The comment states the tabs are needed here (as the eslint comment above disabling no-tabs).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Oops, yeah, I probably messed that test up. Will fix...

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems this line can be unwrapped now.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Done!

Copy link
Contributor

@vsemozhetbytvsemozhetbytJul 23, 2017

Choose a reason for hiding this comment

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

It seems this line can be unwrapped (de-concatenated) now.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Done!

Copy link
Contributor

@refackrefack left a comment

Choose a reason for hiding this comment

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

Some nits

Copy link
Contributor

@refackrefackJul 23, 2017

Choose a reason for hiding this comment

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

I guess this is very C++, but not my cup of tea.
If there are no objections I'd rather have

exports=module.exports=functioninitHooks({ oninit, onbefore, onafter, ondestroy, allowNoInit, logid, logtype }={}){

Copy link
Member

Choose a reason for hiding this comment

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

Uhh I'd prefer the form in the PR, because imagine what that variant would look like if I were to add another option.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it's definatly at it's limit... Although at a later stage we could move the destructuring into the function's body...
Anyway, I'm not strongly opposed to current format.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Improved readability slightly by adding a new line after logtype...

Copy link
Contributor

Choose a reason for hiding this comment

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

That's the rule? just the first one, and then there's a continuation indent added...
Not amazing 🤷‍♂️

Copy link
MemberAuthor

@TrottTrottJul 24, 2017

Choose a reason for hiding this comment

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

Continuation indentation is ignored. So this is fine by the linter:

constrequest=Buffer.from('HTTP/1.1 200 OK'+CRLF+'Content-Type: text/plain'+CRLF+'Content-Length: 4'+CRLF+CRLF+'pong');

Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO it should be "square"
AFAICT it's only in this file.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Will square them all up. Might also take the opportunity to get rid of the CRLF constant...

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

All squared up.

Copy link
Contributor

Choose a reason for hiding this comment

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

could you chop all the parameters:

constresult=childProcess.spawnSync(process.execPath,['--use-bundled-ca','--use-openssl-ca','-p','process.version'],{encoding: 'utf8'});

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like this one:

constresult=childProcess.spawnSync(process.execPath,['--use-bundled-ca','--use-openssl-ca','-p','process.version'],{encoding: 'utf8'});

Copy link
Contributor

Choose a reason for hiding this comment

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

Either one's good by me,

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Went with this third option:

constresult=childProcess.spawnSync(process.execPath,['--use-bundled-ca','--use-openssl-ca','-p','process.version'],{encoding: 'utf8'});

@refack
Copy link
Contributor

refack commented Jul 23, 2017

@Trott is an experienced contributor I'm using the red ❌ , but it's not a hard block. I'm assuming this is the result of eslint --fix, cause some fixes are wonky...

@TrottTrottforce-pushed the indent-tests branch 3 times, most recently from deda5b7 to 63f23d7CompareJuly 24, 2017 21:31
@TrottTrottforce-pushed the indent-tests branch 3 times, most recently from 20f1051 to ff0c507CompareJuly 24, 2017 22:31
@Trott
Copy link
MemberAuthor

Nits addressed as far as I know. PTAL, @refack, and anyone else.

Copy link
Contributor

Choose a reason for hiding this comment

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

not related to this PR about whitespace, but could we enforce trailing commas? makes things easier in git when another field is added and only have a 1 line change instead of 2.

Copy link
Contributor

@vsemozhetbytvsemozhetbytJul 25, 2017

Choose a reason for hiding this comment

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

I was trying to propose this for the docs, but it seems this lacks approvement:
#12557

Copy link
Contributor

Choose a reason for hiding this comment

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

this just looks weird. having the body of code on the same indentation level is confusing when quickly scanning the code.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Agreed. Will fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a non whitespace change in a commit that only refers to changes in whitespace. Please also make note of this is the git message body.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'll move that file's changes into its own commit.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Moved to its own commit.

@TrottTrottforce-pushed the indent-tests branch 3 times, most recently from 478b3f1 to 2e13dc4CompareJuly 25, 2017 17:37
Trott added a commit to Trott/io.js that referenced this pull request Jul 27, 2017
ESLint 4.x has stricter linting than previous versions. We are currently using the legacy indentation rules in the test directory. This commit changes the indentation of files to comply with the stricter 4.x linting and enable stricter linting in the test directory. PR-URL: nodejs#14431 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
@Trott
Copy link
MemberAuthor

Landed in 4f0b107 and aa6fac6

@TrottTrott closed this Jul 27, 2017
addaleax pushed a commit that referenced this pull request Jul 27, 2017
* eliminate CRLF identifier, reducing string concatenation * adjust indentation for stricter ESLint 4.x indentation linting PR-URL: #14431 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
@addaleax
Copy link
Member

This doesn’t land cleanly on 8.x; if you can, please follow the guide and raise a backport PR, if you don’t think it’s worth it let me know and add the dont-land-on label.

Trott added a commit to Trott/io.js that referenced this pull request Jul 27, 2017
ESLint 4.x has stricter linting than previous versions. We are currently using the legacy indentation rules in the test directory. This commit changes the indentation of files to comply with the stricter 4.x linting and enable stricter linting in the test directory. PR-URL: nodejs#14431 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
@Trott
Copy link
MemberAuthor

Backported in #14522.

addaleax pushed a commit that referenced this pull request Jul 28, 2017
ESLint 4.x has stricter linting than previous versions. We are currently using the legacy indentation rules in the test directory. This commit changes the indentation of files to comply with the stricter 4.x linting and enable stricter linting in the test directory. Backport-PR-URL: #14522 Backport-Reviewed-By: Anna Henningsen <[email protected]> PR-URL: #14431 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
@refackrefack mentioned this pull request Jul 30, 2017
4 tasks
@addaleaxaddaleax mentioned this pull request Aug 2, 2017
Trott added a commit to Trott/io.js that referenced this pull request Aug 15, 2017
ESLint 4.x has stricter linting than previous versions. We are currently using the legacy indentation rules in the test directory. This commit changes the indentation of files to comply with the stricter 4.x linting and enable stricter linting in the test directory. Backport-PR-URL: nodejs#14522 Backport-Reviewed-By: Anna Henningsen <[email protected]> PR-URL: nodejs#14431 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
MylesBorins pushed a commit that referenced this pull request Aug 16, 2017
ESLint 4.x has stricter linting than previous versions. We are currently using the legacy indentation rules in the test directory. This commit changes the indentation of files to comply with the stricter 4.x linting and enable stricter linting in the test directory. Backport-PR-URL: #14835 PR-URL: #14431 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Aug 16, 2017
MylesBorins pushed a commit that referenced this pull request Sep 5, 2017
ESLint 4.x has stricter linting than previous versions. We are currently using the legacy indentation rules in the test directory. This commit changes the indentation of files to comply with the stricter 4.x linting and enable stricter linting in the test directory. Backport-PR-URL: #14835 PR-URL: #14431 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
@TrottTrott deleted the indent-tests branch January 13, 2022 22:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_hooksIssues and PRs related to the async hooks subsystem.inspectorIssues and PRs related to the V8 inspector protocolnode-apiIssues and PRs related to the Node-API.testIssues and PRs related to the tests.toolsIssues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@Trott@refack@trevnorris@addaleax@TimothyGu@XadillaX@vsemozhetbyt@MylesBorins@nodejs-github-bot