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: add additional ESLint rules #8643

Closed
wants to merge 2 commits into from

Conversation

not-an-aardvark
Copy link
Contributor

@not-an-aardvark not-an-aardvark commented Sep 18, 2016

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

tools

Description of change

This enables the following ESLint rules, all of which are already followed in the vast majority of the codebase:

  • dot-location: On multiline property access, require the dot to be placed next to the property name rather than the object name. (1 existing violation)
  • no-useless-call: Disallow unnecessary Function.prototype.call expressions, e.g. foo.bar.call(foo). (0 existing violations)
  • no-useless-escape: Disallows characters in strings/regexes from being escaped with a backslash unless the backslash is actually doing something. (8 existing violations)
  • no-void: Disallows void expressions. (0 existing violations)
  • no-with: Disallows with statements. (0 existing violations)
  • comma-style: Require commas to be placed at the end of a line, rather than the beginning. (1 existing violation)
  • computed-property-spacing: When accessing a computed property (e.g. foo[bar]), disallow spaces inside the square brackets. (2 existing violations)
  • no-tabs: Disallow tab characters. (1 existing violation)
  • semi-spacing: Disallow spaces before semicolons, and require spaces after semicolons. (2 existing violations)

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. tls Issues and PRs related to the tls subsystem. labels Sep 18, 2016
@not-an-aardvark not-an-aardvark added the tools Issues and PRs related to the tools directory. label Sep 18, 2016
@@ -918,7 +918,7 @@ Server.prototype.addContext = function(servername, context) {

var re = new RegExp('^' +
servername.replace(/([\.^$+?\-\\[\]{}])/g, '\\$1')
.replace(/\*/g, '[^\.]*') +
.replace(/\*/g, '[^.]*') +
Copy link
Contributor Author

@not-an-aardvark not-an-aardvark Sep 18, 2016

Choose a reason for hiding this comment

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

This is only tangentially related to this PR, but was this line supposed to have a double backslash? This line looks like it was supposed to be

.replace(/\*/g, '[^\\.]*')`

...but since it's in a string literal rather than a regex literal, the backslash before the dot isn't doing anything.

/cc @indutny based on git blame

Copy link
Member

Choose a reason for hiding this comment

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

There is no actual difference between any of the three variants there, so we could just keep it as [^.]*.

@not-an-aardvark
Copy link
Contributor Author

Copy link
Member

@targos targos left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ChALkeR ChALkeR left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@silverwind silverwind left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

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

LGTM

@lpinca
Copy link
Member

lpinca commented Sep 18, 2016

@not-an-aardvark I took the liberty of fixing the link to no-useless-escape, it was pointing to no-useless-call.

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

LGTM

@jasnell
Copy link
Member

jasnell commented Sep 20, 2016

@not-an-aardvark : It looks like this is introducing a number of new linting failures that should be fixed up before it lands.

@not-an-aardvark
Copy link
Contributor Author

not-an-aardvark commented Sep 20, 2016

Thanks for letting me know; I rebased/fixed the new linting errors.

New CI: https://ci.nodejs.org/job/node-test-pull-request/4180/

(Planning to land this in a few hours if no one has objections.)

@not-an-aardvark
Copy link
Contributor Author

Landed in b1b1978

@not-an-aardvark not-an-aardvark deleted the linter-rules branch September 21, 2016 03:25
@not-an-aardvark not-an-aardvark removed their assignment Sep 21, 2016
not-an-aardvark added a commit that referenced this pull request Sep 21, 2016
PR-URL: #8643
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@keybase.io>
Fishrock123 pushed a commit that referenced this pull request Oct 11, 2016
PR-URL: #8643
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@keybase.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib / src Issues and PRs related to general changes in the lib or src directory. tls Issues and PRs related to the tls subsystem. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants