Skip to content

Commit b611caa

Browse files
Trottrvagg
authored andcommitted
tools: add recommended linting rules
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 <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent e7bf951 commit b611caa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

.eslintrc

+6
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,21 @@ rules:
2626
no-ex-assign: 2
2727
no-extra-boolean-cast : 2
2828
no-extra-semi: 2
29+
no-func-assign: 2
2930
no-invalid-regexp: 2
3031
no-irregular-whitespace: 2
32+
no-negated-in-lhs: 2
33+
no-obj-calls: 2
3134
no-proto: 2
3235
no-unexpected-multiline: 2
3336
no-unreachable: 2
37+
use-isnan: 2
3438
valid-typeof: 2
3539

3640
# Best Practices
3741
# https://github.com/eslint/eslint/tree/master/docs/rules#best-practices
3842
no-fallthrough: 2
43+
no-octal: 2
3944
no-redeclare: 2
4045

4146
# Stylistic Issues
@@ -71,6 +76,7 @@ rules:
7176

7277
# Variables
7378
# https://github.com/eslint/eslint/tree/master/docs/rules#variables
79+
no-delete-var: 2
7480
no-undef: 2
7581
no-unused-vars: [2, {"args": "none"}]
7682

0 commit comments

Comments
 (0)