mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-22 09:31:08 +00:00
70c652d565
- 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.
72 lines
1.9 KiB
JavaScript
72 lines
1.9 KiB
JavaScript
/* global module */
|
|
|
|
module.exports = {
|
|
"env": {
|
|
"browser": true,
|
|
"es6": true
|
|
},
|
|
|
|
"extends": "eslint:recommended",
|
|
|
|
"rules": {
|
|
// 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",
|
|
}
|
|
};
|