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,
|
2021-02-15 17:38:45 +00:00
|
|
|
"sourceType": "script",
|
|
|
|
"ecmaFeatures": {
|
|
|
|
"globalReturn": false,
|
|
|
|
"impliedStrict": true
|
|
|
|
}
|
2020-02-01 20:00:11 +00:00
|
|
|
},
|
|
|
|
"env": {
|
|
|
|
"browser": true,
|
|
|
|
"es2017": true,
|
|
|
|
"webextensions": true
|
2019-11-25 05:40:30 +00:00
|
|
|
},
|
2021-02-26 01:21:05 +00:00
|
|
|
"plugins": [
|
|
|
|
"no-unsanitized",
|
2022-05-20 14:28:38 +00:00
|
|
|
"header",
|
|
|
|
"jsdoc"
|
2021-02-26 01:21:05 +00:00
|
|
|
],
|
2019-11-25 19:48:20 +00:00
|
|
|
"ignorePatterns": [
|
2021-02-14 16:24:43 +00:00
|
|
|
"/ext/lib/"
|
2019-11-25 19:48:20 +00:00
|
|
|
],
|
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",
|
2021-01-17 17:20:06 +00:00
|
|
|
"no-undefined": "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
|
|
|
|
|
|
|
"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"],
|
|
|
|
|
2020-02-12 03:11:28 +00:00
|
|
|
"no-unsanitized/method": "error",
|
2021-02-26 01:21:05 +00:00
|
|
|
"no-unsanitized/property": "error",
|
|
|
|
|
2022-05-20 14:28:38 +00:00
|
|
|
"jsdoc/check-access": "error",
|
|
|
|
"jsdoc/check-alignment": "error",
|
|
|
|
"jsdoc/check-line-alignment": "error",
|
|
|
|
"jsdoc/check-param-names": "error",
|
|
|
|
"jsdoc/check-property-names": "error",
|
|
|
|
"jsdoc/check-tag-names": "error",
|
|
|
|
"jsdoc/check-types": "error",
|
|
|
|
"jsdoc/check-values": "error",
|
|
|
|
"jsdoc/empty-tags": "error",
|
|
|
|
"jsdoc/implements-on-classes": "error",
|
|
|
|
"jsdoc/multiline-blocks": "error",
|
|
|
|
"jsdoc/newline-after-description": ["error", "never"],
|
|
|
|
"jsdoc/no-bad-blocks": "error",
|
|
|
|
"jsdoc/no-multi-asterisks": "error",
|
|
|
|
"jsdoc/require-asterisk-prefix": "error",
|
|
|
|
"jsdoc/require-hyphen-before-param-description": ["error", "never"],
|
|
|
|
"jsdoc/require-jsdoc": "off",
|
|
|
|
"jsdoc/require-param": "error",
|
|
|
|
"jsdoc/require-param-description": "error",
|
|
|
|
"jsdoc/require-param-name": "error",
|
|
|
|
"jsdoc/require-param-type": "error",
|
|
|
|
"jsdoc/require-property": "error",
|
|
|
|
"jsdoc/require-property-description": "error",
|
|
|
|
"jsdoc/require-property-name": "error",
|
|
|
|
"jsdoc/require-property-type": "error",
|
|
|
|
"jsdoc/require-returns": "error",
|
|
|
|
"jsdoc/require-returns-check": "error",
|
|
|
|
"jsdoc/require-returns-description": "error",
|
|
|
|
"jsdoc/require-returns-type": "error",
|
|
|
|
"jsdoc/require-throws": "error",
|
|
|
|
"jsdoc/require-yields": "error",
|
|
|
|
"jsdoc/require-yields-check": "error",
|
|
|
|
"jsdoc/tag-lines": "error",
|
|
|
|
"jsdoc/valid-types": "error",
|
|
|
|
|
2021-02-26 01:21:05 +00:00
|
|
|
"header/header": ["error", "block", [
|
|
|
|
"",
|
2022-02-03 01:43:10 +00:00
|
|
|
{"pattern": " \\* Copyright \\(C\\) (\\d+-)?2022 Yomichan Authors"},
|
2021-02-26 01:21:05 +00:00
|
|
|
" *",
|
|
|
|
" * This program is free software: you can redistribute it and/or modify",
|
|
|
|
" * it under the terms of the GNU General Public License as published by",
|
|
|
|
" * the Free Software Foundation, either version 3 of the License, or",
|
|
|
|
" * (at your option) any later version.",
|
|
|
|
" *",
|
|
|
|
" * This program is distributed in the hope that it will be useful,",
|
|
|
|
" * but WITHOUT ANY WARRANTY; without even the implied warranty of",
|
|
|
|
" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
|
|
|
" * GNU General Public License for more details.",
|
|
|
|
" *",
|
|
|
|
" * You should have received a copy of the GNU General Public License",
|
|
|
|
" * along with this program. If not, see <https://www.gnu.org/licenses/>.",
|
|
|
|
" "
|
|
|
|
]]
|
2020-02-01 20:00:34 +00:00
|
|
|
},
|
|
|
|
"overrides": [
|
2020-06-28 16:40:02 +00:00
|
|
|
{
|
2020-09-04 22:19:43 +00:00
|
|
|
"files": [
|
2021-02-14 03:52:28 +00:00
|
|
|
"ext/js/core.js",
|
2021-07-17 21:10:25 +00:00
|
|
|
"ext/js/**/sandbox/**/*.js"
|
2020-09-04 22:19:43 +00:00
|
|
|
],
|
2020-06-28 16:40:02 +00:00
|
|
|
"env": {
|
|
|
|
"webextensions": false
|
|
|
|
}
|
|
|
|
},
|
2020-02-01 20:00:34 +00:00
|
|
|
{
|
2020-02-26 03:30:29 +00:00
|
|
|
"files": ["ext/**/*.js"],
|
2020-09-04 22:19:43 +00:00
|
|
|
"excludedFiles": [
|
2021-02-14 03:52:28 +00:00
|
|
|
"ext/js/core.js",
|
2021-11-24 03:08:30 +00:00
|
|
|
"ext/js/accessibility/google-docs.js",
|
2021-07-17 21:10:25 +00:00
|
|
|
"ext/js/**/sandbox/**/*.js"
|
2020-09-04 22:19:43 +00:00
|
|
|
],
|
2020-02-01 20:00:34 +00:00
|
|
|
"globals": {
|
2021-01-08 02:36:20 +00:00
|
|
|
"serializeError": "readonly",
|
|
|
|
"deserializeError": "readonly",
|
2020-02-01 20:00:34 +00:00
|
|
|
"isObject": "readonly",
|
|
|
|
"stringReverse": "readonly",
|
|
|
|
"promiseTimeout": "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-11-10 02:47:25 +00:00
|
|
|
"deepEqual": "readonly",
|
2020-08-22 19:49:24 +00:00
|
|
|
"generateId": "readonly",
|
2020-08-23 16:43:53 +00:00
|
|
|
"promiseAnimationFrame": "readonly",
|
2021-02-14 23:18:02 +00:00
|
|
|
"invokeMessageHandler": "readonly",
|
2021-02-14 22:52:01 +00:00
|
|
|
"log": "readonly",
|
2020-08-22 21:50:56 +00:00
|
|
|
"DynamicProperty": "readonly",
|
2020-02-01 20:00:34 +00:00
|
|
|
"EventDispatcher": "readonly",
|
2021-02-14 22:52:01 +00:00
|
|
|
"EventListenerCollection": "readonly",
|
|
|
|
"Logger": "readonly"
|
2020-02-01 20:00:34 +00:00
|
|
|
}
|
|
|
|
},
|
2020-06-28 15:26:43 +00:00
|
|
|
{
|
|
|
|
"files": ["ext/**/*.js"],
|
|
|
|
"excludedFiles": [
|
2021-02-14 03:52:28 +00:00
|
|
|
"ext/js/core.js",
|
2021-11-24 03:08:30 +00:00
|
|
|
"ext/js/accessibility/google-docs.js",
|
2021-02-14 23:20:35 +00:00
|
|
|
"ext/js/yomichan.js",
|
2021-07-17 21:10:25 +00:00
|
|
|
"ext/js/**/sandbox/**/*.js"
|
2020-06-28 15:26:43 +00:00
|
|
|
],
|
|
|
|
"globals": {
|
|
|
|
"yomichan": "readonly"
|
|
|
|
}
|
|
|
|
},
|
2020-02-01 20:00:34 +00:00
|
|
|
{
|
2021-02-14 03:52:28 +00:00
|
|
|
"files": ["ext/js/yomichan.js"],
|
2020-02-01 20:00:34 +00:00
|
|
|
"globals": {
|
|
|
|
"chrome": "writable"
|
|
|
|
}
|
|
|
|
},
|
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-12-18 20:54:05 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": [
|
2021-02-14 03:52:28 +00:00
|
|
|
"ext/js/core.js",
|
|
|
|
"ext/js/yomichan.js",
|
2021-11-24 03:23:14 +00:00
|
|
|
"ext/js/accessibility/accessibility-controller.js",
|
2021-02-15 01:25:41 +00:00
|
|
|
"ext/js/background/backend.js",
|
|
|
|
"ext/js/background/profile-conditions-util.js",
|
|
|
|
"ext/js/background/request-builder.js",
|
2021-11-23 00:29:20 +00:00
|
|
|
"ext/js/background/script-manager.js",
|
2022-05-30 01:42:26 +00:00
|
|
|
"ext/js/comm/anki-connect.js",
|
2021-02-14 16:19:54 +00:00
|
|
|
"ext/js/comm/clipboard-monitor.js",
|
|
|
|
"ext/js/comm/clipboard-reader.js",
|
2021-02-15 01:25:41 +00:00
|
|
|
"ext/js/comm/mecab.js",
|
2021-02-25 02:54:58 +00:00
|
|
|
"ext/js/data/anki-util.js",
|
2021-02-14 16:19:54 +00:00
|
|
|
"ext/js/data/database.js",
|
|
|
|
"ext/js/data/json-schema.js",
|
|
|
|
"ext/js/data/options-util.js",
|
|
|
|
"ext/js/data/permissions-util.js",
|
2021-07-31 17:04:16 +00:00
|
|
|
"ext/js/data/sandbox/string-util.js",
|
2021-02-14 16:19:54 +00:00
|
|
|
"ext/js/dom/simple-dom-parser.js",
|
2022-05-29 01:57:25 +00:00
|
|
|
"ext/js/extension/environment.js",
|
2021-02-15 01:25:41 +00:00
|
|
|
"ext/js/general/cache-map.js",
|
|
|
|
"ext/js/general/object-property-accessor.js",
|
2021-03-09 02:01:55 +00:00
|
|
|
"ext/js/general/regex-util.js",
|
2021-02-14 16:19:54 +00:00
|
|
|
"ext/js/general/text-source-map.js",
|
2021-02-15 01:25:41 +00:00
|
|
|
"ext/js/language/deinflector.js",
|
|
|
|
"ext/js/language/dictionary-database.js",
|
2021-07-17 21:10:25 +00:00
|
|
|
"ext/js/language/sandbox/dictionary-data-util.js",
|
|
|
|
"ext/js/language/sandbox/japanese-util.js",
|
2021-02-14 16:19:54 +00:00
|
|
|
"ext/js/language/translator.js",
|
2021-02-15 01:25:41 +00:00
|
|
|
"ext/js/media/audio-downloader.js",
|
|
|
|
"ext/js/media/media-util.js",
|
|
|
|
"ext/js/templates/template-patcher.js",
|
2021-02-14 16:19:54 +00:00
|
|
|
"ext/js/background/background-main.js"
|
2020-12-18 20:54:05 +00:00
|
|
|
],
|
|
|
|
"env": {
|
|
|
|
"browser": false,
|
|
|
|
"serviceworker": true,
|
|
|
|
"es2017": true,
|
|
|
|
"webextensions": true
|
|
|
|
},
|
|
|
|
"globals": {
|
|
|
|
"FileReader": "readonly",
|
|
|
|
"Intl": "readonly",
|
|
|
|
"crypto": "readonly"
|
|
|
|
}
|
2021-02-15 17:38:45 +00:00
|
|
|
},
|
2021-07-31 18:46:09 +00:00
|
|
|
{
|
|
|
|
"files": [
|
|
|
|
"ext/js/core.js",
|
|
|
|
"ext/js/data/database.js",
|
|
|
|
"ext/js/data/json-schema.js",
|
|
|
|
"ext/js/general/cache-map.js",
|
|
|
|
"ext/js/language/dictionary-database.js",
|
|
|
|
"ext/js/language/dictionary-importer.js",
|
2021-08-28 18:22:16 +00:00
|
|
|
"ext/js/language/dictionary-worker-handler.js",
|
2021-08-14 15:46:26 +00:00
|
|
|
"ext/js/language/dictionary-worker-media-loader.js",
|
2021-07-31 18:46:09 +00:00
|
|
|
"ext/js/media/media-util.js"
|
|
|
|
],
|
|
|
|
"env": {
|
|
|
|
"browser": false,
|
|
|
|
"worker": true,
|
|
|
|
"es2017": true,
|
|
|
|
"webextensions": true
|
|
|
|
}
|
|
|
|
},
|
2021-02-15 17:38:45 +00:00
|
|
|
{
|
|
|
|
"files": [
|
|
|
|
"ext/js/**/*.js"
|
|
|
|
],
|
|
|
|
"excludedFiles": [
|
|
|
|
"ext/js/core.js",
|
|
|
|
"ext/js/**/*main.js"
|
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"no-implicit-globals": "error"
|
|
|
|
}
|
2022-08-20 15:17:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": [
|
|
|
|
"ext/js/**/*.js"
|
|
|
|
],
|
|
|
|
"globals": {
|
|
|
|
"AbortController": "readonly"
|
|
|
|
}
|
2020-02-01 20:00:34 +00:00
|
|
|
}
|
|
|
|
]
|
2019-11-25 05:40:30 +00:00
|
|
|
}
|