-
Notifications
You must be signed in to change notification settings - Fork 20
/
eslint.config.js
111 lines (107 loc) · 3.19 KB
/
eslint.config.js
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
import tseslint from 'typescript-eslint';
import ddgConfig from '@duckduckgo/eslint-config';
import globals from 'globals';
// @ts-check
export default tseslint.config(
...ddgConfig,
...tseslint.configs.recommended,
{
ignores: [
'**/build/',
'**/docs/',
'injected/lib',
'Sources/ContentScopeScripts/dist/',
'injected/integration-test/extension/contentScope.js',
'injected/integration-test/test-pages/duckplayer/scripts/dist',
'special-pages/pages/**/public',
'special-pages/playwright-report/',
'special-pages/test-results/',
'special-pages/types/',
'special-pages/messages/',
'playwright-report',
'test-results',
'injected/src/types',
'.idea',
],
},
{
languageOptions: {
globals: {
$USER_PREFERENCES$: 'readonly',
$USER_UNPROTECTED_DOMAINS$: 'readonly',
$CONTENT_SCOPE$: 'readonly',
$BUNDLED_CONFIG$: 'readonly',
},
ecmaVersion: 'latest',
sourceType: 'script',
},
rules: {
'no-restricted-syntax': [
'error',
{
selector: "MethodDefinition[key.type='PrivateIdentifier']",
message: 'Private methods are currently unsupported in older WebKit and ESR Firefox',
},
],
'require-await': ['error'],
'promise/prefer-await-to-then': ['error'],
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'none',
caughtErrors: 'none',
ignoreRestSiblings: true,
vars: 'all',
},
],
},
},
{
ignores: ['injected/integration-test/test-pages/**', 'injected/integration-test/extension/**'],
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ['eslint.config.js', 'build-output.eslint.config.js'],
},
},
},
rules: {
'@typescript-eslint/await-thenable': 'error',
},
},
{
files: ['**/scripts/*.js', '**/*.mjs', '**/unit-test/**/*.js', '**/integration-test/**/*.spec.js'],
languageOptions: {
globals: {
...globals.node,
},
},
},
{
files: ['injected/**/*.js'],
languageOptions: {
globals: {
windowsInteropPostMessage: 'readonly',
windowsInteropAddEventListener: 'readonly',
windowsInteropRemoveEventListener: 'readonly',
},
},
},
{
files: ['**/unit-test/*.js'],
languageOptions: {
globals: {
...globals.jasmine,
},
},
},
{
ignores: ['**/scripts/*.js'],
languageOptions: {
globals: {
...globals.browser,
...globals.webextensions,
},
},
},
);