[assets] Add rules to ESLint:
- Fix long line. - Enforce a few stylistic habits: - Avoid some potential dangerous constructs. - `arrow-spacing`: Use at least one space around arrows. - `keyword-spacing`: Use at least one space around keywords (if, else, for…). - `no-multiple-empty-lines`: Only use one empty line between code. - `no-var`: Use `let` or `const` instead of `var`: - `padded-blocks`: Do not pad blocks. - `padding-line-between-statements`: Use empty lines between some statements. - `space-before-blocks`: Use at least one space before the opening brace of a block.
This commit is contained in:
parent
991d897ac7
commit
70c652d565
3 changed files with 105 additions and 23 deletions
60
.eslintrc.js
60
.eslintrc.js
|
@ -9,6 +9,64 @@ module.exports = {
|
|||
"extends": "eslint:recommended",
|
||||
|
||||
"rules": {
|
||||
"strict": "error"
|
||||
// Possible Errors
|
||||
"no-async-promise-executor": "error",
|
||||
"no-await-in-loop": "error",
|
||||
"no-class-assign": "error",
|
||||
"no-confusing-arrow": "error",
|
||||
"no-const-assign": "error",
|
||||
"no-dupe-class-members": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-template-curly-in-string": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
"no-useless-constructor": "error",
|
||||
"no-useless-rename": "error",
|
||||
"require-atomic-updates": "error",
|
||||
|
||||
// Best practices
|
||||
"strict": "error",
|
||||
"no-var": "error",
|
||||
|
||||
// Stylistic Issues
|
||||
"arrow-spacing": "error",
|
||||
"keyword-spacing": "error",
|
||||
"no-multiple-empty-lines": [
|
||||
"error",
|
||||
{
|
||||
"max": 1,
|
||||
},
|
||||
],
|
||||
"padded-blocks": [
|
||||
"error",
|
||||
"never",
|
||||
],
|
||||
"padding-line-between-statements": [
|
||||
"error",
|
||||
{
|
||||
// always before return
|
||||
"blankLine": "always",
|
||||
"prev": "*",
|
||||
"next": "return",
|
||||
},
|
||||
{
|
||||
// always before block-like expressions
|
||||
"blankLine": "always",
|
||||
"prev": "*",
|
||||
"next": "block-like",
|
||||
},
|
||||
{
|
||||
// always after variable declaration
|
||||
"blankLine": "always",
|
||||
"prev": [ "const", "let", "var" ],
|
||||
"next": "*",
|
||||
},
|
||||
{
|
||||
// not necessary between variable declaration
|
||||
"blankLine": "any",
|
||||
"prev": [ "const", "let", "var" ],
|
||||
"next": [ "const", "let", "var" ],
|
||||
},
|
||||
],
|
||||
"space-before-blocks": "error",
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue