-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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 recommended linting rules #5188
Conversation
LGTM but regarding |
@thefourtheye I may be misunderstanding, but I don't think that would work:
Anything (including |
|
|
@thefourtheye wrote:
Ah! I see! Well, fortunately, the linting rule won't flag that. So everybody wins! |
@thefourtheye |
LGTM. Can you also add a line about |
@targos I understand that. I was actually referring to the performance drop mentioned in #1925 |
This change adds ESLint rules that meet two criteria: * recommended by ESLint * require no code changes These rules are: * `no-func-assign`: Disallow overwriting a function that was written as a function declaration. * `no-negated-in-lhs`: Disallow negated left operand of `in` operator. It prevents `if(!a in b)` when `if(!(a in b))` is intended. * `no-obj-calls`: Disallow global object function calls. It prevents errors like `JSON()` and `Math()`. to exercise the code in tests or whatever, it can sneak in. * `use-isnan`: Prevents errors like `if (foo == NaN)` * `no-octal`: Disallows confusing constructs like `var num = 071;` * `no-delete-var`: Delete works on properties, not variables. Disallows `delete foo`.
@targos Whoops, missed that one! I've updated the commit message. |
This change adds ESLint rules that meet two criteria: * recommended by ESLint * require no code changes These rules are: * `no-func-assign`: Disallow overwriting a function that was written as a function declaration. * `no-negated-in-lhs`: Disallow negated left operand of `in` operator. It prevents `if(!a in b)` when `if(!(a in b))` is intended. * `no-obj-calls`: Disallow global object function calls. It prevents errors like `JSON()` and `Math()`. to exercise the code in tests or whatever, it can sneak in. * `use-isnan`: Prevents errors like `if (foo == NaN)` * `no-octal`: Disallows confusing constructs like `var num = 071;` * `no-delete-var`: Delete works on properties, not variables. Disallows `delete foo`. PR-URL: #5188 Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Landed in ffbc05a |
This change adds ESLint rules that meet two criteria: * recommended by ESLint * require no code changes These rules are: * `no-func-assign`: Disallow overwriting a function that was written as a function declaration. * `no-negated-in-lhs`: Disallow negated left operand of `in` operator. It prevents `if(!a in b)` when `if(!(a in b))` is intended. * `no-obj-calls`: Disallow global object function calls. It prevents errors like `JSON()` and `Math()`. to exercise the code in tests or whatever, it can sneak in. * `use-isnan`: Prevents errors like `if (foo == NaN)` * `no-octal`: Disallows confusing constructs like `var num = 071;` * `no-delete-var`: Delete works on properties, not variables. Disallows `delete foo`. PR-URL: #5188 Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This change adds ESLint rules that meet two criteria: * recommended by ESLint * require no code changes These rules are: * `no-func-assign`: Disallow overwriting a function that was written as a function declaration. * `no-negated-in-lhs`: Disallow negated left operand of `in` operator. It prevents `if(!a in b)` when `if(!(a in b))` is intended. * `no-obj-calls`: Disallow global object function calls. It prevents errors like `JSON()` and `Math()`. to exercise the code in tests or whatever, it can sneak in. * `use-isnan`: Prevents errors like `if (foo == NaN)` * `no-octal`: Disallows confusing constructs like `var num = 071;` * `no-delete-var`: Delete works on properties, not variables. Disallows `delete foo`. PR-URL: #5188 Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This change adds ESLint rules that meet two criteria: * recommended by ESLint * require no code changes These rules are: * `no-func-assign`: Disallow overwriting a function that was written as a function declaration. * `no-negated-in-lhs`: Disallow negated left operand of `in` operator. It prevents `if(!a in b)` when `if(!(a in b))` is intended. * `no-obj-calls`: Disallow global object function calls. It prevents errors like `JSON()` and `Math()`. to exercise the code in tests or whatever, it can sneak in. * `use-isnan`: Prevents errors like `if (foo == NaN)` * `no-octal`: Disallows confusing constructs like `var num = 071;` * `no-delete-var`: Delete works on properties, not variables. Disallows `delete foo`. PR-URL: #5188 Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This change adds ESLint rules that meet two criteria: * recommended by ESLint * require no code changes These rules are: * `no-func-assign`: Disallow overwriting a function that was written as a function declaration. * `no-negated-in-lhs`: Disallow negated left operand of `in` operator. It prevents `if(!a in b)` when `if(!(a in b))` is intended. * `no-obj-calls`: Disallow global object function calls. It prevents errors like `JSON()` and `Math()`. to exercise the code in tests or whatever, it can sneak in. * `use-isnan`: Prevents errors like `if (foo == NaN)` * `no-octal`: Disallows confusing constructs like `var num = 071;` * `no-delete-var`: Delete works on properties, not variables. Disallows `delete foo`. PR-URL: nodejs#5188 Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This change adds ESLint rules that meet two criteria: * recommended by ESLint * require no code changes These rules are: * `no-func-assign`: Disallow overwriting a function that was written as a function declaration. * `no-negated-in-lhs`: Disallow negated left operand of `in` operator. It prevents `if(!a in b)` when `if(!(a in b))` is intended. * `no-obj-calls`: Disallow global object function calls. It prevents errors like `JSON()` and `Math()`. to exercise the code in tests or whatever, it can sneak in. * `use-isnan`: Prevents errors like `if (foo == NaN)` * `no-octal`: Disallows confusing constructs like `var num = 071;` * `no-delete-var`: Delete works on properties, not variables. Disallows `delete foo`. PR-URL: #5188 Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This change adds ESLint rules that meet two criteria:
These rules are:
no-func-assign
: Disallow overwriting a function that was writtenas a function declaration.
no-negated-in-lhs
: Disallow negated left operand ofin
operator.It prevents
if(!a in b)
whenif(!(a in b))
is intended.no-obj-calls
: Disallow global object function calls. It preventserrors like
JSON()
andMath()
.use-isnan
: Prevents errors likeif (foo == NaN)
no-octal
: Disallows confusing constructs likevar num = 071;
no-delete-var
: Delete works on properties, not variables. Disallowsdelete foo
.This may make configuration much more concise if we turn on recommended rules and then disable ones that we aren't using.
And it may prevent some errors from making it into the PR stage and requiring a reviewer to correct.