@eslinted/core 3.1.12 → 3.1.13-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/workflows/PROD.main.yml +38 -0
- package/.github/workflows/dev.yml +37 -0
- package/LICENSE +21 -21
- package/README.md +3 -3
- package/SECURITY.md +9 -9
- package/eslint.config.js +3 -3
- package/package.json +54 -54
- package/src/boundary/index.ts +6 -6
- package/src/boundary/input/files/base/index.ts +5 -5
- package/src/boundary/input/files/includes/index.ts +5 -5
- package/src/boundary/input/files/index.ts +11 -11
- package/src/boundary/input/index.ts +23 -23
- package/src/boundary/input/parsers/index.ts +5 -5
- package/src/boundary/input/plugins/index.ts +5 -5
- package/src/boundary/input/rules/index.ts +11 -11
- package/src/boundary/input/rules/overrides/index.ts +6 -6
- package/src/boundary/input/rules/preset/entry/index.ts +5 -5
- package/src/boundary/input/rules/preset/entry/object/index.ts +9 -9
- package/src/boundary/input/rules/preset/entry/object/state/index.ts +6 -6
- package/src/boundary/input/rules/preset/index.ts +6 -6
- package/src/boundary/output/config/index.ts +25 -25
- package/src/boundary/output/config/option/index.ts +24 -24
- package/src/boundary/output/config/option/language/ecma/index.ts +3 -3
- package/src/boundary/output/config/option/language/index.ts +23 -23
- package/src/boundary/output/config/option/language/source/index.ts +3 -3
- package/src/boundary/output/config/option/linter/index.ts +4 -4
- package/src/boundary/output/config/option/plugins/index.ts +3 -3
- package/src/boundary/output/index.ts +3 -3
- package/src/dependency/globals/index.ts +8 -8
- package/src/dependency/index.ts +5 -5
- package/src/dependency/parsers/index.ts +13 -13
- package/src/dependency/plugins/index.ts +12 -12
- package/src/factory/files/index.ts +15 -15
- package/src/factory/index.ts +8 -8
- package/src/factory/options/index.ts +21 -21
- package/src/factory/options/option/html/index.ts +18 -18
- package/src/factory/options/option/index.ts +93 -93
- package/src/factory/options/option/js/index.ts +13 -13
- package/src/factory/options/option/json/index.ts +18 -18
- package/src/factory/options/option/jsonc/index.ts +18 -18
- package/src/factory/options/option/md/index.ts +18 -18
- package/src/factory/options/option/mocha/index.ts +28 -28
- package/src/factory/options/option/svelte/index.ts +32 -32
- package/src/factory/options/option/ts/index.ts +24 -24
- package/src/factory/options/option/yml/index.ts +18 -18
- package/src/factory/rulesets/index.ts +16 -16
- package/src/factory/rulesets/ruleset/index.ts +40 -40
- package/src/factory/rulesets/ruleset/rule/index.ts +8 -8
- package/src/index.ts +95 -95
- package/src/scopes/index.ts +14 -14
- package/tsconfig.json +161 -161
- package/types/typioca/literal/number/base32.d.ts +19 -19
- package/types/typioca/literal/number/base64.d.ts +35 -35
- package/types/typioca/literal/number/binary.d.ts +4 -4
- package/types/typioca/literal/number/decimal.d.ts +5 -5
- package/types/typioca/literal/number/hex.d.ts +10 -10
- package/types/typioca/literal/number/octal.d.ts +7 -7
- package/types/typioca/literal/number/quatral.d.ts +4 -4
- package/types/typioca/literal/number/ternary.d.ts +4 -4
- package/types/typioca/literal/string/base64char.d.ts +13 -13
- package/types/typioca/literal/string/digit.d.ts +12 -12
- package/types/typioca/literal/string/hexchar.d.ts +9 -9
- package/types/typioca/literal/string/letter.d.ts +35 -35
- package/types/typioca/safe/Safe.d.ts +2 -2
- package/types/typioca/safe/numbers/finite/Finite.d.ts +2 -2
- package/types/typioca/safe/numbers/finite.d.ts +1 -1
- package/types/typioca/safe/numbers/fint.d.ts +1 -1
- package/types/typioca/safe/numbers/int/Int.d.ts +2 -2
- package/types/typioca/safe/numbers/int.d.ts +1 -1
- package/types/typioca/safe/numbers/numberful.d.ts +1 -1
- package/types/typioca/safe/numbers/polarity/Negative.d.ts +4 -4
- package/types/typioca/safe/numbers/polarity/Positive.d.ts +4 -4
- package/types/typioca/safe/numbers/polarity/pole/Pole.d.ts +18 -18
- package/types/typioca/safe/primitive.d.ts +5 -5
- package/types/typioca/safe/strings/char.d.ts +1 -1
- package/types/typioca/safe/strings/length/PropLength.d.ts +3 -3
- package/types/typioca/safe/strings/stringful.d.ts +1 -1
- package/types/typioca/utility/interface/construct/Particord.d.ts +1 -1
- package/types/typioca/utility/interface/construct/Property.d.ts +8 -8
- package/types/typioca/utility/interface/construct/Recordful.d.ts +5 -5
- package/types/typioca/utility/interface/construct/Table.d.ts +3 -3
- package/types/typioca/utility/interface/construct/properties/Field.d.ts +1 -1
- package/types/typioca/utility/interface/construct/properties/Flag.d.ts +1 -1
- package/types/typioca/utility/interface/construct/properties/Limit.d.ts +8 -8
- package/types/typioca/utility/interface/construct/properties/List.d.ts +1 -1
- package/types/typioca/utility/interface/construct/properties/Listish.d.ts +1 -1
- package/types/typioca/utility/interface/construct/properties/Scalar.d.ts +1 -1
- package/types/typioca/utility/interface/construct/tables/FieldTable.d.ts +1 -1
- package/types/typioca/utility/interface/construct/tables/FlagTable.d.ts +1 -1
- package/types/typioca/utility/interface/construct/tables/ListTable.d.ts +1 -1
- package/types/typioca/utility/interface/construct/tables/ListishTable.d.ts +1 -1
- package/types/typioca/utility/interface/construct/tables/ScalarTable.d.ts +1 -1
- package/types/typioca/utility/interface/identity/Interface.d.ts +80 -80
- package/types/typioca/utility/interface/identity/Keys.d.ts +71 -71
- package/types/typioca/utility/interface/transform/Unrequire.d.ts +45 -45
- package/types/typioca/utility/iterable/construct/ArrayN.d.ts +12 -12
- package/types/typioca/utility/iterable/construct/Tuple.d.ts +27 -27
- package/types/typioca/utility/iterable/construct/arrays/Arrays.d.ts +1 -1
- package/types/typioca/utility/iterable/construct/tuples/Tuples.d.ts +9 -9
- package/types/typioca/utility/iterable/identity/DyadType.d.ts +3 -3
- package/types/typioca/utility/iterable/identity/MonadType.d.ts +48 -48
- package/types/typioca/utility/iterable/identity/TriadType.d.ts +3 -3
- package/types/typioca/utility/iterable/identity/array/ArrayType.d.ts +65 -65
- package/types/typioca/utility/iterable/identity/array/length/ArrayLength.d.ts +16 -16
- package/types/typioca/utility/iterable/transform/Join.d.ts +19 -19
- package/types/typioca/utility/iterable/transform/Unflat.d.ts +3 -3
- package/types/typioca/utility/iterable/transform/stringarray/Chain.d.ts +30 -30
- package/types/typioca/utility/iterable/transform/stringarray/PathN.d.ts +3 -3
- package/types/typioca/utility/iterable/transform/stringarray/stringify/Stringify.d.ts +5 -5
- package/types/typioca/utility/length/Length.d.ts +35 -35
- package/types/typioca/utility/null/null.d.ts +1 -1
- package/types/typioca/utility/null/nullable.d.ts +1 -1
- package/types/typioca/utility/primitive/Primeval.d.ts +42 -42
- package/types/typioca/utility/primitive/boolean/True.d.ts +30 -30
- package/types/typioca/utility/primitive/number/Numbered.d.ts +35 -35
- package/types/typioca/utility/primitive/string/literal.d.ts +22 -22
- package/types/typioca/utility/primitive/string/literalful.d.ts +28 -28
@@ -1,32 +1,32 @@
|
|
1
|
-
import Option from "../index.js";
|
2
|
-
import type Ts from "../ts/index.js";
|
3
|
-
|
4
|
-
export default class Svelte extends Option<
|
5
|
-
"svelte",
|
6
|
-
"svelte" | keyof Ts["option"]["plugins"],
|
7
|
-
true,
|
8
|
-
{ parser: unknown } & { extraFileExtensions: readonly [".svelte"] } & Ts["option"]["languageOptions"]["parserOptions"],
|
9
|
-
2,
|
10
|
-
never,
|
11
|
-
{ processor: "svelte/svelte" }
|
12
|
-
> {
|
13
|
-
public readonly scope = "svelte";
|
14
|
-
public readonly processor = { processor: "svelte/svelte" } as const;
|
15
|
-
|
16
|
-
public get languageOptions() {
|
17
|
-
const [parser, tsParser] = this.parser;
|
18
|
-
|
19
|
-
return {
|
20
|
-
ecmaVersion: "latest",
|
21
|
-
sourceType: "module",
|
22
|
-
parser,
|
23
|
-
parserOptions: {
|
24
|
-
parser: tsParser,
|
25
|
-
extraFileExtensions: [".svelte"] as const,
|
26
|
-
project: "tsconfig.json",
|
27
|
-
ecmaVersion: "latest",
|
28
|
-
sourceType: "module",
|
29
|
-
},
|
30
|
-
} as const;
|
31
|
-
}
|
32
|
-
}
|
1
|
+
import Option from "../index.js";
|
2
|
+
import type Ts from "../ts/index.js";
|
3
|
+
|
4
|
+
export default class Svelte extends Option<
|
5
|
+
"svelte",
|
6
|
+
"svelte" | keyof Ts["option"]["plugins"],
|
7
|
+
true,
|
8
|
+
{ parser: unknown } & { extraFileExtensions: readonly [".svelte"] } & Ts["option"]["languageOptions"]["parserOptions"],
|
9
|
+
2,
|
10
|
+
never,
|
11
|
+
{ processor: "svelte/svelte" }
|
12
|
+
> {
|
13
|
+
public readonly scope = "svelte";
|
14
|
+
public readonly processor = { processor: "svelte/svelte" } as const;
|
15
|
+
|
16
|
+
public get languageOptions() {
|
17
|
+
const [parser, tsParser] = this.parser;
|
18
|
+
|
19
|
+
return {
|
20
|
+
ecmaVersion: "latest",
|
21
|
+
sourceType: "module",
|
22
|
+
parser,
|
23
|
+
parserOptions: {
|
24
|
+
parser: tsParser,
|
25
|
+
extraFileExtensions: [".svelte"] as const,
|
26
|
+
project: "tsconfig.json",
|
27
|
+
ecmaVersion: "latest",
|
28
|
+
sourceType: "module",
|
29
|
+
},
|
30
|
+
} as const;
|
31
|
+
}
|
32
|
+
}
|
@@ -1,24 +1,24 @@
|
|
1
|
-
import Option from "../index.js";
|
2
|
-
import type Js from "../js/index.js";
|
3
|
-
|
4
|
-
export default class Ts extends Option<
|
5
|
-
"ts",
|
6
|
-
"@typescript-eslint" | keyof Js["option"]["plugins"],
|
7
|
-
true,
|
8
|
-
{ project: "tsconfig.json" } & Js["option"]["languageOptions"],
|
9
|
-
1
|
10
|
-
> {
|
11
|
-
public readonly scope = "ts";
|
12
|
-
public readonly processor = {} as const;
|
13
|
-
|
14
|
-
public get languageOptions() {
|
15
|
-
const [parser] = this.parser;
|
16
|
-
|
17
|
-
return {
|
18
|
-
ecmaVersion: "latest",
|
19
|
-
sourceType: "module",
|
20
|
-
parser,
|
21
|
-
parserOptions: { project: "tsconfig.json", ecmaVersion: "latest", sourceType: "module" },
|
22
|
-
} as const;
|
23
|
-
}
|
24
|
-
}
|
1
|
+
import Option from "../index.js";
|
2
|
+
import type Js from "../js/index.js";
|
3
|
+
|
4
|
+
export default class Ts extends Option<
|
5
|
+
"ts",
|
6
|
+
"@typescript-eslint" | keyof Js["option"]["plugins"],
|
7
|
+
true,
|
8
|
+
{ project: "tsconfig.json" } & Js["option"]["languageOptions"],
|
9
|
+
1
|
10
|
+
> {
|
11
|
+
public readonly scope = "ts";
|
12
|
+
public readonly processor = {} as const;
|
13
|
+
|
14
|
+
public get languageOptions() {
|
15
|
+
const [parser] = this.parser;
|
16
|
+
|
17
|
+
return {
|
18
|
+
ecmaVersion: "latest",
|
19
|
+
sourceType: "module",
|
20
|
+
parser,
|
21
|
+
parserOptions: { project: "tsconfig.json", ecmaVersion: "latest", sourceType: "module" },
|
22
|
+
} as const;
|
23
|
+
}
|
24
|
+
}
|
@@ -1,18 +1,18 @@
|
|
1
|
-
import Option from "../index.js";
|
2
|
-
|
3
|
-
export default class Yml extends Option<
|
4
|
-
"yml",
|
5
|
-
"yml",
|
6
|
-
false,
|
7
|
-
true,
|
8
|
-
1
|
9
|
-
> {
|
10
|
-
public readonly scope = "yml";
|
11
|
-
public readonly processor = {} as const;
|
12
|
-
|
13
|
-
public get languageOptions() {
|
14
|
-
const [parser] = this.parser;
|
15
|
-
|
16
|
-
return { parser } as const;
|
17
|
-
}
|
18
|
-
}
|
1
|
+
import Option from "../index.js";
|
2
|
+
|
3
|
+
export default class Yml extends Option<
|
4
|
+
"yml",
|
5
|
+
"yml",
|
6
|
+
false,
|
7
|
+
true,
|
8
|
+
1
|
9
|
+
> {
|
10
|
+
public readonly scope = "yml";
|
11
|
+
public readonly processor = {} as const;
|
12
|
+
|
13
|
+
public get languageOptions() {
|
14
|
+
const [parser] = this.parser;
|
15
|
+
|
16
|
+
return { parser } as const;
|
17
|
+
}
|
18
|
+
}
|
@@ -1,16 +1,16 @@
|
|
1
|
-
import Ruleset, { Rule } from "./ruleset/index.js";
|
2
|
-
import type { Input } from "../../boundary/index.js";
|
3
|
-
import type { Scope } from "../../scopes/index.js";
|
4
|
-
|
5
|
-
export default class {
|
6
|
-
constructor(private readonly input: Input.Rules.Rules) {}
|
7
|
-
|
8
|
-
public ruleset<S extends Scope>(scope: literalful<S>): Ruleset<S> {
|
9
|
-
try {
|
10
|
-
const { preset, overrides } = this.input;
|
11
|
-
|
12
|
-
return new Ruleset<S>(scope, ...preset[scope].map(args => new Rule(...args))).override(overrides[scope]);
|
13
|
-
}
|
14
|
-
catch (e) { throw new Error(`linted.factory.Rulesets/ruleset/scope:${scope}`, { cause: e }); }
|
15
|
-
}
|
16
|
-
}
|
1
|
+
import Ruleset, { Rule } from "./ruleset/index.js";
|
2
|
+
import type { Input } from "../../boundary/index.js";
|
3
|
+
import type { Scope } from "../../scopes/index.js";
|
4
|
+
|
5
|
+
export default class {
|
6
|
+
constructor(private readonly input: Input.Rules.Rules) {}
|
7
|
+
|
8
|
+
public ruleset<S extends Scope>(scope: literalful<S>): Ruleset<S> {
|
9
|
+
try {
|
10
|
+
const { preset, overrides } = this.input;
|
11
|
+
|
12
|
+
return new Ruleset<S>(scope, ...preset[scope].map(args => new Rule(...args))).override(overrides[scope]);
|
13
|
+
}
|
14
|
+
catch (e) { throw new Error(`linted.factory.Rulesets/ruleset/scope:${scope}`, { cause: e }); }
|
15
|
+
}
|
16
|
+
}
|
@@ -1,40 +1,40 @@
|
|
1
|
-
import type { Scope } from "../../../scopes/index.js";
|
2
|
-
import Rule from "./rule/index.js";
|
3
|
-
|
4
|
-
export { Rule };
|
5
|
-
export default class Ruleset<S extends Scope> {
|
6
|
-
public readonly ruleset: readonly Rule[];
|
7
|
-
public overrides: Null<Rule> = null;
|
8
|
-
|
9
|
-
constructor(private readonly scope: literalful<S>, ...rules: readonly Rule[]) {
|
10
|
-
try {
|
11
|
-
this.ruleset = [...rules];
|
12
|
-
}
|
13
|
-
catch (e) { throw new Error(`linted.factory.Ruleset`, { cause: e }); }
|
14
|
-
}
|
15
|
-
|
16
|
-
public get id() {
|
17
|
-
const { scope } = this;
|
18
|
-
|
19
|
-
return scope;
|
20
|
-
}
|
21
|
-
|
22
|
-
public get records() {
|
23
|
-
try {
|
24
|
-
const { ruleset, overrides } = this;
|
25
|
-
|
26
|
-
return [
|
27
|
-
...ruleset.map(rules => [rules.id, rules.rules] as const),
|
28
|
-
...overrides === null ? [] : [[overrides.id, overrides.rules] as const] as const,
|
29
|
-
];
|
30
|
-
}
|
31
|
-
catch (e) { throw new Error(`linted.factory.Ruleset: records`, { cause: e }); }
|
32
|
-
}
|
33
|
-
|
34
|
-
public override(overrides: undefined | Rule["rules"]) {
|
35
|
-
if (typeof overrides !== "undefined")
|
36
|
-
this.overrides = new Rule("override", overrides);
|
37
|
-
|
38
|
-
return this;
|
39
|
-
}
|
40
|
-
}
|
1
|
+
import type { Scope } from "../../../scopes/index.js";
|
2
|
+
import Rule from "./rule/index.js";
|
3
|
+
|
4
|
+
export { Rule };
|
5
|
+
export default class Ruleset<S extends Scope> {
|
6
|
+
public readonly ruleset: readonly Rule[];
|
7
|
+
public overrides: Null<Rule> = null;
|
8
|
+
|
9
|
+
constructor(private readonly scope: literalful<S>, ...rules: readonly Rule[]) {
|
10
|
+
try {
|
11
|
+
this.ruleset = [...rules];
|
12
|
+
}
|
13
|
+
catch (e) { throw new Error(`linted.factory.Ruleset`, { cause: e }); }
|
14
|
+
}
|
15
|
+
|
16
|
+
public get id() {
|
17
|
+
const { scope } = this;
|
18
|
+
|
19
|
+
return scope;
|
20
|
+
}
|
21
|
+
|
22
|
+
public get records() {
|
23
|
+
try {
|
24
|
+
const { ruleset, overrides } = this;
|
25
|
+
|
26
|
+
return [
|
27
|
+
...ruleset.map(rules => [rules.id, rules.rules] as const),
|
28
|
+
...overrides === null ? [] : [[overrides.id, overrides.rules] as const] as const,
|
29
|
+
];
|
30
|
+
}
|
31
|
+
catch (e) { throw new Error(`linted.factory.Ruleset: records`, { cause: e }); }
|
32
|
+
}
|
33
|
+
|
34
|
+
public override(overrides: undefined | Rule["rules"]) {
|
35
|
+
if (typeof overrides !== "undefined")
|
36
|
+
this.overrides = new Rule("override", overrides);
|
37
|
+
|
38
|
+
return this;
|
39
|
+
}
|
40
|
+
}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import type { Input } from "../../../../boundary/index.js";
|
2
|
-
|
3
|
-
export default class {
|
4
|
-
constructor(
|
5
|
-
public readonly id: string,
|
6
|
-
public readonly rules: Input.Rules.Preset.Entry.Object,
|
7
|
-
) {}
|
8
|
-
}
|
1
|
+
import type { Input } from "../../../../boundary/index.js";
|
2
|
+
|
3
|
+
export default class {
|
4
|
+
constructor(
|
5
|
+
public readonly id: string,
|
6
|
+
public readonly rules: Input.Rules.Preset.Entry.Object,
|
7
|
+
) {}
|
8
|
+
}
|
package/src/index.ts
CHANGED
@@ -1,95 +1,95 @@
|
|
1
|
-
import scopes, { type Scope } from "./scopes/index.js";
|
2
|
-
import type * as Boundary from "./boundary/index.js";
|
3
|
-
import { Options, Files, Rulesets } from "./factory/index.js";
|
4
|
-
|
5
|
-
export type { Boundary };
|
6
|
-
export default function (
|
7
|
-
plugins: Boundary.Input.Plugins,
|
8
|
-
parsers: Boundary.Input.Parsers,
|
9
|
-
files: Boundary.Input.Files,
|
10
|
-
rules: Boundary.Input.Rules,
|
11
|
-
): Boundary.Output[] {
|
12
|
-
try {
|
13
|
-
const F = new Files(files),
|
14
|
-
R = new Rulesets(rules),
|
15
|
-
Pa: { [S in Scope]: ConstructorParameters<typeof Options[S]>[3] } = {
|
16
|
-
js: [] as const,
|
17
|
-
ts: [parsers.ts] as const,
|
18
|
-
svelte: [parsers.svelte, parsers.ts] as const,
|
19
|
-
mocha: [parsers.ts] as const,
|
20
|
-
html: [parsers.html] as const,
|
21
|
-
json: [parsers.jsonc] as const,
|
22
|
-
jsonc: [parsers.jsonc] as const,
|
23
|
-
yml: [parsers.yml] as const,
|
24
|
-
md: [parsers.md] as const,
|
25
|
-
} as const,
|
26
|
-
options: { [S in Scope]: InstanceType<typeof Options[S]>["configs"] } = {
|
27
|
-
js: new Options
|
28
|
-
.js(
|
29
|
-
F.files("js"),
|
30
|
-
R.ruleset("js"),
|
31
|
-
{ "@stylistic": plugins["@stylistic"] },
|
32
|
-
Pa.js,
|
33
|
-
).configs,
|
34
|
-
ts: new Options
|
35
|
-
.ts(
|
36
|
-
F.files("ts"),
|
37
|
-
R.ruleset("ts"),
|
38
|
-
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] },
|
39
|
-
Pa.ts,
|
40
|
-
).configs,
|
41
|
-
svelte: new Options
|
42
|
-
.svelte(
|
43
|
-
F.files("svelte"),
|
44
|
-
R.ruleset("svelte"),
|
45
|
-
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte },
|
46
|
-
Pa.svelte,
|
47
|
-
).configs,
|
48
|
-
mocha: new Options
|
49
|
-
.mocha(
|
50
|
-
F.files("mocha"),
|
51
|
-
R.ruleset("mocha"),
|
52
|
-
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha },
|
53
|
-
Pa.mocha,
|
54
|
-
).configs,
|
55
|
-
html: new Options
|
56
|
-
.html(
|
57
|
-
F.files("html"),
|
58
|
-
R.ruleset("html"),
|
59
|
-
{ "@html-eslint": plugins["@html-eslint"] },
|
60
|
-
Pa.html,
|
61
|
-
).configs,
|
62
|
-
json: new Options
|
63
|
-
.json(
|
64
|
-
F.files("json"),
|
65
|
-
R.ruleset("json"),
|
66
|
-
{ jsonc: plugins.jsonc },
|
67
|
-
Pa.json,
|
68
|
-
).configs,
|
69
|
-
jsonc: new Options
|
70
|
-
.jsonc(
|
71
|
-
F.files("jsonc"),
|
72
|
-
R.ruleset("jsonc"),
|
73
|
-
{ jsonc: plugins.jsonc },
|
74
|
-
Pa.jsonc,
|
75
|
-
).configs,
|
76
|
-
yml: new Options
|
77
|
-
.yml(
|
78
|
-
F.files("yml"),
|
79
|
-
R.ruleset("yml"),
|
80
|
-
{ yml: plugins.yml },
|
81
|
-
Pa.yml,
|
82
|
-
).configs,
|
83
|
-
md: new Options
|
84
|
-
.md(
|
85
|
-
F.files("md"),
|
86
|
-
R.ruleset("md"),
|
87
|
-
{ markdownlint: plugins.markdownlint },
|
88
|
-
Pa.md,
|
89
|
-
).configs,
|
90
|
-
};
|
91
|
-
|
92
|
-
return scopes.flatMap(scope => options[scope]);
|
93
|
-
}
|
94
|
-
catch (e) { throw new Error(`linted-core`, { cause: e }); }
|
95
|
-
}
|
1
|
+
import scopes, { type Scope } from "./scopes/index.js";
|
2
|
+
import type * as Boundary from "./boundary/index.js";
|
3
|
+
import { Options, Files, Rulesets } from "./factory/index.js";
|
4
|
+
|
5
|
+
export type { Boundary };
|
6
|
+
export default function (
|
7
|
+
plugins: Boundary.Input.Plugins,
|
8
|
+
parsers: Boundary.Input.Parsers,
|
9
|
+
files: Boundary.Input.Files,
|
10
|
+
rules: Boundary.Input.Rules,
|
11
|
+
): Boundary.Output[] {
|
12
|
+
try {
|
13
|
+
const F = new Files(files),
|
14
|
+
R = new Rulesets(rules),
|
15
|
+
Pa: { [S in Scope]: ConstructorParameters<typeof Options[S]>[3] } = {
|
16
|
+
js: [] as const,
|
17
|
+
ts: [parsers.ts] as const,
|
18
|
+
svelte: [parsers.svelte, parsers.ts] as const,
|
19
|
+
mocha: [parsers.ts] as const,
|
20
|
+
html: [parsers.html] as const,
|
21
|
+
json: [parsers.jsonc] as const,
|
22
|
+
jsonc: [parsers.jsonc] as const,
|
23
|
+
yml: [parsers.yml] as const,
|
24
|
+
md: [parsers.md] as const,
|
25
|
+
} as const,
|
26
|
+
options: { [S in Scope]: InstanceType<typeof Options[S]>["configs"] } = {
|
27
|
+
js: new Options
|
28
|
+
.js(
|
29
|
+
F.files("js"),
|
30
|
+
R.ruleset("js"),
|
31
|
+
{ "@stylistic": plugins["@stylistic"] },
|
32
|
+
Pa.js,
|
33
|
+
).configs,
|
34
|
+
ts: new Options
|
35
|
+
.ts(
|
36
|
+
F.files("ts"),
|
37
|
+
R.ruleset("ts"),
|
38
|
+
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] },
|
39
|
+
Pa.ts,
|
40
|
+
).configs,
|
41
|
+
svelte: new Options
|
42
|
+
.svelte(
|
43
|
+
F.files("svelte"),
|
44
|
+
R.ruleset("svelte"),
|
45
|
+
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte },
|
46
|
+
Pa.svelte,
|
47
|
+
).configs,
|
48
|
+
mocha: new Options
|
49
|
+
.mocha(
|
50
|
+
F.files("mocha"),
|
51
|
+
R.ruleset("mocha"),
|
52
|
+
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha },
|
53
|
+
Pa.mocha,
|
54
|
+
).configs,
|
55
|
+
html: new Options
|
56
|
+
.html(
|
57
|
+
F.files("html"),
|
58
|
+
R.ruleset("html"),
|
59
|
+
{ "@html-eslint": plugins["@html-eslint"] },
|
60
|
+
Pa.html,
|
61
|
+
).configs,
|
62
|
+
json: new Options
|
63
|
+
.json(
|
64
|
+
F.files("json"),
|
65
|
+
R.ruleset("json"),
|
66
|
+
{ jsonc: plugins.jsonc },
|
67
|
+
Pa.json,
|
68
|
+
).configs,
|
69
|
+
jsonc: new Options
|
70
|
+
.jsonc(
|
71
|
+
F.files("jsonc"),
|
72
|
+
R.ruleset("jsonc"),
|
73
|
+
{ jsonc: plugins.jsonc },
|
74
|
+
Pa.jsonc,
|
75
|
+
).configs,
|
76
|
+
yml: new Options
|
77
|
+
.yml(
|
78
|
+
F.files("yml"),
|
79
|
+
R.ruleset("yml"),
|
80
|
+
{ yml: plugins.yml },
|
81
|
+
Pa.yml,
|
82
|
+
).configs,
|
83
|
+
md: new Options
|
84
|
+
.md(
|
85
|
+
F.files("md"),
|
86
|
+
R.ruleset("md"),
|
87
|
+
{ markdownlint: plugins.markdownlint },
|
88
|
+
Pa.md,
|
89
|
+
).configs,
|
90
|
+
};
|
91
|
+
|
92
|
+
return scopes.flatMap(scope => options[scope]);
|
93
|
+
}
|
94
|
+
catch (e) { throw new Error(`linted-core`, { cause: e }); }
|
95
|
+
}
|
package/src/scopes/index.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
const scopes = [
|
2
|
-
"js",
|
3
|
-
"ts",
|
4
|
-
"svelte",
|
5
|
-
"mocha",
|
6
|
-
"html",
|
7
|
-
"json",
|
8
|
-
"jsonc",
|
9
|
-
"yml",
|
10
|
-
"md",
|
11
|
-
] as const;
|
12
|
-
|
13
|
-
export default scopes;
|
14
|
-
export type Scope = (typeof scopes)[number];
|
1
|
+
const scopes = [
|
2
|
+
"js",
|
3
|
+
"ts",
|
4
|
+
"svelte",
|
5
|
+
"mocha",
|
6
|
+
"html",
|
7
|
+
"json",
|
8
|
+
"jsonc",
|
9
|
+
"yml",
|
10
|
+
"md",
|
11
|
+
] as const;
|
12
|
+
|
13
|
+
export default scopes;
|
14
|
+
export type Scope = (typeof scopes)[number];
|