@eslinted/core 13.3.0-rc.2 → 13.3.0-rc.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/factory/index.d.ts +230 -2
- package/dist/factory/index.d.ts.map +1 -1
- package/dist/factory/index.js +65 -2
- package/dist/factory/index.js.map +1 -1
- package/dist/factory/{settings/scopes → scopes}/html.d.ts +1 -1
- package/dist/factory/scopes/html.d.ts.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/html.js +1 -1
- package/dist/factory/scopes/html.js.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/js.d.ts +1 -1
- package/dist/factory/scopes/js.d.ts.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/js.js +1 -1
- package/dist/factory/scopes/js.js.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/json.d.ts +1 -1
- package/dist/factory/scopes/json.d.ts.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/json.js +1 -1
- package/dist/factory/scopes/json.js.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/jsonc.d.ts +1 -1
- package/dist/factory/scopes/jsonc.d.ts.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/jsonc.js +1 -1
- package/dist/factory/scopes/jsonc.js.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/mocha.d.ts +1 -1
- package/dist/factory/scopes/mocha.d.ts.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/mocha.js +1 -1
- package/dist/factory/scopes/mocha.js.map +1 -0
- package/dist/factory/{settings/setting.d.ts → scopes/setting/index.d.ts} +2 -2
- package/dist/factory/{settings/setting.d.ts.map → scopes/setting/index.d.ts.map} +1 -1
- package/dist/factory/{settings/setting.js → scopes/setting/index.js} +1 -1
- package/dist/factory/scopes/setting/index.js.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/svelte.d.ts +1 -1
- package/dist/factory/scopes/svelte.d.ts.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/svelte.js +1 -1
- package/dist/factory/scopes/svelte.js.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/ts.d.ts +1 -1
- package/dist/factory/scopes/ts.d.ts.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/ts.js +1 -1
- package/dist/factory/scopes/ts.js.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/yml.d.ts +1 -1
- package/dist/factory/scopes/yml.d.ts.map +1 -0
- package/dist/factory/{settings/scopes → scopes}/yml.js +1 -1
- package/dist/factory/scopes/yml.js.map +1 -0
- package/dist/factory/{settings/index.d.ts → settings.d.ts} +1 -2
- package/dist/factory/settings.d.ts.map +1 -0
- package/dist/factory/{settings/index.js → settings.js} +1 -1
- package/dist/factory/settings.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/factory/index.ts +104 -2
- package/src/factory/{settings/scopes → scopes}/html.ts +1 -1
- package/src/factory/{settings/scopes → scopes}/js.ts +1 -1
- package/src/factory/{settings/scopes → scopes}/json.ts +1 -1
- package/src/factory/{settings/scopes → scopes}/jsonc.ts +1 -1
- package/src/factory/{settings/scopes → scopes}/mocha.ts +1 -1
- package/src/factory/{settings/setting.ts → scopes/setting/index.ts} +1 -1
- package/src/factory/{settings/scopes → scopes}/svelte.ts +1 -1
- package/src/factory/{settings/scopes → scopes}/ts.ts +1 -1
- package/src/factory/{settings/scopes → scopes}/yml.ts +1 -1
- package/src/factory/{settings/index.ts → settings.ts} +0 -1
- package/src/index.ts +3 -13
- package/dist/factory/factory.d.ts +0 -231
- package/dist/factory/factory.d.ts.map +0 -1
- package/dist/factory/factory.js +0 -65
- package/dist/factory/factory.js.map +0 -1
- package/dist/factory/settings/index.d.ts.map +0 -1
- package/dist/factory/settings/index.js.map +0 -1
- package/dist/factory/settings/scopes/html.d.ts.map +0 -1
- package/dist/factory/settings/scopes/html.js.map +0 -1
- package/dist/factory/settings/scopes/js.d.ts.map +0 -1
- package/dist/factory/settings/scopes/js.js.map +0 -1
- package/dist/factory/settings/scopes/json.d.ts.map +0 -1
- package/dist/factory/settings/scopes/json.js.map +0 -1
- package/dist/factory/settings/scopes/jsonc.d.ts.map +0 -1
- package/dist/factory/settings/scopes/jsonc.js.map +0 -1
- package/dist/factory/settings/scopes/mocha.d.ts.map +0 -1
- package/dist/factory/settings/scopes/mocha.js.map +0 -1
- package/dist/factory/settings/scopes/svelte.d.ts.map +0 -1
- package/dist/factory/settings/scopes/svelte.js.map +0 -1
- package/dist/factory/settings/scopes/ts.d.ts.map +0 -1
- package/dist/factory/settings/scopes/ts.js.map +0 -1
- package/dist/factory/settings/scopes/yml.d.ts.map +0 -1
- package/dist/factory/settings/scopes/yml.js.map +0 -1
- package/dist/factory/settings/setting.js.map +0 -1
- package/src/factory/factory.ts +0 -103
package/src/factory/factory.ts
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
import type { ScopeSettings } from "./settings";
|
2
|
-
import type { Input } from "../interface/input";
|
3
|
-
|
4
|
-
export class Factory {
|
5
|
-
public readonly common;
|
6
|
-
public readonly scopes;
|
7
|
-
|
8
|
-
constructor(
|
9
|
-
public readonly parsers: Input["imports"]["parsers"],
|
10
|
-
{
|
11
|
-
settings: defaultSettings,
|
12
|
-
files: defaultFiles,
|
13
|
-
ignores: defaultIgnores,
|
14
|
-
rules: defaultRules,
|
15
|
-
}: Input["defaults"],
|
16
|
-
{ "*": commonExtension = {}, ...scopeExtensions }: Input["extensions"] = {} as const,
|
17
|
-
) {
|
18
|
-
const {
|
19
|
-
noInlineConfig = defaultSettings.noInlineConfig,
|
20
|
-
reportUnusedDisableDirectives = defaultSettings.reportUnusedDisableDirectives,
|
21
|
-
sourceType = defaultSettings.sourceType,
|
22
|
-
ecmaVersion = defaultSettings.ecmaVersion,
|
23
|
-
ignores = [] as const,
|
24
|
-
override = false,
|
25
|
-
} = commonExtension;
|
26
|
-
|
27
|
-
this.common = {
|
28
|
-
settings: {
|
29
|
-
name: "linted/*/settings",
|
30
|
-
linterOptions: { noInlineConfig, reportUnusedDisableDirectives } as const,
|
31
|
-
languageOptions: { sourceType, ecmaVersion } as const,
|
32
|
-
} as const,
|
33
|
-
ignores: {
|
34
|
-
name: "linted/*/ignores",
|
35
|
-
ignores: [
|
36
|
-
...override ? [] as const : defaultIgnores["*"],
|
37
|
-
...ignores,
|
38
|
-
] as const,
|
39
|
-
} as const,
|
40
|
-
} as const;
|
41
|
-
this.scopes = {
|
42
|
-
files: defaultFiles,
|
43
|
-
ignores: defaultIgnores,
|
44
|
-
rules: defaultRules,
|
45
|
-
} as const;
|
46
|
-
|
47
|
-
for (const s in scopeExtensions) {
|
48
|
-
const {
|
49
|
-
[s as keyof typeof scopeExtensions]: {
|
50
|
-
files: moreFiles = [],
|
51
|
-
ignores: moreIgnores = [],
|
52
|
-
rules: moreRules = null,
|
53
|
-
} = {} as const,
|
54
|
-
} = scopeExtensions;
|
55
|
-
|
56
|
-
this.scopes.files[s as keyof typeof scopeExtensions].push(...moreFiles);
|
57
|
-
this.scopes.ignores[s as keyof typeof scopeExtensions].push(...moreIgnores);
|
58
|
-
|
59
|
-
if (moreRules !== null)
|
60
|
-
this.scopes.rules[s as keyof typeof scopeExtensions].push([`${s}:override`, moreRules]);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
public scope<S extends keyof typeof ScopeSettings>(scope: S, settings: InstanceType<typeof ScopeSettings[S]>) {
|
65
|
-
const {
|
66
|
-
files: {
|
67
|
-
[scope]: files,
|
68
|
-
},
|
69
|
-
ignores: { [scope]: ignores },
|
70
|
-
rules: { [scope]: rules },
|
71
|
-
} = this.scopes,
|
72
|
-
ruleset = rules.map(([id, rules]) => ({ id: `${scope}:${id}`, rules } as const)),
|
73
|
-
{ languageOptions, parserOptions } = settings,
|
74
|
-
loadedLanguageOptions = {
|
75
|
-
...languageOptions,
|
76
|
-
..."parserOptions" in parserOptions
|
77
|
-
? {
|
78
|
-
parserOptions: {
|
79
|
-
...parserOptions.parserOptions,
|
80
|
-
..."parser" in parserOptions.parserOptions
|
81
|
-
? { parser: this.parsers[parserOptions.parserOptions.parser] } as const
|
82
|
-
: {} as const,
|
83
|
-
} as const,
|
84
|
-
} as const
|
85
|
-
: {} as const,
|
86
|
-
..."parser" in languageOptions
|
87
|
-
? { parser: this.parsers[languageOptions.parser] } as const
|
88
|
-
: {} as const,
|
89
|
-
} as const;
|
90
|
-
|
91
|
-
return files.length < 1
|
92
|
-
? [] as const
|
93
|
-
: ruleset.map(({ id, rules }) => ({
|
94
|
-
name: `linted/${id}`,
|
95
|
-
files,
|
96
|
-
ignores,
|
97
|
-
rules,
|
98
|
-
languageOptions: loadedLanguageOptions,
|
99
|
-
...settings.processor,
|
100
|
-
...settings.language,
|
101
|
-
} as const));
|
102
|
-
}
|
103
|
-
}
|