Skip to content

Commit 705f49b

Browse files
authored
(chore) Add ESLint config and clean up the major stuff (#2503)
* (chore) eslint:recommended * (chore): eslint_standard * relax eslint rules for language grammars (to discourage rewriting them in one fell swoop; I'd rather have the blame history intact) * remove extra escaping * clean up variables * more camelcase
1 parent f6813cc commit 705f49b

15 files changed

+1902
-198
lines changed

.eslintrc.js

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"es6": true,
5+
"node": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"standard"
10+
],
11+
"globals": {
12+
"Atomics": "readonly",
13+
"SharedArrayBuffer": "readonly"
14+
},
15+
"parserOptions": {
16+
"ecmaVersion": 2018,
17+
"sourceType": "module"
18+
},
19+
"rules": {
20+
"array-callback-return": "error",
21+
"block-scoped-var": "error",
22+
// we like our semi-colons
23+
"semi": ["error","always"],
24+
// our codebase doesn't do this at all, so disabled for now
25+
"space-before-function-paren": ["error","never"],
26+
// for now ignore diff between types of quoting
27+
"quotes": "off",
28+
// this is the style we are already using
29+
"operator-linebreak": ["error","after", { "overrides": { "?": "after", ":": "after" } }],
30+
// sometimes we declare variables with extra spacing
31+
"indent": ["error", 2, {"VariableDeclarator":2}],
32+
// seems like a good idea not to use explicit undefined
33+
"no-undefined": "error",
34+
35+
// TODO maybe
36+
"camelcase": "off", // TODO: turn on later
37+
"init-declarations": ["error","always"]
38+
},
39+
"overrides": [
40+
{
41+
"files": ["src/languages/*.js"],
42+
"rules": {
43+
"no-unused-expressions": "off",
44+
// languages are all over the map and we don't want to
45+
// do a mass edit so turn off the most egregious rule violations
46+
"indent": "off",
47+
"comma-dangle": "off",
48+
"array-bracket-spacing": "off",
49+
"object-curly-spacing": "off",
50+
"key-spacing": "off",
51+
"object-curly-newline": "off",
52+
"object-property-newline": "off"
53+
}
54+
}
55+
]
56+
};

.jshintrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// whole codebase isn't ES8/9 yet, but our tests and some things are
22
{
33
"esversion": 9,
4-
"node": true
4+
"node": true,
5+
// eslint warns us about semicolons
6+
"-W033": false
57
}

0 commit comments

Comments
 (0)