@eslinted/core 0.0.1-rc.0 → 0.0.1-rc.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +65 -1
- package/dist/index.js.map +1 -1
- package/dist/options/HtmlOption.d.ts +5 -0
- package/dist/options/HtmlOption.d.ts.map +1 -0
- package/dist/options/HtmlOption.js +16 -0
- package/dist/options/HtmlOption.js.map +1 -0
- package/dist/options/JsOption.d.ts +5 -0
- package/dist/options/JsOption.d.ts.map +1 -0
- package/dist/options/JsOption.js +19 -0
- package/dist/options/JsOption.js.map +1 -0
- package/dist/options/JsonOption.d.ts +5 -0
- package/dist/options/JsonOption.d.ts.map +1 -0
- package/dist/options/JsonOption.js +16 -0
- package/dist/options/JsonOption.js.map +1 -0
- package/dist/options/JsoncOption.d.ts +5 -0
- package/dist/options/JsoncOption.d.ts.map +1 -0
- package/dist/options/JsoncOption.js +16 -0
- package/dist/options/JsoncOption.js.map +1 -0
- package/dist/options/MdOption.d.ts +5 -0
- package/dist/options/MdOption.d.ts.map +1 -0
- package/dist/options/MdOption.js +16 -0
- package/dist/options/MdOption.js.map +1 -0
- package/dist/options/SvelteOption.d.ts +10 -0
- package/dist/options/SvelteOption.d.ts.map +1 -0
- package/dist/options/SvelteOption.js +28 -0
- package/dist/options/SvelteOption.js.map +1 -0
- package/dist/options/TsOption.d.ts +8 -0
- package/dist/options/TsOption.d.ts.map +1 -0
- package/dist/options/TsOption.js +25 -0
- package/dist/options/TsOption.js.map +1 -0
- package/dist/options/YmlOption.d.ts +5 -0
- package/dist/options/YmlOption.d.ts.map +1 -0
- package/dist/options/YmlOption.js +16 -0
- package/dist/options/YmlOption.js.map +1 -0
- package/dist/options/option/Option.d.ts +5 -0
- package/dist/options/option/Option.d.ts.map +1 -0
- package/dist/options/option/Option.js +7 -0
- package/dist/options/option/Option.js.map +1 -0
- package/dist/options.d.ts +18 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +17 -0
- package/dist/options.js.map +1 -0
- package/dist/rulesets/ruleset/Ruleset.d.ts +12 -0
- package/dist/rulesets/ruleset/Ruleset.d.ts.map +1 -0
- package/dist/rulesets/ruleset/Ruleset.js +27 -0
- package/dist/rulesets/ruleset/Ruleset.js.map +1 -0
- package/dist/rulesets/ruleset/rule/Rule.d.ts +6 -0
- package/dist/rulesets/ruleset/rule/Rule.d.ts.map +1 -0
- package/dist/rulesets/ruleset/rule/Rule.js +9 -0
- package/dist/rulesets/ruleset/rule/Rule.js.map +1 -0
- package/dist/scopes.d.ts +3 -0
- package/dist/scopes.d.ts.map +1 -0
- package/dist/scopes.js +11 -0
- package/dist/scopes.js.map +1 -0
- package/interface/IConfig.d.ts +21 -0
- package/interface/files/IFiles.d.ts +1 -0
- package/interface/option/IOption.d.ts +25 -0
- package/interface/option/language/IOLanguage.d.ts +15 -0
- package/interface/option/language/ecma/IOLanguageEcma.d.ts +20 -0
- package/interface/option/language/globals/IOLanguageGlobals.d.ts +3 -0
- package/interface/option/language/parser/IOLanguageParser.d.ts +3 -0
- package/interface/option/language/parserOptions/IOLanguageParserOptions.d.ts +5 -0
- package/interface/option/language/source/IOLanguageSource.d.ts +12 -0
- package/interface/option/linter/IOLinter.d.ts +30 -0
- package/interface/option/name/IOName.d.ts +3 -0
- package/interface/option/plugins/IOPlugins.d.ts +3 -0
- package/interface/option/processor/IOProcessor.d.ts +3 -0
- package/interface/rules/IRules.d.ts +1 -0
- package/interface/rules/rule/IRule.d.ts +1 -0
- package/interface/rules/rule/state/RuleSeverity.d.ts +5 -0
- package/package.json +2 -2
- package/src/Scope.d.ts +9 -0
- package/src/index.ts +113 -0
- package/src/options/HtmlOption.ts +31 -0
- package/src/options/JsOption.ts +27 -0
- package/src/options/JsonOption.ts +31 -0
- package/src/options/JsoncOption.ts +31 -0
- package/src/options/MdOption.ts +31 -0
- package/src/options/SvelteOption.ts +47 -0
- package/src/options/TsOption.ts +40 -0
- package/src/options/YmlOption.ts +31 -0
- package/src/options/option/Option.ts +25 -0
- package/src/options.ts +17 -0
- package/src/plugins.d.ts +24 -0
- package/src/rulesets/ruleset/Ruleset.ts +50 -0
- package/src/rulesets/ruleset/rule/Rule.ts +6 -0
- package/src/scopes.ts +11 -0
- package/tsconfig.json +4 -2
- package/types/literal/number/base32.d.ts +19 -0
- package/types/literal/number/base64.d.ts +35 -0
- package/types/literal/number/binary.d.ts +4 -0
- package/types/literal/number/decimal.d.ts +5 -0
- package/types/literal/number/hex.d.ts +10 -0
- package/types/literal/number/octal.d.ts +7 -0
- package/types/literal/number/quatral.d.ts +4 -0
- package/types/literal/number/ternary.d.ts +4 -0
- package/types/literal/string/base64char.d.ts +13 -0
- package/types/literal/string/digit.d.ts +12 -0
- package/types/literal/string/hexchar.d.ts +9 -0
- package/types/literal/string/letter.d.ts +35 -0
- package/types/safe/Safe.d.ts +2 -0
- package/types/safe/numbers/finite/Finite.d.ts +2 -0
- package/types/safe/numbers/finite.d.ts +1 -0
- package/types/safe/numbers/fint.d.ts +1 -0
- package/types/safe/numbers/int/Int.d.ts +2 -0
- package/types/safe/numbers/int.d.ts +1 -0
- package/types/safe/numbers/numberful.d.ts +1 -0
- package/types/safe/numbers/polarity/Negative.d.ts +4 -0
- package/types/safe/numbers/polarity/Positive.d.ts +4 -0
- package/types/safe/numbers/polarity/pole/Pole.d.ts +18 -0
- package/types/safe/primitive.d.ts +5 -0
- package/types/safe/strings/char.d.ts +1 -0
- package/types/safe/strings/length/PropLength.d.ts +3 -0
- package/types/safe/strings/stringful.d.ts +1 -0
- package/types/utility/interface/construct/Particord.d.ts +1 -0
- package/types/utility/interface/construct/Property.d.ts +8 -0
- package/types/utility/interface/construct/Recordful.d.ts +5 -0
- package/types/utility/interface/construct/Table.d.ts +3 -0
- package/types/utility/interface/construct/properties/Field.d.ts +1 -0
- package/types/utility/interface/construct/properties/Flag.d.ts +1 -0
- package/types/utility/interface/construct/properties/Limit.d.ts +8 -0
- package/types/utility/interface/construct/properties/List.d.ts +1 -0
- package/types/utility/interface/construct/properties/Listish.d.ts +1 -0
- package/types/utility/interface/construct/properties/Scalar.d.ts +1 -0
- package/types/utility/interface/construct/tables/FieldTable.d.ts +1 -0
- package/types/utility/interface/construct/tables/FlagTable.d.ts +1 -0
- package/types/utility/interface/construct/tables/ListTable.d.ts +1 -0
- package/types/utility/interface/construct/tables/ListishTable.d.ts +1 -0
- package/types/utility/interface/construct/tables/ScalarTable.d.ts +1 -0
- package/types/utility/interface/identity/Interface.d.ts +80 -0
- package/types/utility/interface/identity/Keys.d.ts +71 -0
- package/types/utility/interface/transform/Unrequire.d.ts +45 -0
- package/types/utility/iterable/construct/ArrayN.d.ts +12 -0
- package/types/utility/iterable/construct/Tuple.d.ts +27 -0
- package/types/utility/iterable/construct/arrays/Arrays.d.ts +1 -0
- package/types/utility/iterable/construct/tuples/Tuples.d.ts +9 -0
- package/types/utility/iterable/identity/DyadType.d.ts +3 -0
- package/types/utility/iterable/identity/MonadType.d.ts +48 -0
- package/types/utility/iterable/identity/TriadType.d.ts +3 -0
- package/types/utility/iterable/identity/array/ArrayType.d.ts +65 -0
- package/types/utility/iterable/identity/array/length/ArrayLength.d.ts +16 -0
- package/types/utility/iterable/transform/Join.d.ts +19 -0
- package/types/utility/iterable/transform/Unflat.d.ts +3 -0
- package/types/utility/iterable/transform/stringarray/Chain.d.ts +30 -0
- package/types/utility/iterable/transform/stringarray/PathN.d.ts +3 -0
- package/types/utility/iterable/transform/stringarray/stringify/Stringify.d.ts +5 -0
- package/types/utility/length/Length.d.ts +35 -0
- package/types/utility/null/null.d.ts +1 -0
- package/types/utility/null/nullable.d.ts +1 -0
- package/types/utility/primitive/Primeval.d.ts +42 -0
- package/types/utility/primitive/boolean/True.d.ts +30 -0
- package/types/utility/primitive/number/Numbered.d.ts +35 -0
- package/types/utility/primitive/string/literal.d.ts +22 -0
- package/types/utility/primitive/string/literalful.d.ts +28 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
declare type IOLanguageEcma<Ecma extends number | IOLanguageEcma.Ecma> = [Ecma] extends [number]
|
2
|
+
? Numbered<Ecma> extends never
|
3
|
+
? object
|
4
|
+
: { ecmaVersion: Numbered<Ecma> }
|
5
|
+
|
6
|
+
: [Ecma] extends [string]
|
7
|
+
? literalful<Ecma> extends never
|
8
|
+
? object
|
9
|
+
: literalful<Ecma> extends IOLanguageEcma.Ecma
|
10
|
+
? { ecmaVersion: literalful<Ecma> }
|
11
|
+
: object
|
12
|
+
: object;
|
13
|
+
|
14
|
+
declare namespace IOLanguageEcma {
|
15
|
+
export type Ecma =
|
16
|
+
| `${number}`
|
17
|
+
| `ES${number}`
|
18
|
+
| `es${number}`
|
19
|
+
| "latest";
|
20
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
declare type IOLanguageSource<Source extends IOLanguageSource.Source> = literalful<Source> extends never
|
2
|
+
? object
|
3
|
+
: literalful<Source> extends IOLanguageSource.Source
|
4
|
+
? { sourceType: literalful<Source> }
|
5
|
+
: object;
|
6
|
+
|
7
|
+
declare namespace IOLanguageSource {
|
8
|
+
export type Source =
|
9
|
+
| "module"
|
10
|
+
| "script"
|
11
|
+
| "commonjs";
|
12
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
declare type IOLinter<
|
2
|
+
NoInline extends boolean,
|
3
|
+
ReportUnused extends
|
4
|
+
| boolean
|
5
|
+
| IOLinter.States,
|
6
|
+
> = {
|
7
|
+
linterOptions: {
|
8
|
+
noInlineConfig: True<NoInline> extends never
|
9
|
+
? false
|
10
|
+
: True<NoInline>;
|
11
|
+
reportUnusedDisableDirectives: [ReportUnused] extends [boolean]
|
12
|
+
? True<ReportUnused> extends never
|
13
|
+
? false
|
14
|
+
: True<ReportUnused>
|
15
|
+
: [ReportUnused] extends [string]
|
16
|
+
? literalful<ReportUnused> extends never
|
17
|
+
? false
|
18
|
+
: literalful<ReportUnused> extends IOLinter.States
|
19
|
+
? literalful<ReportUnused>
|
20
|
+
: false
|
21
|
+
: false;
|
22
|
+
};
|
23
|
+
};
|
24
|
+
|
25
|
+
declare namespace IOLinter {
|
26
|
+
export type States =
|
27
|
+
| "error"
|
28
|
+
| "warn"
|
29
|
+
| "off";
|
30
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
declare interface IRules { rules: IRule }
|
@@ -0,0 +1 @@
|
|
1
|
+
type IRule = Record<string, RuleSeverity | [RuleSeverity, ...unknown[]]>;
|
package/package.json
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eslinted/core",
|
3
|
-
"version": "0.0.1-rc.
|
3
|
+
"version": "0.0.1-rc.3",
|
4
4
|
"description": "",
|
5
5
|
"keywords": [],
|
6
6
|
"license": "MIT",
|
7
7
|
"type": "module",
|
8
8
|
"private": false,
|
9
9
|
"config": {
|
10
|
-
"PACKAGE_JSON_VERSION": "20.9.
|
10
|
+
"PACKAGE_JSON_VERSION": "20.9.1"
|
11
11
|
},
|
12
12
|
"repository": {
|
13
13
|
"type": "git",
|
package/src/Scope.d.ts
ADDED
package/src/index.ts
CHANGED
@@ -0,0 +1,113 @@
|
|
1
|
+
import scopes from "./scopes.js";
|
2
|
+
import options from "./options.js";
|
3
|
+
import type Ruleset from "./rulesets/ruleset/Ruleset.js";
|
4
|
+
|
5
|
+
export { default as Ruleset } from "./rulesets/ruleset/Ruleset.js";
|
6
|
+
export { Rule } from "./rulesets/ruleset/Ruleset.js";
|
7
|
+
export default function (
|
8
|
+
plugins: Plugins,
|
9
|
+
parsers: Record<Scope, unknown>,
|
10
|
+
files: Record<Scope, string[]>,
|
11
|
+
rulesets: { [S in Scope]: Ruleset<S> },
|
12
|
+
): IConfig[] {
|
13
|
+
try {
|
14
|
+
const instantiatedOptions: {
|
15
|
+
[S in Scope]: InstanceType<
|
16
|
+
typeof options[S]
|
17
|
+
>["body"]
|
18
|
+
} = {
|
19
|
+
js: new options
|
20
|
+
.js(
|
21
|
+
plugins
|
22
|
+
.js,
|
23
|
+
...files
|
24
|
+
.js,
|
25
|
+
)
|
26
|
+
.body,
|
27
|
+
ts: new options
|
28
|
+
.ts(
|
29
|
+
plugins
|
30
|
+
.ts,
|
31
|
+
parsers
|
32
|
+
.ts,
|
33
|
+
...files
|
34
|
+
.ts,
|
35
|
+
)
|
36
|
+
.body,
|
37
|
+
svelte: new options
|
38
|
+
.svelte(
|
39
|
+
plugins
|
40
|
+
.svelte,
|
41
|
+
parsers
|
42
|
+
.svelte,
|
43
|
+
parsers
|
44
|
+
.ts,
|
45
|
+
...files
|
46
|
+
.svelte,
|
47
|
+
)
|
48
|
+
.body,
|
49
|
+
html: new options
|
50
|
+
.html(
|
51
|
+
plugins
|
52
|
+
.html,
|
53
|
+
parsers
|
54
|
+
.html,
|
55
|
+
...files
|
56
|
+
.html,
|
57
|
+
)
|
58
|
+
.body,
|
59
|
+
json: new options
|
60
|
+
.json(
|
61
|
+
plugins
|
62
|
+
.json,
|
63
|
+
parsers
|
64
|
+
.json,
|
65
|
+
...files
|
66
|
+
.json,
|
67
|
+
)
|
68
|
+
.body,
|
69
|
+
jsonc: new options
|
70
|
+
.jsonc(
|
71
|
+
plugins
|
72
|
+
.jsonc,
|
73
|
+
parsers
|
74
|
+
.jsonc,
|
75
|
+
...files
|
76
|
+
.jsonc,
|
77
|
+
)
|
78
|
+
.body,
|
79
|
+
yml: new options
|
80
|
+
.yml(
|
81
|
+
plugins
|
82
|
+
.yml,
|
83
|
+
parsers
|
84
|
+
.yml,
|
85
|
+
...files
|
86
|
+
.yml,
|
87
|
+
)
|
88
|
+
.body,
|
89
|
+
};
|
90
|
+
|
91
|
+
return scopes
|
92
|
+
.map(
|
93
|
+
scope =>
|
94
|
+
instantiatedOptions[scope].files.length > 0
|
95
|
+
? rulesets[scope].flat.map(
|
96
|
+
rules => {
|
97
|
+
return {
|
98
|
+
rules,
|
99
|
+
...instantiatedOptions[scope],
|
100
|
+
};
|
101
|
+
},
|
102
|
+
)
|
103
|
+
: [],
|
104
|
+
)
|
105
|
+
.flat();
|
106
|
+
}
|
107
|
+
catch (e) {
|
108
|
+
throw new Error(
|
109
|
+
`linted(): Caught exception.`,
|
110
|
+
{ cause: e },
|
111
|
+
);
|
112
|
+
}
|
113
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import Option from "./option/Option.js";
|
2
|
+
|
3
|
+
export default class HtmlOption extends Option<
|
4
|
+
"html",
|
5
|
+
"@html-eslint",
|
6
|
+
true,
|
7
|
+
never,
|
8
|
+
never,
|
9
|
+
never,
|
10
|
+
never,
|
11
|
+
never
|
12
|
+
> {
|
13
|
+
constructor(
|
14
|
+
plugins: HtmlOption["body"]["plugins"],
|
15
|
+
parser: HtmlOption["body"]["languageOptions"]["parser"],
|
16
|
+
...files: string[]
|
17
|
+
) {
|
18
|
+
super(
|
19
|
+
{
|
20
|
+
name: "linted/scope:html",
|
21
|
+
files,
|
22
|
+
plugins,
|
23
|
+
linterOptions: {
|
24
|
+
noInlineConfig: true,
|
25
|
+
reportUnusedDisableDirectives: "error",
|
26
|
+
},
|
27
|
+
languageOptions: { parser },
|
28
|
+
},
|
29
|
+
);
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import Option from "./option/Option.js";
|
2
|
+
|
3
|
+
export default class JsOption extends Option<
|
4
|
+
"js",
|
5
|
+
"@stylistic"
|
6
|
+
> {
|
7
|
+
constructor(
|
8
|
+
plugins: JsOption["body"]["plugins"],
|
9
|
+
...files: string[]
|
10
|
+
) {
|
11
|
+
super(
|
12
|
+
{
|
13
|
+
name: "linted/scope:js",
|
14
|
+
files,
|
15
|
+
plugins,
|
16
|
+
linterOptions: {
|
17
|
+
noInlineConfig: true,
|
18
|
+
reportUnusedDisableDirectives: "error",
|
19
|
+
},
|
20
|
+
languageOptions: {
|
21
|
+
ecmaVersion: "latest",
|
22
|
+
sourceType: "module",
|
23
|
+
},
|
24
|
+
},
|
25
|
+
);
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import Option from "./option/Option.js";
|
2
|
+
|
3
|
+
export default class JsonOption extends Option<
|
4
|
+
"json",
|
5
|
+
"jsonc",
|
6
|
+
true,
|
7
|
+
never,
|
8
|
+
never,
|
9
|
+
never,
|
10
|
+
never,
|
11
|
+
never
|
12
|
+
> {
|
13
|
+
constructor(
|
14
|
+
plugins: JsonOption["body"]["plugins"],
|
15
|
+
parser: JsonOption["body"]["languageOptions"]["parser"],
|
16
|
+
...files: string[]
|
17
|
+
) {
|
18
|
+
super(
|
19
|
+
{
|
20
|
+
name: "linted/scope:json",
|
21
|
+
files,
|
22
|
+
plugins,
|
23
|
+
linterOptions: {
|
24
|
+
noInlineConfig: true,
|
25
|
+
reportUnusedDisableDirectives: "error",
|
26
|
+
},
|
27
|
+
languageOptions: { parser },
|
28
|
+
},
|
29
|
+
);
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import Option from "./option/Option.js";
|
2
|
+
|
3
|
+
export default class JsoncOption extends Option<
|
4
|
+
"jsonc",
|
5
|
+
"jsonc",
|
6
|
+
true,
|
7
|
+
never,
|
8
|
+
never,
|
9
|
+
never,
|
10
|
+
never,
|
11
|
+
never
|
12
|
+
> {
|
13
|
+
constructor(
|
14
|
+
plugins: JsoncOption["body"]["plugins"],
|
15
|
+
parser: JsoncOption["body"]["languageOptions"]["parser"],
|
16
|
+
...files: string[]
|
17
|
+
) {
|
18
|
+
super(
|
19
|
+
{
|
20
|
+
name: "linted/scope:jsonc",
|
21
|
+
files,
|
22
|
+
plugins,
|
23
|
+
linterOptions: {
|
24
|
+
noInlineConfig: true,
|
25
|
+
reportUnusedDisableDirectives: "error",
|
26
|
+
},
|
27
|
+
languageOptions: { parser },
|
28
|
+
},
|
29
|
+
);
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import Option from "./option/Option.js";
|
2
|
+
|
3
|
+
export default class MdOption extends Option<
|
4
|
+
"md",
|
5
|
+
"yml",
|
6
|
+
true,
|
7
|
+
never,
|
8
|
+
never,
|
9
|
+
never,
|
10
|
+
never,
|
11
|
+
never
|
12
|
+
> {
|
13
|
+
constructor(
|
14
|
+
plugins: MdOption["body"]["plugins"],
|
15
|
+
parser: MdOption["body"]["languageOptions"]["parser"],
|
16
|
+
...files: string[]
|
17
|
+
) {
|
18
|
+
super(
|
19
|
+
{
|
20
|
+
name: "linted/scope:md",
|
21
|
+
files,
|
22
|
+
plugins,
|
23
|
+
linterOptions: {
|
24
|
+
noInlineConfig: true,
|
25
|
+
reportUnusedDisableDirectives: "error",
|
26
|
+
},
|
27
|
+
languageOptions: { parser },
|
28
|
+
},
|
29
|
+
);
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import Option from "./option/Option.js";
|
2
|
+
import type TsOption from "./TsOption.js";
|
3
|
+
|
4
|
+
export default class SvelteOption extends Option<
|
5
|
+
"svelte",
|
6
|
+
| "svelte"
|
7
|
+
| keyof TsOption["body"]["plugins"]
|
8
|
+
,
|
9
|
+
true,
|
10
|
+
& TsOption["body"]["languageOptions"]["parserOptions"]
|
11
|
+
& { parser: unknown }
|
12
|
+
& { extraFileExtensions: [".svelte"] },
|
13
|
+
never,
|
14
|
+
"svelte/svelte"
|
15
|
+
> {
|
16
|
+
constructor(
|
17
|
+
plugins: SvelteOption["body"]["plugins"],
|
18
|
+
svelteParser: SvelteOption["body"]["languageOptions"]["parser"],
|
19
|
+
tsParser: SvelteOption["body"]["languageOptions"]["parserOptions"]["parser"],
|
20
|
+
...files: string[]
|
21
|
+
) {
|
22
|
+
super(
|
23
|
+
{
|
24
|
+
name: "linted/scope:svelte",
|
25
|
+
processor: "svelte/svelte",
|
26
|
+
files,
|
27
|
+
plugins,
|
28
|
+
linterOptions: {
|
29
|
+
noInlineConfig: true,
|
30
|
+
reportUnusedDisableDirectives: "error",
|
31
|
+
},
|
32
|
+
languageOptions: {
|
33
|
+
ecmaVersion: "latest",
|
34
|
+
sourceType: "module",
|
35
|
+
parser: svelteParser,
|
36
|
+
parserOptions: {
|
37
|
+
ecmaVersion: "latest",
|
38
|
+
sourceType: "module",
|
39
|
+
project: "tsconfig.json",
|
40
|
+
extraFileExtensions: [".svelte"],
|
41
|
+
parser: tsParser,
|
42
|
+
},
|
43
|
+
},
|
44
|
+
},
|
45
|
+
);
|
46
|
+
}
|
47
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import Option from "./option/Option.js";
|
2
|
+
import type JsOption from "./JsOption.js";
|
3
|
+
|
4
|
+
export default class TsOption extends Option<
|
5
|
+
"ts",
|
6
|
+
| "@typescript-eslint"
|
7
|
+
| keyof JsOption["body"]["plugins"]
|
8
|
+
,
|
9
|
+
true,
|
10
|
+
& JsOption["body"]["languageOptions"]
|
11
|
+
& { project: "tsconfig.json" }
|
12
|
+
> {
|
13
|
+
constructor(
|
14
|
+
plugins: TsOption["body"]["plugins"],
|
15
|
+
parser: unknown,
|
16
|
+
...files: string[]
|
17
|
+
) {
|
18
|
+
super(
|
19
|
+
{
|
20
|
+
name: "linted/scope:ts",
|
21
|
+
files,
|
22
|
+
plugins,
|
23
|
+
linterOptions: {
|
24
|
+
noInlineConfig: true,
|
25
|
+
reportUnusedDisableDirectives: "error",
|
26
|
+
},
|
27
|
+
languageOptions: {
|
28
|
+
ecmaVersion: "latest",
|
29
|
+
sourceType: "module",
|
30
|
+
parser,
|
31
|
+
parserOptions: {
|
32
|
+
ecmaVersion: "latest",
|
33
|
+
sourceType: "module",
|
34
|
+
project: "tsconfig.json",
|
35
|
+
},
|
36
|
+
},
|
37
|
+
},
|
38
|
+
);
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import Option from "./option/Option.js";
|
2
|
+
|
3
|
+
export default class YmlOption extends Option<
|
4
|
+
"yml",
|
5
|
+
"yml",
|
6
|
+
true,
|
7
|
+
never,
|
8
|
+
never,
|
9
|
+
never,
|
10
|
+
never,
|
11
|
+
never
|
12
|
+
> {
|
13
|
+
constructor(
|
14
|
+
plugins: YmlOption["body"]["plugins"],
|
15
|
+
parser: YmlOption["body"]["languageOptions"]["parser"],
|
16
|
+
...files: string[]
|
17
|
+
) {
|
18
|
+
super(
|
19
|
+
{
|
20
|
+
name: "linted/scope:yml",
|
21
|
+
files,
|
22
|
+
plugins,
|
23
|
+
linterOptions: {
|
24
|
+
noInlineConfig: true,
|
25
|
+
reportUnusedDisableDirectives: "error",
|
26
|
+
},
|
27
|
+
languageOptions: { parser },
|
28
|
+
},
|
29
|
+
);
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
export default class Option<
|
2
|
+
Scope extends string,
|
3
|
+
PluginId extends string,
|
4
|
+
UseParser extends boolean = never,
|
5
|
+
ParserOptions extends object = never,
|
6
|
+
GlobalTypes extends string = never,
|
7
|
+
ProcessorId extends string = never,
|
8
|
+
Source extends IOLanguageSource.Source = "module",
|
9
|
+
Ecma extends number | IOLanguageEcma.Ecma = "latest",
|
10
|
+
> {
|
11
|
+
constructor(
|
12
|
+
public readonly body: IOption<
|
13
|
+
`linted/scope:${literalful<Scope>}`,
|
14
|
+
true,
|
15
|
+
"error",
|
16
|
+
PluginId,
|
17
|
+
Ecma,
|
18
|
+
Source,
|
19
|
+
UseParser,
|
20
|
+
ParserOptions,
|
21
|
+
GlobalTypes,
|
22
|
+
ProcessorId
|
23
|
+
>,
|
24
|
+
) {}
|
25
|
+
}
|
package/src/options.ts
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
import JsOption from "./options/JsOption.js";
|
2
|
+
import TsOption from "./options/TsOption.js";
|
3
|
+
import SvelteOption from "./options/SvelteOption.js";
|
4
|
+
import HtmlOption from "./options/HtmlOption.js";
|
5
|
+
import JsonOption from "./options/JsonOption.js";
|
6
|
+
import JsoncOption from "./options/JsoncOption.js";
|
7
|
+
import YmlOption from "./options/YmlOption.js";
|
8
|
+
|
9
|
+
export default {
|
10
|
+
js: JsOption,
|
11
|
+
ts: TsOption,
|
12
|
+
svelte: SvelteOption,
|
13
|
+
html: HtmlOption,
|
14
|
+
json: JsonOption,
|
15
|
+
jsonc: JsoncOption,
|
16
|
+
yml: YmlOption,
|
17
|
+
} satisfies Record<Scope, unknown>;
|
package/src/plugins.d.ts
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
type PluginPackage = { configs: unknown };
|
2
|
+
|
3
|
+
declare interface Plugins extends Record<
|
4
|
+
Scope,
|
5
|
+
Record<
|
6
|
+
string,
|
7
|
+
{ configs: unknown }
|
8
|
+
>
|
9
|
+
> {
|
10
|
+
js: { "@stylistic": PluginPackage };
|
11
|
+
ts: {
|
12
|
+
"@stylistic": PluginPackage;
|
13
|
+
"@typescript-eslint": PluginPackage;
|
14
|
+
};
|
15
|
+
svelte: {
|
16
|
+
"@stylistic": PluginPackage;
|
17
|
+
"@typescript-eslint": PluginPackage;
|
18
|
+
svelte: PluginPackage;
|
19
|
+
};
|
20
|
+
html: { "@html-eslint": PluginPackage };
|
21
|
+
json: { jsonc: PluginPackage };
|
22
|
+
jsonc: { jsonc: PluginPackage };
|
23
|
+
yml: { yml: PluginPackage };
|
24
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import Rule from "./rule/Rule.js";
|
2
|
+
|
3
|
+
export { default as Rule } from "./rule/Rule.js";
|
4
|
+
export default class Ruleset<Language extends string> {
|
5
|
+
public readonly ruleset: readonly Rule[];
|
6
|
+
public readonly overrides: Rule[] = [];
|
7
|
+
|
8
|
+
constructor(
|
9
|
+
protected readonly language: literalful<Language>,
|
10
|
+
...ruleset: readonly Rule[]
|
11
|
+
) {
|
12
|
+
this.ruleset = [...ruleset];
|
13
|
+
}
|
14
|
+
|
15
|
+
public get id() {
|
16
|
+
return `ruleset:${this.language}` as const;
|
17
|
+
}
|
18
|
+
|
19
|
+
public get flat() {
|
20
|
+
return [
|
21
|
+
...this.ruleset.map(
|
22
|
+
rules =>
|
23
|
+
rules.rules,
|
24
|
+
),
|
25
|
+
...this.overrides.map(
|
26
|
+
rules =>
|
27
|
+
rules.rules,
|
28
|
+
),
|
29
|
+
];
|
30
|
+
}
|
31
|
+
|
32
|
+
public override(...overrides: (undefined | IRule)[]) {
|
33
|
+
this.overrides.push(
|
34
|
+
...overrides
|
35
|
+
.filter(
|
36
|
+
override =>
|
37
|
+
typeof override !== "undefined",
|
38
|
+
)
|
39
|
+
.map(
|
40
|
+
override =>
|
41
|
+
new Rule(
|
42
|
+
"override",
|
43
|
+
override,
|
44
|
+
),
|
45
|
+
),
|
46
|
+
);
|
47
|
+
|
48
|
+
return this;
|
49
|
+
}
|
50
|
+
}
|
package/src/scopes.ts
ADDED
package/tsconfig.json
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"display": "@jimbojet/tsc",
|
3
|
-
"_version": "5.5.
|
3
|
+
"_version": "5.5.8",
|
4
4
|
"$schema": "https://json.schemastore.org/tsconfig",
|
5
5
|
"include": [
|
6
|
-
"src/**/*.ts",
|
7
6
|
"*.config.ts",
|
7
|
+
"src/**/*.ts",
|
8
|
+
"interface/**/*.d.ts",
|
9
|
+
"types/**/*.d.ts",
|
8
10
|
],
|
9
11
|
"compilerOptions": {
|
10
12
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|