120 lines
4.3 KiB
JSON
120 lines
4.3 KiB
JSON
{
|
|
"root": true,
|
|
"extends": "eslint:recommended",
|
|
"parserOptions": {
|
|
"ecmaVersion": 8,
|
|
"sourceType": "script"
|
|
},
|
|
"env": {
|
|
"browser": true,
|
|
"es2017": true,
|
|
"webextensions": true
|
|
},
|
|
"plugins": ["no-unsanitized"],
|
|
"ignorePatterns": [
|
|
"/ext/mixed/lib/",
|
|
"/ext/bg/js/templates.js"
|
|
],
|
|
"rules": {
|
|
"arrow-parens": ["error", "always"],
|
|
"comma-dangle": ["error", "never"],
|
|
"curly": ["error", "all"],
|
|
"dot-notation": "error",
|
|
"eqeqeq": "error",
|
|
"func-names": ["error", "always"],
|
|
"no-case-declarations": "error",
|
|
"no-const-assign": "error",
|
|
"no-constant-condition": "off",
|
|
"no-global-assign": "error",
|
|
"no-shadow": ["error", {"builtinGlobals": false}],
|
|
"no-undef": "error",
|
|
"no-unneeded-ternary": "error",
|
|
"no-unused-vars": ["error", {"vars": "local", "args": "after-used", "argsIgnorePattern": "^_", "caughtErrors": "none"}],
|
|
"no-unused-expressions": "error",
|
|
"no-var": "error",
|
|
"prefer-const": ["error", {"destructuring": "all"}],
|
|
"quote-props": ["error", "consistent"],
|
|
"quotes": ["error", "single", "avoid-escape"],
|
|
"require-atomic-updates": "off",
|
|
"semi": "error",
|
|
|
|
// 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"],
|
|
"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-in-parens": ["error", "never"],
|
|
"space-unary-ops": "error",
|
|
"spaced-comment": ["error", "always", {"markers": ["global"]}],
|
|
"switch-colon-spacing": ["error", {"after": true, "before": false}],
|
|
"template-curly-spacing": ["error", "never"],
|
|
"template-tag-spacing": ["error", "never"],
|
|
|
|
// Extensions
|
|
"no-unsanitized/method": "error",
|
|
"no-unsanitized/property": "error"
|
|
},
|
|
"overrides": [
|
|
{
|
|
"files": ["*.js"],
|
|
"excludedFiles": ["ext/mixed/js/core.js"],
|
|
"globals": {
|
|
"yomichan": "readonly",
|
|
"errorToJson": "readonly",
|
|
"jsonToError": "readonly",
|
|
"logError": "readonly",
|
|
"isObject": "readonly",
|
|
"hasOwn": "readonly",
|
|
"toIterable": "readonly",
|
|
"stringReverse": "readonly",
|
|
"promiseTimeout": "readonly",
|
|
"stringReplaceAsync": "readonly",
|
|
"parseUrl": "readonly",
|
|
"EventDispatcher": "readonly",
|
|
"EventListenerCollection": "readonly",
|
|
"EXTENSION_IS_BROWSER_EDGE": "readonly"
|
|
}
|
|
},
|
|
{
|
|
"files": ["ext/mixed/js/core.js"],
|
|
"globals": {
|
|
"chrome": "writable"
|
|
}
|
|
},
|
|
{
|
|
"files": ["ext/bg/js/settings/*.js"],
|
|
"env": {
|
|
"jquery": true
|
|
}
|
|
},
|
|
{
|
|
"files": ["test/**/*.js"],
|
|
"parserOptions": {
|
|
"ecmaVersion": 8,
|
|
"sourceType": "module"
|
|
},
|
|
"env": {
|
|
"browser": false,
|
|
"es2017": true,
|
|
"node": true,
|
|
"webextensions": false
|
|
}
|
|
}
|
|
]
|
|
}
|