Skip to content

Commit

Permalink
(chore) Add ESLint config and clean up the major stuff (#2503)
Browse files Browse the repository at this point in the history
* (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
  • Loading branch information
joshgoebel authored Apr 26, 2020
1 parent f6813cc commit 705f49b
Show file tree
Hide file tree
Showing 15 changed files with 1,902 additions and 198 deletions.
56 changes: 56 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"standard"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"array-callback-return": "error",
"block-scoped-var": "error",
// we like our semi-colons
"semi": ["error","always"],
// our codebase doesn't do this at all, so disabled for now
"space-before-function-paren": ["error","never"],
// for now ignore diff between types of quoting
"quotes": "off",
// this is the style we are already using
"operator-linebreak": ["error","after", { "overrides": { "?": "after", ":": "after" } }],
// sometimes we declare variables with extra spacing
"indent": ["error", 2, {"VariableDeclarator":2}],
// seems like a good idea not to use explicit undefined
"no-undefined": "error",

// TODO maybe
"camelcase": "off", // TODO: turn on later
"init-declarations": ["error","always"]
},
"overrides": [
{
"files": ["src/languages/*.js"],
"rules": {
"no-unused-expressions": "off",
// languages are all over the map and we don't want to
// do a mass edit so turn off the most egregious rule violations
"indent": "off",
"comma-dangle": "off",
"array-bracket-spacing": "off",
"object-curly-spacing": "off",
"key-spacing": "off",
"object-curly-newline": "off",
"object-property-newline": "off"
}
}
]
};
4 changes: 3 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// whole codebase isn't ES8/9 yet, but our tests and some things are
{
"esversion": 9,
"node": true
"node": true,
// eslint warns us about semicolons
"-W033": false
}
Loading

0 comments on commit 705f49b

Please sign in to comment.