 Issue 29346539:
  Issue 3692 - Created global eslintrc  (Closed)
    
  
    Issue 29346539:
  Issue 3692 - Created global eslintrc  (Closed) 
  | Index: .eslintrc.json | 
| =================================================================== | 
| new file mode 100644 | 
| --- /dev/null | 
| +++ b/.eslintrc.json | 
| @@ -0,0 +1,58 @@ | 
| +{ | 
| + "extends": "eslint:recommended", | 
| + "rules": { | 
| + /* MDN General practices */ | 
| 
kzar
2016/09/16 10:33:51
(It surprised me to see comments in a JSON file bu
 
juliandoucette
2016/10/13 14:14:08
Acknowledged.
Let me know if you think we should
 | 
| + "no-else-return": "warn", | 
| + "no-console": "warn", | 
| + "no-debugger": "warn", | 
| + "no-alert": "warn", | 
| 
kzar
2016/09/16 10:33:50
There are some valid uses of alert in adblockplusc
 
Wladimir Palant
2016/09/16 11:37:06
Actually, using console.error() can be valid when
 
kzar
2016/09/16 12:12:57
Hmm good point. I guess I'm easy between options 2
 
juliandoucette
2016/10/13 14:14:10
Acknowledged.
I changed this to rely on eslint:re
 | 
| + "linebreak-style": ["warn", "unix"], | 
| 
kzar
2016/09/16 10:33:50
Shouldn't linebreak-style be an error too, or am I
 
juliandoucette
2016/10/13 14:14:09
Done.
 | 
| + "indent": ["warn", 2], | 
| + "valid-jsdoc": "warn", | 
| + "eol-last": "warn", | 
| 
Wladimir Palant
2016/09/16 08:07:42
This is already part of eslint:recommended, we don
 
juliandoucette
2016/10/13 14:14:08
Done.
 | 
| + "vars-on-top": "off", | 
| 
Wladimir Palant
2016/09/16 08:07:43
This isn't part of eslint:recommended, no point sw
 
juliandoucette
2016/10/13 14:14:08
Done.
 | 
| + /* MDN Naming and formatting code */ | 
| + "no-irregular-whitespace": "warn", | 
| 
Wladimir Palant
2016/09/16 08:07:43
Like above, this is already part of eslint:recomme
 
kzar
2016/09/16 10:33:51
Yea and it should really be an error. One time a z
 
juliandoucette
2016/10/13 14:14:10
Done.
 | 
| + "no-trailing-spaces": "warn", | 
| + "max-len": ["warn", 80], | 
| + "brace-style": ["warn", "allman"], | 
| + /* MDN JavaScript practices */ | 
| + "no-eq-null": "off", | 
| 
Wladimir Palant
2016/09/16 08:07:42
This isn't part of eslint:recommended, no point sw
 
juliandoucette
2016/10/13 14:14:09
Done.
 | 
| + "no-redeclare": "error", | 
| 
Wladimir Palant
2016/09/16 08:07:43
This is already part of eslint:recommended.
 
kzar
2016/09/16 10:33:51
To play devil's advocate perhaps it's good to spec
 
Wladimir Palant
2016/09/16 11:37:06
I think that eslint:recommended usually changes wh
 
kzar
2016/09/16 12:12:57
Fair enough.
 
juliandoucette
2016/10/13 14:14:08
Done.
 | 
| + "consistent-return": "error", | 
| 
kzar
2016/09/16 10:33:51
Does everyone agree with consistent-return? To me
 
Wladimir Palant
2016/09/16 11:37:06
Yes, consistent-return is important and actually s
 
juliandoucette
2016/10/13 14:14:08
Done.
 
kzar
2017/01/31 10:17:48
One example where I think consistent-return might
 | 
| + "no-undef": "error", | 
| 
Wladimir Palant
2016/09/16 08:07:43
This is already part of eslint:recommended.
 
juliandoucette
2016/10/13 14:14:09
Done.
 | 
| + "no-unused-vars": "warn", | 
| 
Wladimir Palant
2016/09/16 08:07:43
The reason I switched this rule off: it produces t
 
kzar
2016/09/16 10:33:51
Agreed, it's better to not use a parameter than si
 
juliandoucette
2016/10/13 14:14:09
Done.
 | 
| + "no-array-constructor": "warn", | 
| + "no-new-object": "warn", | 
| + /* ABP General */ | 
| + "no-warning-comments": "warn", | 
| + /* Palant recommends */ | 
| 
kzar
2016/09/16 10:33:50
Nit: Mind adding a newline before each new section
 
juliandoucette
2016/10/13 14:14:09
Done.
 | 
| + "array-bracket-spacing": "warn", | 
| + "arrow-spacing": "warn", | 
| + "comma-spacing": "warn", | 
| + "comma-style": "warn", | 
| + "computed-property-spacing": "warn", | 
| + "key-spacing": "warn", | 
| + "keyword-spacing": "warn", | 
| + "new-parens": "warn", | 
| + "no-spaced-func": "warn", | 
| + "no-var": "warn", | 
| 
kzar
2016/09/16 10:33:51
We need to use var in adblockpluschrome in some pl
 
Wladimir Palant
2016/09/16 11:37:06
This is an ES6 config, and we are already discussi
 | 
| + "no-whitespace-before-property": "warn", | 
| + "object-curly-spacing": "warn", | 
| + "operator-assignment": "warn", | 
| + "operator-linebreak": "warn", | 
| + "padded-blocks": ["warn", "never"], | 
| + "prefer-rest-params": "warn", | 
| + "prefer-spread": "warn", | 
| 
kzar
2016/09/16 10:33:51
I don't mind using the spread operator instead of
 
Wladimir Palant
2016/09/16 11:37:06
We definitely could and should.
Note that we are
 
kzar
2016/09/16 12:12:57
Perhaps I'll give it a go if I ever find time. I v
 
juliandoucette
2016/10/13 14:14:09
Acknowledged.
 | 
| + "require-yield": "warn", | 
| + "quotes": ["warn", "double", {"avoidEscape": true}], | 
| + "semi": "warn", | 
| + "semi-spacing": "warn", | 
| + "space-before-function-paren": ["warn", "never"], | 
| + "space-in-parens": "warn", | 
| + "space-infix-ops": "warn", | 
| + "space-unary-ops": "warn", | 
| + "spaced-comment": "warn", | 
| + "yield-star-spacing": "warn" | 
| + } | 
| +} |