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
base: master
from

Conversation

Projects
None yet
10 participants
@not-an-aardvark
Member

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)
@@ -918,7 +918,7 @@ Server.prototype.addContext = function(servername, context) {
var re = new RegExp('^' +
servername.replace(/([\.^$+?\-\\[\]{}])/g, '\\$1')
.replace(/\*/g, '[^\.]*') +
.replace(/\*/g, '[^.]*') +

This comment has been minimized.

@not-an-aardvark

not-an-aardvark Sep 18, 2016

Member

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

@not-an-aardvark

not-an-aardvark Sep 18, 2016

Member

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

This comment has been minimized.

@ChALkeR

ChALkeR Sep 18, 2016

Member

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

@ChALkeR

ChALkeR Sep 18, 2016

Member

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

@not-an-aardvark

This comment has been minimized.

Show comment
Hide comment
@targos

targos approved these changes Sep 18, 2016

LGTM

@ChALkeR

LGTM

@addaleax

LGTM

@silverwind

LGTM

@cjihrig

LGTM

@lpinca

lpinca approved these changes Sep 18, 2016

LGTM

@lpinca

This comment has been minimized.

Show comment
Hide comment
@lpinca

lpinca Sep 18, 2016

Member

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

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.

@jasnell

LGTM

@jasnell

This comment has been minimized.

Show comment
Hide comment
@jasnell

jasnell Sep 20, 2016

Member

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

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 added some commits Sep 18, 2016

@not-an-aardvark

This comment has been minimized.

Show comment
Hide comment
@not-an-aardvark

not-an-aardvark Sep 20, 2016

Member

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.)

Member

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 not-an-aardvark self-assigned this Sep 21, 2016

@not-an-aardvark

This comment has been minimized.

Show comment
Hide comment
@not-an-aardvark
Member

not-an-aardvark commented Sep 21, 2016

Landed in b1b1978

@not-an-aardvark not-an-aardvark deleted the not-an-aardvark:linter-rules branch Sep 21, 2016

@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

tools: add additional ESLint rules
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 added a commit that referenced this pull request Oct 11, 2016

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