linted 16.3.2 → 16.3.3-rc.1

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