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",
|
2020-05-02 17:04:17 +00:00
|
|
|
"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",
|
2020-02-17 20:28:10 +00:00
|
|
|
"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",
|
2020-07-03 20:10:08 +00:00
|
|
|
"no-underscore-dangle": ["error", {"allowAfterThis": true, "allowAfterSuper": false, "allowAfterThisConstructor": false}],
|
2020-05-02 17:04:17 +00:00
|
|
|
"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",
|
2020-05-02 17:04:17 +00:00
|
|
|
"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"],
|
2020-05-02 17:04:17 +00:00
|
|
|
"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}],
|
2020-05-02 17:04:17 +00:00
|
|
|
"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": [
|
2020-06-28 16:40:02 +00:00
|
|
|
{
|
|
|
|
"files": ["ext/mixed/js/core.js"],
|
|
|
|
"env": {
|
|
|
|
"webextensions": false
|
|
|
|
}
|
|
|
|
},
|
2020-02-01 20:00:34 +00:00
|
|
|
{
|
2020-02-26 03:30:29 +00:00
|
|
|
"files": ["ext/**/*.js"],
|
2020-02-01 20:00:34 +00:00
|
|
|
"excludedFiles": ["ext/mixed/js/core.js"],
|
|
|
|
"globals": {
|
|
|
|
"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-05-03 01:39:24 +00:00
|
|
|
"getSetDifference": "readonly",
|
2020-05-23 00:03:34 +00:00
|
|
|
"escapeRegExp": "readonly",
|
2020-06-28 15:23:51 +00:00
|
|
|
"deferPromise": "readonly",
|
2020-06-28 16:38:34 +00:00
|
|
|
"clone": "readonly",
|
2020-02-01 20:00:34 +00:00
|
|
|
"EventDispatcher": "readonly",
|
2020-06-28 16:40:02 +00:00
|
|
|
"EventListenerCollection": "readonly"
|
2020-02-01 20:00:34 +00:00
|
|
|
}
|
|
|
|
},
|
2020-06-28 15:26:43 +00:00
|
|
|
{
|
|
|
|
"files": ["ext/**/*.js"],
|
|
|
|
"excludedFiles": [
|
|
|
|
"ext/mixed/js/core.js",
|
|
|
|
"ext/mixed/js/yomichan.js"
|
|
|
|
],
|
|
|
|
"globals": {
|
|
|
|
"yomichan": "readonly"
|
|
|
|
}
|
|
|
|
},
|
2020-02-01 20:00:34 +00:00
|
|
|
{
|
2020-06-28 16:40:02 +00:00
|
|
|
"files": ["ext/mixed/js/yomichan.js"],
|
2020-02-01 20:00:34 +00:00
|
|
|
"globals": {
|
|
|
|
"chrome": "writable"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": ["ext/bg/js/settings/*.js"],
|
|
|
|
"env": {
|
|
|
|
"jquery": true
|
|
|
|
}
|
2020-02-12 03:21:30 +00:00
|
|
|
},
|
|
|
|
{
|
2020-08-09 17:09:06 +00:00
|
|
|
"files": [
|
|
|
|
"test/**/*.js",
|
|
|
|
"dev/**/*.js"
|
|
|
|
],
|
2020-04-04 20:56:06 +00:00
|
|
|
"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
|
|
|
}
|