Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: .eslintrc.json

Issue 29374555: Issue 3692 - Add base ESLint configuration (Closed)
Patch Set: Created Feb. 3, 2017, 9:18 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: .eslintrc.json
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000000000000000000000000000000000000..f052f4fd854a9903625e6d53011189ea9cd189a4
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,92 @@
+{
+ "extends": "eslint:recommended",
+ "env": {
+ "es6": true
+ },
+ "rules": {
+ "array-bracket-spacing": "error",
+ "arrow-spacing": "error",
+ "block-scoped-var": "error",
+ "block-spacing": "error",
+ "brace-style": ["error", "allman", {"allowSingleLine": true}],
+ "camelcase": ["error", {"properties": "never"}],
+ "comma-dangle": "error",
+ "comma-spacing": "error",
+ "comma-style": "error",
+ "computed-property-spacing": "error",
Wladimir Palant 2017/02/03 10:24:13 It's a pity that the consensus was apparently to r
Sebastian Noack 2017/02/03 12:49:32 I generally agree that it makes the code flow more
kzar 2017/02/04 03:18:55 I don't want to use the consistent-return rule for
+ "curly": ["error", "multi-or-nest", "consistent"],
+ "eol-last": "error",
+ "func-call-spacing": "error",
+ "indent": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first"}],
+ "key-spacing": "error",
+ "keyword-spacing": "error",
+ "linebreak-style": "error",
+ "lines-around-directive": "error",
+ "max-len": ["error", 80, {"ignoreUrls": true}],
+ "new-parens": "error",
+ "no-array-constructor": "error",
+ "no-caller": "error",
+ "no-case-declarations": "off",
Wladimir Palant 2017/02/03 10:24:13 Is this a good idea? Lexical declarations inside c
Sebastian Noack 2017/02/03 12:49:32 There is no difference (or potential footgun) in t
Wladimir Palant 2017/02/03 13:01:34 Try it ;) This code will actually error out at co
kzar 2017/02/04 03:18:55 I don't mind too much either way about this rule,
Sebastian Noack 2017/02/04 16:43:37 Wladimir is right that in his example omitting the
Wladimir Palant 2017/02/04 21:13:13 The point of a linter is catching errors before yo
Sebastian Noack 2017/02/05 18:22:39 I completely agree, having code that might fall th
Wladimir Palant 2017/02/06 09:55:19 That's not what I meant. Here is the actual code:
Sebastian Noack 2017/02/06 13:54:43 Regardless whether you put a redundant block aroun
kzar 2017/02/06 16:26:13 Well honestly I don't mind too much either way. Ho
Sebastian Noack 2017/02/06 17:26:00 Honestly, I cannot see how this is still a controv
+ "no-catch-shadow": "error",
+ "no-cond-assign": "off",
Wladimir Palant 2017/02/03 10:24:13 Frankly, I'd rather not disable this. An assignmen
Sebastian Noack 2017/02/03 12:49:32 From the earlier discussion: While I might agree t
kzar 2017/02/04 03:18:55 I agree with Sebastian here, it's sometimes a usef
+ "no-console": ["error", {"allow": ["warn", "error", "trace"]}],
+ "no-control-regex": "off",
+ "no-else-return": "error",
+ "no-eval": "error",
+ "no-extra-bind": "error",
+ "no-extra-label": "error",
+ "no-implied-eval": "error",
+ "no-labels": "error",
+ "no-lone-blocks": "error",
+ "no-lonely-if": "error",
+ "no-multi-spaces": "error",
+ "no-new-func": "error",
+ "no-new-object": "error",
+ "no-proto": "error",
+ "no-self-compare": "error",
+ "no-shadow": "error",
+ "no-trailing-spaces": "error",
+ "no-undef": "off",
Wladimir Palant 2017/02/03 10:24:13 Why is this rule turned off? Flagging undeclared v
Sebastian Noack 2017/02/03 12:49:31 While we tested that rule on our code base, we not
Wladimir Palant 2017/02/03 13:01:34 This indicates an issue. Built-in browser APIs and
kzar 2017/02/04 03:18:55 I can see arguments either way for this rule and w
Sebastian Noack 2017/02/04 16:43:37 IMO, the job of a linter is to ensure good coding
Wladimir Palant 2017/02/04 21:13:13 I see, that's the main reason for our disagreement
Sebastian Noack 2017/02/05 18:22:39 If we can catch some errors early, that is a nice
kzar 2017/02/06 06:21:01 I've added the boilerplate required for no-undef i
Sebastian Noack 2017/02/06 17:26:00 Thanks. Indeed, the configuration for environment-
kzar 2017/02/07 06:37:58 Sure, we can improve on the work in adblockpluschr
Sebastian Noack 2017/02/07 11:57:15 The linter configuration defines our coding practi
kzar 2017/02/07 17:07:51 It's a WIP but here you go https://codereview.adbl
kzar 2017/02/09 04:55:27 Since you've now gone through and reviewed the adb
+ "no-unneeded-ternary": "error",
+ "no-unused-vars": "off",
+ "no-useless-computed-key": "error",
+ "no-useless-concat": "error",
+ "no-useless-escape": "error",
+ "no-useless-return": "error",
+ "no-var": "error",
+ "no-warning-comments": "error",
+ "no-whitespace-before-property": "error",
+ "no-with": "error",
+ "object-curly-spacing": "error",
+ "object-shorthand": ["error", "always", {
+ "avoidExplicitReturnArrows": true
+ }],
+ "one-var": ["error", "never"],
+ "operator-assignment": "error",
+ "operator-linebreak": "error",
+ "padded-blocks": ["error", "never"],
+ "prefer-arrow-callback": "error",
+ "prefer-destructuring": ["error", {"array": false}],
+ "prefer-numeric-literals": "error",
+ "prefer-spread": "error",
Wladimir Palant 2017/02/03 10:24:13 What about prefer-rest-params?
Sebastian Noack 2017/02/03 12:49:32 Well spotted. We had it in there before, and I don
kzar 2017/02/04 03:18:55 I omitted this rule since I assumed rest parameter
+ "quote-props": ["error", "as-needed"],
+ "quotes": ["error", "double", {"avoidEscape": true}],
+ "radix": "error",
+ "rest-spread-spacing": "error",
+ "semi": "error",
+ "semi-spacing": "error",
+ "space-before-function-paren": ["error", "never"],
+ "space-in-parens": "error",
+ "space-infix-ops": "error",
+ "space-unary-ops": "error",
+ "spaced-comment": "error",
+ "strict": ["error", "global"],
+ "valid-jsdoc": ["error", {
+ "requireParamDescription": false,
+ "requireReturn": false,
+ "requireReturnDescription": false
+ }],
+ "yield-star-spacing": "error",
+ "yoda": "error"
+ }
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld