|
1 | 1 | module.exports = {
|
2 |
| - root: true, |
3 |
| - extends: [ |
4 |
| - 'eslint:recommended', |
5 |
| - 'plugin:node/recommended', |
6 |
| - 'plugin:@typescript-eslint/eslint-recommended', |
7 |
| - 'prettier' |
8 |
| - ], |
9 |
| - globals: { |
10 |
| - Atomics: 'readonly', |
11 |
| - SharedArrayBuffer: 'readonly' |
12 |
| - }, |
13 |
| - plugins: ['@typescript-eslint', 'svelte3', 'html', 'markdown'], |
14 |
| - settings: { |
15 |
| - 'svelte3/typescript': require('typescript'), |
16 |
| - 'svelte3/ignore-styles': (attrs) => |
17 |
| - (attrs.type && attrs.type !== 'text/css') || |
18 |
| - (attrs.lang && attrs.lang !== 'css') |
19 |
| - }, |
20 |
| - parser: '@typescript-eslint/parser', |
21 |
| - parserOptions: { |
22 |
| - sourceType: 'module', |
23 |
| - ecmaVersion: 2020 |
24 |
| - }, |
25 |
| - rules: { |
26 |
| - 'no-debugger': ['error'], |
27 |
| - 'node/no-missing-import': [ |
28 |
| - 'error', |
29 |
| - { |
30 |
| - allowModules: ['types', 'estree', 'testUtils'], |
31 |
| - tryExtensions: ['.ts', '.js', '.jsx', '.tsx'] |
32 |
| - } |
33 |
| - ], |
34 |
| - 'node/no-missing-require': [ |
35 |
| - 'error', |
36 |
| - { |
37 |
| - // for try-catching yarn pnp |
38 |
| - allowModules: ['pnpapi'], |
39 |
| - tryExtensions: ['.ts', '.js', '.jsx', '.tsx'] |
40 |
| - } |
41 |
| - ], |
| 2 | + root: true, |
| 3 | + extends: [ |
| 4 | + 'eslint:recommended', |
| 5 | + 'plugin:node/recommended', |
| 6 | + 'plugin:@typescript-eslint/eslint-recommended', |
| 7 | + 'prettier' |
| 8 | + ], |
| 9 | + globals: { |
| 10 | + Atomics: 'readonly', |
| 11 | + SharedArrayBuffer: 'readonly' |
| 12 | + }, |
| 13 | + plugins: ['@typescript-eslint', 'svelte3', 'html', 'markdown'], |
| 14 | + settings: { |
| 15 | + 'svelte3/typescript': require('typescript'), |
| 16 | + 'svelte3/ignore-styles': (attrs) => |
| 17 | + (attrs.type && attrs.type !== 'text/css') || (attrs.lang && attrs.lang !== 'css') |
| 18 | + }, |
| 19 | + parser: '@typescript-eslint/parser', |
| 20 | + parserOptions: { |
| 21 | + sourceType: 'module', |
| 22 | + ecmaVersion: 2020 |
| 23 | + }, |
| 24 | + rules: { |
| 25 | + 'no-debugger': ['error'], |
| 26 | + 'node/no-missing-import': [ |
| 27 | + 'error', |
| 28 | + { |
| 29 | + allowModules: ['types', 'estree', 'testUtils'], |
| 30 | + tryExtensions: ['.ts', '.js', '.jsx', '.tsx'] |
| 31 | + } |
| 32 | + ], |
| 33 | + 'node/no-missing-require': [ |
| 34 | + 'error', |
| 35 | + { |
| 36 | + // for try-catching yarn pnp |
| 37 | + allowModules: ['pnpapi'], |
| 38 | + tryExtensions: ['.ts', '.js', '.jsx', '.tsx'] |
| 39 | + } |
| 40 | + ], |
42 | 41 |
|
43 |
| - 'node/no-extraneous-import': [ |
44 |
| - 'error', |
45 |
| - { |
46 |
| - allowModules: ['vite'] |
47 |
| - } |
48 |
| - ], |
49 |
| - 'node/no-extraneous-require': [ |
50 |
| - 'error', |
51 |
| - { |
52 |
| - allowModules: ['vite'] |
53 |
| - } |
54 |
| - ], |
55 |
| - 'node/no-deprecated-api': 'off', |
56 |
| - 'node/no-unpublished-import': 'off', |
57 |
| - 'node/no-unpublished-require': 'off', |
58 |
| - 'node/no-unsupported-features/es-syntax': 'off', |
59 |
| - 'no-process-exit': 'off' |
60 |
| - }, |
61 |
| - overrides: [ |
62 |
| - { |
63 |
| - files: ['packages/playground/**'], |
64 |
| - rules: { |
65 |
| - 'node/no-extraneous-import': 'off', |
66 |
| - 'node/no-extraneous-require': 'off', |
67 |
| - 'no-unused-vars': 'off' |
68 |
| - }, |
69 |
| - env: { |
70 |
| - browser: true |
71 |
| - } |
72 |
| - }, |
73 |
| - { |
74 |
| - files: ['packages/templates/**'], |
75 |
| - rules: { |
76 |
| - 'node/no-extraneous-import': [ |
77 |
| - 'error', |
78 |
| - { |
79 |
| - allowModules: ['@svitejs/vite-plugin-svelte', 'svite'] |
80 |
| - } |
81 |
| - ], |
82 |
| - 'node/no-extraneous-require': [ |
83 |
| - 'error', |
84 |
| - { |
85 |
| - allowModules: ['@svitejs/vite-plugin-svelte', 'svite'] |
86 |
| - } |
87 |
| - ] |
88 |
| - }, |
89 |
| - env: { |
90 |
| - browser: true |
91 |
| - } |
92 |
| - }, |
93 |
| - { |
94 |
| - files: [ |
95 |
| - 'packages/templates/**/vite.config.js', |
96 |
| - 'packages/playground/**/vite.config.js' |
97 |
| - ], |
98 |
| - rules: { |
99 |
| - 'no-unused-vars': 'off', |
100 |
| - 'node/no-missing-require': 'off' |
101 |
| - } |
102 |
| - }, |
103 |
| - { |
104 |
| - files: ['**/*.svelte'], |
105 |
| - env: { |
106 |
| - es6: true, |
107 |
| - browser: true, |
108 |
| - node: false |
109 |
| - }, |
110 |
| - processor: 'svelte3/svelte3', |
111 |
| - rules: { |
112 |
| - 'import/first': 'off', |
113 |
| - 'import/no-duplicates': 'off', |
114 |
| - 'import/no-mutable-exports': 'off', |
115 |
| - 'import/no-unresolved': 'off' |
116 |
| - } |
117 |
| - }, |
118 |
| - { |
119 |
| - files: ['**/*.svx', '**/*.md'], |
120 |
| - processor: 'markdown/markdown', |
121 |
| - rules: { |
122 |
| - 'no-undef': 'off', |
123 |
| - 'no-unused-vars': 'off', |
124 |
| - 'no-console': 'off', |
125 |
| - 'padded-blocks': 'off', |
126 |
| - 'node/no-missing-import': 'off', |
127 |
| - 'node/no-extraneous-require': 'off', |
128 |
| - 'import/no-unresolved': 'off', |
129 |
| - 'node/no-missing-require': 'off' |
130 |
| - } |
131 |
| - }, |
132 |
| - { |
133 |
| - files: ['**/*.svx/*.**', '**/*.md/*.**'], |
134 |
| - rules: { |
135 |
| - 'no-undef': 'off', |
136 |
| - 'no-unused-vars': 'off', |
137 |
| - 'no-console': 'off', |
138 |
| - 'padded-blocks': 'off', |
139 |
| - 'node/no-missing-import': 'off', |
140 |
| - 'node/no-extraneous-require': 'off', |
141 |
| - 'import/no-unresolved': 'off', |
142 |
| - 'node/no-missing-require': 'off' |
143 |
| - } |
144 |
| - }, |
145 |
| - { |
146 |
| - files: ['**/__tests__/**/*.spec.ts'], |
147 |
| - env: { |
148 |
| - jest: true, |
149 |
| - node: true, |
150 |
| - browser: true |
151 |
| - }, |
152 |
| - // Can't extend in overrides: https://github.com/eslint/eslint/issues/8813 |
153 |
| - // "extends": ["plugin:jest/recommended"] |
154 |
| - plugins: ['jest'], |
155 |
| - rules: { |
156 |
| - 'jest/no-disabled-tests': 'warn', |
157 |
| - 'jest/no-focused-tests': 'error', |
158 |
| - 'jest/no-identical-title': 'error', |
159 |
| - 'jest/prefer-to-have-length': 'warn', |
160 |
| - 'jest/valid-expect': 'error' |
161 |
| - } |
162 |
| - }, |
163 |
| - { |
164 |
| - files: ['scripts/**'], |
165 |
| - env: { |
166 |
| - jest: true, |
167 |
| - node: true, |
168 |
| - browser: false |
169 |
| - } |
170 |
| - } |
171 |
| - ] |
172 |
| -} |
| 42 | + 'node/no-extraneous-import': [ |
| 43 | + 'error', |
| 44 | + { |
| 45 | + allowModules: ['vite'] |
| 46 | + } |
| 47 | + ], |
| 48 | + 'node/no-extraneous-require': [ |
| 49 | + 'error', |
| 50 | + { |
| 51 | + allowModules: ['vite'] |
| 52 | + } |
| 53 | + ], |
| 54 | + 'node/no-deprecated-api': 'off', |
| 55 | + 'node/no-unpublished-import': 'off', |
| 56 | + 'node/no-unpublished-require': 'off', |
| 57 | + 'node/no-unsupported-features/es-syntax': 'off', |
| 58 | + 'no-process-exit': 'off' |
| 59 | + }, |
| 60 | + overrides: [ |
| 61 | + { |
| 62 | + files: ['packages/playground/**'], |
| 63 | + rules: { |
| 64 | + 'node/no-extraneous-import': 'off', |
| 65 | + 'node/no-extraneous-require': 'off', |
| 66 | + 'no-unused-vars': 'off' |
| 67 | + }, |
| 68 | + env: { |
| 69 | + browser: true |
| 70 | + } |
| 71 | + }, |
| 72 | + { |
| 73 | + files: ['packages/templates/**/vite.config.js', 'packages/playground/**/vite.config.js'], |
| 74 | + rules: { |
| 75 | + 'no-unused-vars': 'off', |
| 76 | + 'node/no-missing-require': 'off' |
| 77 | + } |
| 78 | + }, |
| 79 | + { |
| 80 | + files: ['**/*.svelte'], |
| 81 | + env: { |
| 82 | + es6: true, |
| 83 | + browser: true, |
| 84 | + node: false |
| 85 | + }, |
| 86 | + processor: 'svelte3/svelte3', |
| 87 | + rules: { |
| 88 | + 'import/first': 'off', |
| 89 | + 'import/no-duplicates': 'off', |
| 90 | + 'import/no-mutable-exports': 'off', |
| 91 | + 'import/no-unresolved': 'off' |
| 92 | + } |
| 93 | + }, |
| 94 | + { |
| 95 | + files: ['**/*.svx', '**/*.md'], |
| 96 | + processor: 'markdown/markdown', |
| 97 | + rules: { |
| 98 | + 'no-undef': 'off', |
| 99 | + 'no-unused-vars': 'off', |
| 100 | + 'no-console': 'off', |
| 101 | + 'padded-blocks': 'off', |
| 102 | + 'node/no-missing-import': 'off', |
| 103 | + 'node/no-extraneous-require': 'off', |
| 104 | + 'import/no-unresolved': 'off', |
| 105 | + 'node/no-missing-require': 'off' |
| 106 | + } |
| 107 | + }, |
| 108 | + { |
| 109 | + files: ['**/*.svx/*.**', '**/*.md/*.**'], |
| 110 | + rules: { |
| 111 | + 'no-undef': 'off', |
| 112 | + 'no-unused-vars': 'off', |
| 113 | + 'no-console': 'off', |
| 114 | + 'padded-blocks': 'off', |
| 115 | + 'node/no-missing-import': 'off', |
| 116 | + 'node/no-extraneous-require': 'off', |
| 117 | + 'import/no-unresolved': 'off', |
| 118 | + 'node/no-missing-require': 'off' |
| 119 | + } |
| 120 | + }, |
| 121 | + { |
| 122 | + files: ['**/__tests__/**/*.spec.ts'], |
| 123 | + env: { |
| 124 | + jest: true, |
| 125 | + node: true, |
| 126 | + browser: true |
| 127 | + }, |
| 128 | + // Can't extend in overrides: https://github.com/eslint/eslint/issues/8813 |
| 129 | + // "extends": ["plugin:jest/recommended"] |
| 130 | + plugins: ['jest'], |
| 131 | + rules: { |
| 132 | + 'jest/no-disabled-tests': 'warn', |
| 133 | + 'jest/no-focused-tests': 'error', |
| 134 | + 'jest/no-identical-title': 'error', |
| 135 | + 'jest/prefer-to-have-length': 'warn', |
| 136 | + 'jest/valid-expect': 'error' |
| 137 | + } |
| 138 | + }, |
| 139 | + { |
| 140 | + files: ['scripts/**'], |
| 141 | + env: { |
| 142 | + jest: true, |
| 143 | + node: true, |
| 144 | + browser: false |
| 145 | + } |
| 146 | + } |
| 147 | + ] |
| 148 | +}; |
0 commit comments