linted 19.4.3-rc.9 → 20.1.0-rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/.github/workflows/RELEASE.yml +36 -36
  2. package/.github/workflows/rc.yml +36 -36
  3. package/.markdownlint.jsonc +122 -122
  4. package/LICENSE +21 -21
  5. package/README.md +387 -387
  6. package/SECURITY.md +9 -9
  7. package/dist/imports/index.d.ts.map +1 -1
  8. package/dist/imports/plugins.d.ts.map +1 -1
  9. package/eslint.config.js +3 -3
  10. package/package.json +144 -144
  11. package/src/_strings/id.ts +8 -8
  12. package/src/_strings/index.ts +6 -6
  13. package/src/_strings/level.spec.ts +31 -31
  14. package/src/_strings/level.ts +4 -4
  15. package/src/_strings/state.ts +28 -28
  16. package/src/files/html.ts +1 -1
  17. package/src/files/index.ts +19 -19
  18. package/src/files/js.ts +4 -4
  19. package/src/files/json.ts +1 -1
  20. package/src/files/jsonc.ts +4 -4
  21. package/src/files/mocha.ts +4 -4
  22. package/src/files/mochaJs.ts +4 -4
  23. package/src/files/svelte.ts +1 -1
  24. package/src/files/ts.ts +1 -1
  25. package/src/files/yml.ts +1 -1
  26. package/src/imports/index.ts +7 -7
  27. package/src/imports/parsers.ts +13 -13
  28. package/src/imports/plugins.ts +17 -17
  29. package/src/index.spec.ts +11 -11
  30. package/src/index.ts +22 -22
  31. package/src/rules/html/enable.ts +120 -120
  32. package/src/rules/html/index.ts +3 -3
  33. package/src/rules/index.ts +19 -19
  34. package/src/rules/js/enable.ts +524 -524
  35. package/src/rules/js/index.ts +4 -4
  36. package/src/rules/js/stylistic.ts +611 -611
  37. package/src/rules/json/enable.ts +33 -33
  38. package/src/rules/json/enable_x.ts +95 -95
  39. package/src/rules/json/index.ts +4 -4
  40. package/src/rules/jsonc/index.ts +4 -4
  41. package/src/rules/jsonc/override.ts +16 -16
  42. package/src/rules/mocha/base.ts +7 -7
  43. package/src/rules/mocha/disable.ts +8 -8
  44. package/src/rules/mocha/enable.ts +53 -53
  45. package/src/rules/mocha/index.ts +7 -7
  46. package/src/rules/mochaJs/index.ts +7 -7
  47. package/src/rules/svelte/disable.ts +9 -9
  48. package/src/rules/svelte/disable_js.ts +11 -11
  49. package/src/rules/svelte/disable_ts.ts +9 -9
  50. package/src/rules/svelte/enable.ts +230 -230
  51. package/src/rules/svelte/enable_x.ts +20 -20
  52. package/src/rules/svelte/index.ts +15 -15
  53. package/src/rules/ts/disable.ts +22 -22
  54. package/src/rules/ts/disable_x.ts +32 -32
  55. package/src/rules/ts/enable.ts +550 -550
  56. package/src/rules/ts/enable_x.ts +115 -115
  57. package/src/rules/ts/index.ts +13 -13
  58. package/src/rules/yml/enable.ts +64 -64
  59. package/src/rules/yml/enable_x.ts +68 -68
  60. package/src/rules/yml/index.ts +4 -4
  61. package/tsconfig.json +163 -163
  62. package/typings/mocha.d.ts +3 -3
