forked from ScratchAddons/ScratchAddons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
114 lines (111 loc) · 3.25 KB
/
.eslintrc.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{
"root": true,
"ignorePatterns": ["node_modules/*", "_locales/*", ".github/workflows/*", "addons-l10n/*", "libraries/thirdparty/*"],
"parserOptions": {
"sourceType": "module"
},
"env": {
"es2020": true,
"browser": true
},
"globals": {
// Scratch Addons-defined
"scratchAddons": "writable",
"__scratchAddonsTraps": "writable",
"__scratchAddonsRedux": "writable",
"_realConsole": "writable",
"__scratchAddonsTextColor": "writable",
// Third Party-defined
"Vue": "readonly",
"SparkMD5": "readonly",
"scratchblocks": "readonly",
"tinycolor": "readonly",
"Chart": "readonly",
"Comlink": "readonly",
"idb": "readonly",
// Scratch-defined
"Scratch": "readonly",
"Blockly": "readonly",
// Non-standard API
"Clipboard": "readonly",
"ClipboardItem": "readonly"
},
"extends": "eslint:recommended",
"rules": {
"no-prototype-builtins": 1,
"no-template-curly-in-string": 2,
"array-callback-return": 2,
"default-case-last": 2,
"eqeqeq": 2,
"guard-for-in": 2,
"no-empty": [2, { "allowEmptyCatch": true }],
"no-caller": 2,
"no-implied-eval": 2,
"no-new-wrappers": 2,
"no-proto": 2,
"no-loss-of-precision": 2,
"no-nonoctal-decimal-escape": 2,
"no-unsafe-optional-chaining": 2,
"no-useless-backreference": 2,
"no-unused-vars": 0,
"no-useless-escape": 0,
"no-inner-declarations": 0,
"no-constant-condition": [2, { "checkLoops": false }],
"no-restricted-syntax": [
2,
{
"selector": "MemberExpression[property.type=Identifier][property.name=path]:matches([object.name=e],[object.name=ev],[object.name=event])",
"message": "Event.path is incompatible with Firefox, use Event.composedPath()"
}
],
"no-constant-binary-expression": 2
},
"overrides": [
{
"files": [
"addon-api/background/*.js",
"addon-api/popup/*.js",
"addons/*/background.js",
"background/**/*.js",
"content-scripts/*.js",
"libraries/common/*.js",
"libraries/thirdparty/*.js",
"popups/**/*.js",
"webpages/**/*.js"
],
"env": {
"webextensions": true
},
"rules": {
"no-eval": 2
}
},
{
"files": ["content-scripts/*.js"],
"rules": {
"no-restricted-syntax": [
"error",
{
"selector": "ImportExpression",
"message": "import() in content script is unsupported in Firefox, declare directly in manifest.json"
},
{
"selector": "MemberExpression[property.type=Identifier][property.name=path]:matches([object.name=e],[object.name=ev],[object.name=event])",
"message": "Event.path does not exist in Firefox, use Event.composedPath()"
}
]
}
},
{
// The addon uses static fields, only specified in ES13 (2022-)
// yet supported by older browsers.
// We use ES11 (2020) as everything in that version can be used by
// the minimum supported browser (Chrome 80, Firefox 86).
// To properly lint the file, add exception to the parser version.
"files": ["addons/middle-click-popup/*.js"],
"parserOptions": {
"ecmaVersion": 13
}
}
]
}