yomichan/.eslintrc.json

133 lines
4.7 KiB
JSON
Raw Normal View History

2019-11-25 05:40:30 +00:00
{
2020-02-01 20:00:11 +00:00
"root": true,
2019-11-25 05:40:30 +00:00
"extends": "eslint:recommended",
"parserOptions": {
2020-02-01 20:00:11 +00:00
"ecmaVersion": 8,
"sourceType": "script"
},
"env": {
"browser": true,
"es2017": true,
"webextensions": true
2019-11-25 05:40:30 +00:00
},
2020-02-12 03:11:28 +00:00
"plugins": ["no-unsanitized"],
2019-11-25 19:48:20 +00:00
"ignorePatterns": [
"/ext/mixed/lib/",
"/ext/bg/js/templates.js"
],
2019-11-25 05:40:30 +00:00
"rules": {
2019-11-27 03:01:54 +00:00
"arrow-parens": ["error", "always"],
2019-11-25 05:40:30 +00:00
"comma-dangle": ["error", "never"],
2019-11-25 19:48:20 +00:00
"curly": ["error", "all"],
2019-11-25 05:40:30 +00:00
"dot-notation": "error",
2019-11-25 19:48:20 +00:00
"eqeqeq": "error",
2020-02-16 01:11:29 +00:00
"func-names": ["error", "always"],
2020-02-26 03:11:33 +00:00
"guard-for-in": "error",
"new-parens": "error",
2019-11-25 05:40:30 +00:00
"no-case-declarations": "error",
2019-11-25 19:48:20 +00:00
"no-const-assign": "error",
"no-constant-condition": "off",
2020-02-01 20:00:34 +00:00
"no-global-assign": "error",
"no-param-reassign": "off",
2020-02-17 20:30:41 +00:00
"no-prototype-builtins": "error",
2020-02-17 20:21:30 +00:00
"no-shadow": ["error", {"builtinGlobals": false}],
2020-02-01 20:00:34 +00:00
"no-undef": "error",
"no-unexpected-multiline": "error",
2020-02-16 01:11:29 +00:00
"no-unneeded-ternary": "error",
2019-11-25 19:48:20 +00:00
"no-unused-vars": ["error", {"vars": "local", "args": "after-used", "argsIgnorePattern": "^_", "caughtErrors": "none"}],
2020-02-01 20:00:11 +00:00
"no-unused-expressions": "error",
2019-11-25 19:48:20 +00:00
"no-var": "error",
"prefer-const": ["error", {"destructuring": "all"}],
2019-11-25 05:40:30 +00:00
"quote-props": ["error", "consistent"],
2019-11-25 19:48:20 +00:00
"quotes": ["error", "single", "avoid-escape"],
"require-atomic-updates": "off",
2020-02-12 03:11:28 +00:00
"semi": "error",
"wrap-iife": ["error", "inside"],
2020-02-16 01:11:29 +00:00
// Whitespace rules
"brace-style": ["error", "1tbs", {"allowSingleLine": true}],
"indent": ["error", 4, {"SwitchCase": 1, "MemberExpression": 1, "flatTernaryExpressions": true, "ignoredNodes": ["ConditionalExpression"]}],
"object-curly-newline": "error",
"padded-blocks": ["error", "never"],
"array-bracket-spacing": ["error", "never"],
"arrow-spacing": ["error", {"before": true, "after": true}],
"block-spacing": ["error", "always"],
"comma-spacing": ["error", { "before": false, "after": true }],
"computed-property-spacing": ["error", "never"],
"func-call-spacing": ["error", "never"],
"function-paren-newline": ["error", "multiline-arguments"],
2020-02-16 01:11:29 +00:00
"generator-star-spacing": ["error", "before"],
"key-spacing": ["error", {"beforeColon": false, "afterColon": true, "mode": "strict"}],
"keyword-spacing": ["error", {"before": true, "after": true}],
"no-trailing-spaces": "error",
"no-whitespace-before-property": "error",
"object-curly-spacing": ["error", "never"],
"rest-spread-spacing": ["error", "never"],
"semi-spacing": ["error", {"before": false, "after": true}],
"space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
2020-02-16 01:11:29 +00:00
"space-in-parens": ["error", "never"],
"space-unary-ops": "error",
2020-03-11 02:30:36 +00:00
"spaced-comment": ["error", "always"],
2020-02-16 01:11:29 +00:00
"switch-colon-spacing": ["error", {"after": true, "before": false}],
"template-curly-spacing": ["error", "never"],
"template-tag-spacing": ["error", "never"],
// Extensions
2020-02-12 03:11:28 +00:00
"no-unsanitized/method": "error",
"no-unsanitized/property": "error"
2020-02-01 20:00:34 +00:00
},
"overrides": [
{
"files": ["ext/**/*.js"],
2020-02-01 20:00:34 +00:00
"excludedFiles": ["ext/mixed/js/core.js"],
"globals": {
"yomichan": "readonly",
"errorToJson": "readonly",
"jsonToError": "readonly",
"isObject": "readonly",
"hasOwn": "readonly",
"toIterable": "readonly",
"stringReverse": "readonly",
"promiseTimeout": "readonly",
2020-02-12 03:19:47 +00:00
"parseUrl": "readonly",
2020-03-28 17:20:42 +00:00
"areSetsEqual": "readonly",
"getSetIntersection": "readonly",
2020-02-01 20:00:34 +00:00
"EventDispatcher": "readonly",
2020-02-16 21:33:48 +00:00
"EventListenerCollection": "readonly",
2020-02-01 20:00:34 +00:00
"EXTENSION_IS_BROWSER_EDGE": "readonly"
}
},
{
"files": ["ext/mixed/js/core.js"],
"globals": {
"chrome": "writable"
}
},
{
"files": ["ext/bg/js/settings/*.js"],
"env": {
"jquery": true
}
2020-02-12 03:21:30 +00:00
},
{
"files": ["test/**/*.js"],
"excludedFiles": ["test/data/html/*.js"],
2020-02-20 01:00:27 +00:00
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
},
2020-02-12 03:21:30 +00:00
"env": {
"browser": false,
2020-02-20 01:00:27 +00:00
"es2017": true,
"node": true,
"webextensions": false
2020-02-12 03:21:30 +00:00
}
2020-02-01 20:00:34 +00:00
}
]
2019-11-25 05:40:30 +00:00
}