package/README.md CHANGED
@@ -1,387 +1,387 @@
1
- # [`linted`](https://www.npmjs.com/package/linted)
2
-
3
- [![NPM Publish (RELEASE)](https://github.com/jimmy-zhening-luo/linted/actions/workflows/RELEASE.yml/badge.svg)](https://github.com/jimmy-zhening-luo/linted/actions/workflows/RELEASE.yml)
4
-
5
- ___DO NOT USE - DOCUMENTATION IS SIGNIFICANTLY OUTDATED AS OF AUGUST 4, 2024___
6
-
7
- [ESLint](https://eslint.org) mono-plugin bundler with strict, opinionated defaults for (Stylistic) JavaScript, TypeScript, Svelte, HTML, Tailwind/CSS, JSON, JSONC, YAML, and Mocha.
8
-
9
- 1. [Languages](#languages)
10
- 2. [Features](#features)
11
- 3. [Limitation](#limitation)
12
- 4. [Install](#install)
13
- 5. [Roadmap](#roadmap)
14
- 6. [Rule Logic (Advanced)](#rule-logic-advanced)
15
-
16
- ## Languages
17
-
18
- ### Web
19
-
20
- - __[JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript):__ [`@stylistic`](https://eslint.style) + [`eslint`](https://eslint.org)
21
- - __[TypeScript](https://www.typescriptlang.org):__ [`@typescript-eslint`](https://typescript-eslint.io/) + [`@stylistic`](https://eslint.style) + [`eslint`](https://eslint.org)
22
- - __[Svelte](https://svelte.dev):__ [`eslint-plugin-svelte`](https://sveltejs.github.io/eslint-plugin-svelte/) + [`@typescript-eslint`](https://typescript-eslint.io/) + [`@stylistic`](https://eslint.style) + [`eslint`](https://eslint.org)
23
- - __[HTML](https://developer.mozilla.org/en-US/docs/Web/HTML):__ [`@html-eslint`](https://html-eslint.org/)
24
-
25
- ### Data
26
-
27
- - __[JSON](https://json.org) & [JSONC](https://code.visualstudio.com/docs/languages/json#_json-with-comments):__ [`eslint-plugin-jsonc`](https://ota-meshi.github.io/eslint-plugin-jsonc/)
28
- - __[YAML](https://redhat.com/en/topics/automation/what-is-yaml):__ [`eslint-plugin-yml`](https://ota-meshi.github.io/eslint-plugin-yml/)
29
-
30
- ### Library
31
-
32
- - __[Mocha](https://mochajs.org/):__ [`eslint-plugin-mocha`](https://github.com/lo1tuma/eslint-plugin-mocha) + [`@typescript-eslint`](https://typescript-eslint.io/) + [`@stylistic`](https://eslint.style) + [`eslint`](https://eslint.org)
33
- -
34
-
35
- <br />
36
-
37
- _See language support __[roadmap](#roadmap).___
38
-
39
- ## Features
40
-
41
- ### Zero-Dependency
42
-
43
- No need to install 17 plugins and 12 parsers: each language's latest plugin is bundled and configured.
44
-
45
- ### Zero-Config
46
-
47
- No need to remember each plugin's `parserOptions`; you won't have to do _this_ just to enable Svelte linting:
48
-
49
- ```javascript
50
- // lint TypeScript blocks in Svelte
51
- plugins: {
52
- "@stylistic": stylistic,
53
- "@typescript-eslint": ts,
54
- svelte,
55
- },
56
- languageOptions: {
57
- ecmaVersion: "latest",
58
- sourceType: "module",
59
- parser: svelteParser,
60
- parserOptions: {
61
- parser: tsParser,
62
- ecmaVersion: "latest",
63
- sourceType: "module",
64
- project: "tsconfig.json",
65
- extraFileExtensions: [".svelte"],
66
- },
67
- },
68
- processor: "svelte/svelte",
69
- ```
70
-
71
- ### Zero-Arugment API
72
-
73
- ```javascript
74
- linted();
75
- ```
76
-
77
- ### Two-Statement `eslint.config.js`
78
-
79
- ```javascript
80
- import linted from "linted";
81
-
82
- export default linted();
83
- ```
84
-
85
- ### Total Control via Optional Arguments
86
-
87
- ___WIP for v14.1, currently inaccurate___.
88
-
89
- - `includes` (scoped [`glob patterns`](https://code.visualstudio.com/docs/editor/glob-patterns))
90
- - `ignores` (global [`glob patterns`](https://code.visualstudio.com/docs/editor/glob-patterns) and other options)
91
- - `overrides` (scoped rule statements)
92
-
93
- #### `includes` _(Scoped)_
94
-
95
- ```javascript
96
- import linted from "linted";
97
-
98
- linted(
99
- {
100
- /** includes **/
101
- js: [
102
- "scripts/**/*/.{js,mjs}",
103
- "*.config.js",
104
- ], /* example: array of glob patterns to lint using JavaScript rules */
105
- ts: [
106
- "src/**/*.ts",
107
- "*.config.ts",
108
- ],
109
-
110
- // svelte: [],
111
- // html: [],
112
-
113
- /* ...json, jsonc, yml, */
114
- },
115
- )
116
- ```
117
-
118
- #### `ignores` _(Global)_
119
-
120
- ```javascript
121
- import linted from "linted";
122
-
123
- linted(
124
- { /** includes **/ },
125
- {
126
- /** ignores **/
127
- gitignore: true, /* (default) never lint any git-ignored file */
128
- ignoreArtifacts: true, /* (default) never lint "**/*/package-lock.json" */
129
- global: [], /* array of glob patterns to never lint */
130
- },
131
- )
132
- ```
133
-
134
- #### `overrides` _(Scoped)_
135
-
136
- ```javascript
137
- linted(
138
- { /** includes **/ },
139
- { /** ignores **/ },
140
- {
141
- /** overrides **/
142
- overrideJs: {}, /* js rule overrides */
143
- overrideTs: {
144
- /* Overrides apply to `ts` scope,
145
- * but NOT to `js` scope,
146
- * NOR to `svelte` scope.
147
- */
148
- "no-unused-vars": "off", /* example: ESLint base rule */
149
- "@typescript-eslint/indent": "warn", /* example: TypeScript plugin rule */
150
- }, /* js rule overrides */
151
-
152
- /* ...overrideTs, overrideSvelte, overrideHtml, overrideJson, overrideJsonc, overrideYml, */
153
- },
154
- )
155
- ```
156
-
157
- ## Limitation
158
-
159
- In __TypeScript__ projects, [`skipLibCheck`](https://www.typescriptlang.org/tsconfig/#skipLibCheck) must be `true`.
160
-
161
- ### Enable `skipLibCheck`
162
-
163
- By default, `skipLibCheck` is `false`. To set it to `true`:
164
-
165
- #### `tsconfig.json`
166
-
167
- ```jsonc
168
- {
169
- "compilerOptions": {
170
- "skipLibCheck": true,
171
- },
172
- }
173
- ```
174
-
175
- #### _...or_ `tsc` CLI option
176
-
177
- ```bash
178
- tsc --skipLibCheck
179
- ```
180
-
181
- ## Install
182
-
183
- 1. Install [`eslint`](https://www.npmjs.com/package/eslint) and [`linted`](https://www.npmjs.com/package/linted).
184
-
185
- ```bash
186
- npm i -D eslint@^8.57 linted
187
- ```
188
-
189
- 2. Create `eslint.config.js` in your project root.
190
-
191
- 3. In `eslint.config.js`:
192
- + Import function `linted`.
193
-
194
- ```javascript
195
- import linted from "linted";
196
- ```
197
-
198
- + Export `linted` with optional [arguments](#total-control-via-optional-arguments):
199
-
200
- ```javascript
201
- import linted from "linted";
202
-
203
- export default linted(
204
- // ...
205
- );
206
- ```
207
-
208
- ---
209
-
210
- ## Roadmap
211
-
212
- ### v11
213
-
214
- #### Mocha
215
-
216
- - Mocha
217
-
218
- #### Tailwind PostCSS
219
-
220
- - [Tailwind](https://github.com/francoismassart/eslint-plugin-tailwindcss)
221
-
222
- - [CSS](https://ota-meshi.github.io/eslint-plugin-css/)
223
-
224
- #### HTML Connectors
225
-
226
- - [Embedded TypeScript](https://github.com/BenoitZugmeyer/eslint-plugin-html)
227
-
228
- - Embedded CSS
229
-
230
- - Svelte Interaction TBD
231
-
232
- + .svelte-embedded HTML (on top of Svelte HTML rules)
233
-
234
- + .html files in Svelte projects (e.g. title not required)
235
-
236
- + Should Svelte-Linter handle all .html / HTML-embedded linting for Svelte projects, and HTML-Linter only handles non-Svelte projects?
237
-
238
- #### JSON (Custom Schema Validation)
239
-
240
- - [JSON Custom Schema Validation](https://github.com/ota-meshi/eslint-plugin-json-schema-validator)
241
-
242
- ---
243
-
244
- ## Rule Logic (Advanced)
245
-
246
- ### What is `scope`?
247
-
248
- Each `scope` maps to a unique `language`:
249
-
250
- - __`js`:__ `JavaScript`
251
-
252
- - __`ts`:__ `TypeScript`
253
-
254
- - __`svelte`:__ `Svelte`
255
-
256
- - __`html`:__ `HTML`
257
-
258
- - __`json`:__ `JSON`
259
-
260
- - __`jsonc`:__ `JSONC`
261
-
262
- - __`yml`:__ `YAML`
263
-
264
- ### Rules
265
-
266
- Each `scope` supports:
267
-
268
- - all base ESLint rules
269
-
270
- - all rules from its `language`'s [__plugins__](#languages)
271
-
272
- #### Default Rules
273
-
274
- - Each `language` has a set of default rules.
275
-
276
- #### Language-Aggregate `scope`
277
-
278
- A `language` can be an extension of or depend on another `language`.
279
-
280
- For example:
281
-
282
- - TypeScript extends JavaScript
283
-
284
- - Svelte depends on TypeScript (which extends JavaScript)
285
-
286
- For such a `language`, its `scope`'s default rules are aggregated with the default rules of extended or consumed `language`s by `scope` precedence:
287
-
288
- - __`js`:__ `js`
289
-
290
- - __`ts`:__ `js` < `ts`
291
-
292
- - __`svelte`:__ `js` < `ts` < `svelte`
293
-
294
- - __`html`:__ `html`
295
-
296
- - __`json`:__ `json`
297
-
298
- - __`jsonc`:__ `json` < `jsonc`
299
-
300
- - __`yml`:__ `yml`
301
-
302
- ### Files
303
-
304
- #### Global Ignores
305
-
306
- ##### `.gitignore`
307
-
308
- By default, `linted` ignores all files in `.gitignore`. This behavior can be disabled.
309
-
310
- ##### `package-lock.json`
311
-
312
- `**/*.package-lock.json` is always skipped. _This cannot be overriden._
313
-
314
- ##### `ignores`
315
-
316
- Additional glob patterns supplied if matched by a file will skip linting that file, even if a scope pattern matches the file.
317
-
318
- #### Scoped Includes
319
-
320
- Files specified in `scope` are appended to the following default files:
321
-
322
- ```javascript
323
- {
324
- js: [
325
- "{src,static}/**/*.{js,mjs,cjs}",
326
- "*.{js,mjs,cjs}",
327
- ],
328
- ts: [
329
- "{src,static}/**/*.{ts,mts,cts}",
330
- "*.{ts,mts,cts}",
331
- ],
332
- svelte: ["{src,static}/**/*.svelte"],
333
- html: [
334
- "{src,static}/**/*.html",
335
- "*.html",
336
- ],
337
- json: [
338
- "{src,static}/**/*.json",
339
- "*.json",
340
- ],
341
- jsonc: [
342
- "tsconfig.json",
343
- "{src,static}/**/*.jsonc",
344
- "*.jsonc",
345
- ],
346
- yml: [
347
- ".github/workflows/*.{yml,yaml}",
348
- "{src,static}/**/*.{yml,yaml}",
349
- "*.{yml,yaml}",
350
- ],
351
- },
352
- ```
353
-
354
- #### Scope Conflict
355
-
356
- - If a given file matches more than one `scope` glob, then the set of all matching `scope`s' rules are applied to the file.
357
-
358
- - If any rule is specified in more than one `scope` matching a given file, the specifies a rule, then the highest-precedence `scope`'s rule specification wins.
359
-
360
- ##### Scope Precedence (low to high)
361
-
362
- ```bash
363
- js
364
- ts
365
- svelte
366
- html
367
- json
368
- jsonc
369
- yml
370
- ignores (global)
371
- ```
372
-
373
- ### Override
374
-
375
- Overrides are per-__scope.__
376
-
377
- #### Example
378
-
379
- `overrideTs` rules apply to files which:
380
-
381
- - ✅ ONLY match scope `ts`.
382
-
383
- - ✅ match scope `ts` and any number of lower precedence scopes (e.g. `js`).
384
-
385
- `overrideTs` rules do __NOT__ apply to files which:
386
-
387
- - ❌ match scope `ts` and at least one higher precedence scope (e.g. `svelte`), even if the higher precedence scope includes `ts` language default rules (e.g. `svelte` includes `ts` default rules, but NOT `overrideTs` rules).
1
+ # [`linted`](https://www.npmjs.com/package/linted)
2
+
3
+ [![NPM Publish (RELEASE)](https://github.com/jimmy-zhening-luo/linted/actions/workflows/RELEASE.yml/badge.svg)](https://github.com/jimmy-zhening-luo/linted/actions/workflows/RELEASE.yml)
4
+
5
+ ___DO NOT USE - DOCUMENTATION IS SIGNIFICANTLY OUTDATED AS OF AUGUST 4, 2024___
6
+
7
+ [ESLint](https://eslint.org) mono-plugin bundler with strict, opinionated defaults for (Stylistic) JavaScript, TypeScript, Svelte, HTML, Tailwind/CSS, JSON, JSONC, YAML, and Mocha.
8
+
9
+ 1. [Languages](#languages)
10
+ 2. [Features](#features)
11
+ 3. [Limitation](#limitation)
12
+ 4. [Install](#install)
13
+ 5. [Roadmap](#roadmap)
14
+ 6. [Rule Logic (Advanced)](#rule-logic-advanced)
15
+
16
+ ## Languages
17
+
18
+ ### Web
19
+
20
+ - __[JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript):__ [`@stylistic`](https://eslint.style) + [`eslint`](https://eslint.org)
21
+ - __[TypeScript](https://www.typescriptlang.org):__ [`@typescript-eslint`](https://typescript-eslint.io/) + [`@stylistic`](https://eslint.style) + [`eslint`](https://eslint.org)
22
+ - __[Svelte](https://svelte.dev):__ [`eslint-plugin-svelte`](https://sveltejs.github.io/eslint-plugin-svelte/) + [`@typescript-eslint`](https://typescript-eslint.io/) + [`@stylistic`](https://eslint.style) + [`eslint`](https://eslint.org)
23
+ - __[HTML](https://developer.mozilla.org/en-US/docs/Web/HTML):__ [`@html-eslint`](https://html-eslint.org/)
24
+
25
+ ### Data
26
+
27
+ - __[JSON](https://json.org) & [JSONC](https://code.visualstudio.com/docs/languages/json#_json-with-comments):__ [`eslint-plugin-jsonc`](https://ota-meshi.github.io/eslint-plugin-jsonc/)
28
+ - __[YAML](https://redhat.com/en/topics/automation/what-is-yaml):__ [`eslint-plugin-yml`](https://ota-meshi.github.io/eslint-plugin-yml/)
29
+
30
+ ### Library
31
+
32
+ - __[Mocha](https://mochajs.org/):__ [`eslint-plugin-mocha`](https://github.com/lo1tuma/eslint-plugin-mocha) + [`@typescript-eslint`](https://typescript-eslint.io/) + [`@stylistic`](https://eslint.style) + [`eslint`](https://eslint.org)
33
+ -
34
+
35
+ <br />
36
+
37
+ _See language support __[roadmap](#roadmap).___
38
+
39
+ ## Features
40
+
41
+ ### Zero-Dependency
42
+
43
+ No need to install 17 plugins and 12 parsers: each language's latest plugin is bundled and configured.
44
+
45
+ ### Zero-Config
46
+
47
+ No need to remember each plugin's `parserOptions`; you won't have to do _this_ just to enable Svelte linting:
48
+
49
+ ```javascript
50
+ // lint TypeScript blocks in Svelte
51
+ plugins: {
52
+ "@stylistic": stylistic,
53
+ "@typescript-eslint": ts,
54
+ svelte,
55
+ },
56
+ languageOptions: {
57
+ ecmaVersion: "latest",
58
+ sourceType: "module",
59
+ parser: svelteParser,
60
+ parserOptions: {
61
+ parser: tsParser,
62
+ ecmaVersion: "latest",
63
+ sourceType: "module",
64
+ project: "tsconfig.json",
65
+ extraFileExtensions: [".svelte"],
66
+ },
67
+ },
68
+ processor: "svelte/svelte",
69
+ ```
70
+
71
+ ### Zero-Arugment API
72
+
73
+ ```javascript
74
+ linted();
75
+ ```
76
+
77
+ ### Two-Statement `eslint.config.js`
78
+
79
+ ```javascript
80
+ import linted from "linted";
81
+
82
+ export default linted();
83
+ ```
84
+
85
+ ### Total Control via Optional Arguments
86
+
87
+ ___WIP for v14.1, currently inaccurate___.
88
+
89
+ - `includes` (scoped [`glob patterns`](https://code.visualstudio.com/docs/editor/glob-patterns))
90
+ - `ignores` (global [`glob patterns`](https://code.visualstudio.com/docs/editor/glob-patterns) and other options)
91
+ - `overrides` (scoped rule statements)
92
+
93
+ #### `includes` _(Scoped)_
94
+
95
+ ```javascript
96
+ import linted from "linted";
97
+
98
+ linted(
99
+ {
100
+ /** includes **/
101
+ js: [
102
+ "scripts/**/*/.{js,mjs}",
103
+ "*.config.js",
104
+ ], /* example: array of glob patterns to lint using JavaScript rules */
105
+ ts: [
106
+ "src/**/*.ts",
107
+ "*.config.ts",
108
+ ],
109
+
110
+ // svelte: [],
111
+ // html: [],
112
+
113
+ /* ...json, jsonc, yml, */
114
+ },
115
+ )
116
+ ```
117
+
118
+ #### `ignores` _(Global)_
119
+
120
+ ```javascript
121
+ import linted from "linted";
122
+
123
+ linted(
124
+ { /** includes **/ },
125
+ {
126
+ /** ignores **/
127
+ gitignore: true, /* (default) never lint any git-ignored file */
128
+ ignoreArtifacts: true, /* (default) never lint "**/*/package-lock.json" */
129
+ global: [], /* array of glob patterns to never lint */
130
+ },
131
+ )
132
+ ```
133
+
134
+ #### `overrides` _(Scoped)_
135
+
136
+ ```javascript
137
+ linted(
138
+ { /** includes **/ },
139
+ { /** ignores **/ },
140
+ {
141
+ /** overrides **/
142
+ overrideJs: {}, /* js rule overrides */
143
+ overrideTs: {
144
+ /* Overrides apply to `ts` scope,
145
+ * but NOT to `js` scope,
146
+ * NOR to `svelte` scope.
147
+ */
148
+ "no-unused-vars": "off", /* example: ESLint base rule */
149
+ "@typescript-eslint/indent": "warn", /* example: TypeScript plugin rule */
150
+ }, /* js rule overrides */
151
+
152
+ /* ...overrideTs, overrideSvelte, overrideHtml, overrideJson, overrideJsonc, overrideYml, */
153
+ },
154
+ )
155
+ ```
156
+
157
+ ## Limitation
158
+
159
+ In __TypeScript__ projects, [`skipLibCheck`](https://www.typescriptlang.org/tsconfig/#skipLibCheck) must be `true`.
160
+
161
+ ### Enable `skipLibCheck`
162
+
163
+ By default, `skipLibCheck` is `false`. To set it to `true`:
164
+
165
+ #### `tsconfig.json`
166
+
167
+ ```jsonc
168
+ {
169
+ "compilerOptions": {
170
+ "skipLibCheck": true,
171
+ },
172
+ }
173
+ ```
174
+
175
+ #### _...or_ `tsc` CLI option
176
+
177
+ ```bash
178
+ tsc --skipLibCheck
179
+ ```
180
+
181
+ ## Install
182
+
183
+ 1. Install [`eslint`](https://www.npmjs.com/package/eslint) and [`linted`](https://www.npmjs.com/package/linted).
184
+
185
+ ```bash
186
+ npm i -D eslint@^8.57 linted
187
+ ```
188
+
189
+ 2. Create `eslint.config.js` in your project root.
190
+
191
+ 3. In `eslint.config.js`:
192
+ + Import function `linted`.
193
+
194
+ ```javascript
195
+ import linted from "linted";
196
+ ```
197
+
198
+ + Export `linted` with optional [arguments](#total-control-via-optional-arguments):
199
+
200
+ ```javascript
201
+ import linted from "linted";
202
+
203
+ export default linted(
204
+ // ...
205
+ );
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Roadmap
211
+
212
+ ### v11
213
+
214
+ #### Mocha
215
+
216
+ - Mocha
217
+
218
+ #### Tailwind PostCSS
219
+
220
+ - [Tailwind](https://github.com/francoismassart/eslint-plugin-tailwindcss)
221
+
222
+ - [CSS](https://ota-meshi.github.io/eslint-plugin-css/)
223
+
224
+ #### HTML Connectors
225
+
226
+ - [Embedded TypeScript](https://github.com/BenoitZugmeyer/eslint-plugin-html)
227
+
228
+ - Embedded CSS
229
+
230
+ - Svelte Interaction TBD
231
+
232
+ + .svelte-embedded HTML (on top of Svelte HTML rules)
233
+
234
+ + .html files in Svelte projects (e.g. title not required)
235
+
236
+ + Should Svelte-Linter handle all .html / HTML-embedded linting for Svelte projects, and HTML-Linter only handles non-Svelte projects?
237
+
238
+ #### JSON (Custom Schema Validation)
239
+
240
+ - [JSON Custom Schema Validation](https://github.com/ota-meshi/eslint-plugin-json-schema-validator)
241
+
242
+ ---
243
+
244
+ ## Rule Logic (Advanced)
245
+
246
+ ### What is `scope`?
247
+
248
+ Each `scope` maps to a unique `language`:
249
+
250
+ - __`js`:__ `JavaScript`
251
+
252
+ - __`ts`:__ `TypeScript`
253
+
254
+ - __`svelte`:__ `Svelte`
255
+
256
+ - __`html`:__ `HTML`
257
+
258
+ - __`json`:__ `JSON`
259
+
260
+ - __`jsonc`:__ `JSONC`
261
+
262
+ - __`yml`:__ `YAML`
263
+
264
+ ### Rules
265
+
266
+ Each `scope` supports:
267
+
268
+ - all base ESLint rules
269
+
270
+ - all rules from its `language`'s [__plugins__](#languages)
271
+
272
+ #### Default Rules
273
+
274
+ - Each `language` has a set of default rules.
275
+
276
+ #### Language-Aggregate `scope`
277
+
278
+ A `language` can be an extension of or depend on another `language`.
279
+
280
+ For example:
281
+
282
+ - TypeScript extends JavaScript
283
+
284
+ - Svelte depends on TypeScript (which extends JavaScript)
285
+
286
+ For such a `language`, its `scope`'s default rules are aggregated with the default rules of extended or consumed `language`s by `scope` precedence:
287
+
288
+ - __`js`:__ `js`
289
+
290
+ - __`ts`:__ `js` < `ts`
291
+
292
+ - __`svelte`:__ `js` < `ts` < `svelte`
293
+
294
+ - __`html`:__ `html`
295
+
296
+ - __`json`:__ `json`
297
+
298
+ - __`jsonc`:__ `json` < `jsonc`
299
+
300
+ - __`yml`:__ `yml`
301
+
302
+ ### Files
303
+
304
+ #### Global Ignores
305
+
306
+ ##### `.gitignore`
307
+
308
+ By default, `linted` ignores all files in `.gitignore`. This behavior can be disabled.
309
+
310
+ ##### `package-lock.json`
311
+
312
+ `**/*.package-lock.json` is always skipped. _This cannot be overriden._
313
+
314
+ ##### `ignores`
315
+
316
+ Additional glob patterns supplied if matched by a file will skip linting that file, even if a scope pattern matches the file.
317
+
318
+ #### Scoped Includes
319
+
320
+ Files specified in `scope` are appended to the following default files:
321
+
322
+ ```javascript
323
+ {
324
+ js: [
325
+ "{src,static}/**/*.{js,mjs,cjs}",
326
+ "*.{js,mjs,cjs}",
327
+ ],
328
+ ts: [
329
+ "{src,static}/**/*.{ts,mts,cts}",
330
+ "*.{ts,mts,cts}",
331
+ ],
332
+ svelte: ["{src,static}/**/*.svelte"],
333
+ html: [
334
+ "{src,static}/**/*.html",
335
+ "*.html",
336
+ ],
337
+ json: [
338
+ "{src,static}/**/*.json",
339
+ "*.json",
340
+ ],
341
+ jsonc: [
342
+ "tsconfig.json",
343
+ "{src,static}/**/*.jsonc",
344
+ "*.jsonc",
345
+ ],
346
+ yml: [
347
+ ".github/workflows/*.{yml,yaml}",
348
+ "{src,static}/**/*.{yml,yaml}",
349
+ "*.{yml,yaml}",
350
+ ],
351
+ },
352
+ ```
353
+
354
+ #### Scope Conflict
355
+
356
+ - If a given file matches more than one `scope` glob, then the set of all matching `scope`s' rules are applied to the file.
357
+
358
+ - If any rule is specified in more than one `scope` matching a given file, the specifies a rule, then the highest-precedence `scope`'s rule specification wins.
359
+
360
+ ##### Scope Precedence (low to high)
361
+
362
+ ```bash
363
+ js
364
+ ts
365
+ svelte
366
+ html
367
+ json
368
+ jsonc
369
+ yml
370
+ ignores (global)
371
+ ```
372
+
373
+ ### Override
374
+
375
+ Overrides are per-__scope.__
376
+
377
+ #### Example
378
+
379
+ `overrideTs` rules apply to files which:
380
+
381
+ - ✅ ONLY match scope `ts`.
382
+
383
+ - ✅ match scope `ts` and any number of lower precedence scopes (e.g. `js`).
384
+
385
+ `overrideTs` rules do __NOT__ apply to files which:
386
+
387
+ - ❌ match scope `ts` and at least one higher precedence scope (e.g. `svelte`), even if the higher precedence scope includes `ts` language default rules (e.g. `svelte` includes `ts` default rules, but NOT `overrideTs` rules).