@eslinted/core 4.0.5-rc.5 → 4.0.5-rc.6
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.
- package/package.json +3 -9
- package/src/factory/files.ts +20 -9
- package/src/factory/index.ts +4 -2
- package/src/factory/options/index.ts +2 -0
- package/src/factory/options/option/index.ts +25 -33
- package/src/factory/options/option/template/globals.ts +5 -0
- package/src/factory/options/option/{template.ts → template/index.ts} +6 -4
- package/src/factory/options/option/template/language/ecma.ts +3 -0
- package/src/factory/options/option/{params/language.ts → template/language/index.ts} +3 -3
- package/src/factory/options/option/template/language/source.ts +4 -0
- package/src/factory/options/option/template/linter.ts +8 -0
- package/src/factory/options/option/template/plugins.ts +1 -0
- package/src/factory/rulesets/index.ts +24 -0
- package/src/factory/rulesets/ruleset.ts +25 -0
- package/src/index.ts +25 -21
- package/src/input/files.ts +6 -0
- package/src/{inputs → input}/imports/parsers.ts +1 -1
- package/src/{inputs → input}/imports/plugins.ts +3 -2
- package/src/input/index.ts +23 -0
- package/src/input/parsers.ts +3 -0
- package/src/input/plugins.ts +3 -0
- package/src/input/rules/entry/index.ts +7 -0
- package/src/input/rules/entry/record/index.ts +3 -0
- package/src/input/rules/entry/record/state.ts +5 -0
- package/src/input/rules/index.ts +14 -0
- package/src/output.ts +23 -23
- package/src/scopes.ts +1 -1
- package/tsconfig.json +4 -4
- package/src/factory/options/option/params/globals.ts +0 -3
- package/src/factory/options/option/params/languageOptions/ecma.ts +0 -1
- package/src/factory/options/option/params/languageOptions/source.ts +0 -1
- package/src/factory/options/option/params/linter.ts +0 -4
- package/src/factory/options/option/params/plugins.ts +0 -1
- package/src/factory/ruleset/index.ts +0 -41
- package/src/factory/ruleset/rule.ts +0 -8
- package/src/factory/rulesets.ts +0 -16
- package/src/input.ts +0 -11
- package/src/inputs/files/base.ts +0 -3
- package/src/inputs/files/includes.ts +0 -3
- package/src/inputs/files.ts +0 -7
- package/src/inputs/imports.ts +0 -2
- package/src/inputs/parsers.ts +0 -3
- package/src/inputs/plugins.ts +0 -3
- package/src/inputs/rules/entry/index.ts +0 -3
- package/src/inputs/rules/entry/object/index.ts +0 -7
- package/src/inputs/rules/entry/object/state/index.ts +0 -4
- package/src/inputs/rules/overrides.ts +0 -4
- package/src/inputs/rules/preset.ts +0 -4
- package/src/inputs/rules.ts +0 -7
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"_schemaVersion": "20.18.0-core.0",
|
3
3
|
"name": "@eslinted/core",
|
4
|
-
"version": "4.0.5-rc.
|
4
|
+
"version": "4.0.5-rc.6",
|
5
5
|
"description": "Core ESLint flat config factory npm package `linted`.",
|
6
6
|
"keywords": [],
|
7
7
|
"repository": "github:jimmy-zhening-luo/linted-core",
|
@@ -13,14 +13,8 @@
|
|
13
13
|
"access": "public"
|
14
14
|
},
|
15
15
|
"type": "module",
|
16
|
-
"
|
17
|
-
|
18
|
-
"import": {
|
19
|
-
"types": "./dist/index.d.ts",
|
20
|
-
"default": "./dist/index.js"
|
21
|
-
}
|
22
|
-
}
|
23
|
-
},
|
16
|
+
"main": "./dist/index.js",
|
17
|
+
"types": "./dist/index.d.ts",
|
24
18
|
"config": {
|
25
19
|
"language": "ts",
|
26
20
|
"fix": "true",
|
package/src/factory/files.ts
CHANGED
@@ -1,15 +1,26 @@
|
|
1
|
-
import type {
|
2
|
-
import type { Input } from "@eslinted/core";
|
1
|
+
import type { Input } from ".";
|
3
2
|
|
4
3
|
export class Files {
|
5
|
-
|
4
|
+
private readonly _files = new Map<string, string[]>();
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
constructor(private readonly input: Input["files"]) {
|
7
|
+
const { files, includes } = this.input,
|
8
|
+
scopes = Object.keys(files) as (keyof typeof files)[];
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
for (const scope of scopes)
|
11
|
+
this._files.set(
|
12
|
+
scope,
|
13
|
+
[
|
14
|
+
...files[scope],
|
15
|
+
...scope in includes ? (includes[scope] as string[]) : [],
|
16
|
+
],
|
17
|
+
);
|
18
|
+
}
|
19
|
+
|
20
|
+
public files(scope: string) {
|
21
|
+
if (!this._files.has(scope))
|
22
|
+
throw new ReferenceError(`Files not found for scope: ${scope}`);
|
23
|
+
|
24
|
+
return this._files.get(scope) as string[];
|
14
25
|
}
|
15
26
|
}
|
package/src/factory/index.ts
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
export type { Scope, Input, Output } from "..";
|
2
|
+
|
3
3
|
import Options from "./options";
|
4
|
+
import { Files } from "./files";
|
5
|
+
import { Rulesets } from "./rulesets";
|
4
6
|
|
5
7
|
export { Options, Files, Rulesets };
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import
|
2
|
-
import type {
|
3
|
-
import type { Output } from "@eslinted/core";
|
4
|
-
import type { Ruleset } from "../../ruleset";
|
1
|
+
import globals from "globals";
|
2
|
+
import type { Ruleset } from "../../rulesets/ruleset";
|
5
3
|
import type {
|
4
|
+
Scope,
|
5
|
+
Input,
|
6
|
+
Output,
|
6
7
|
OptionTemplate,
|
7
8
|
LanguageOptions,
|
8
9
|
Plugins,
|
9
10
|
Globals,
|
10
11
|
} from "./template";
|
11
|
-
import globals from "globals";
|
12
12
|
|
13
13
|
export default abstract class Option<
|
14
14
|
S extends Scope,
|
@@ -29,41 +29,33 @@ export default abstract class Option<
|
|
29
29
|
: object;
|
30
30
|
|
31
31
|
constructor(
|
32
|
-
public readonly files: readonly string[],
|
33
|
-
public readonly ruleset: Ruleset<S>,
|
34
32
|
public readonly plugins: Plugins<Plugin>,
|
35
33
|
public readonly parser: Tuple<unknown, ParserCount>,
|
34
|
+
public readonly files: string[],
|
35
|
+
public readonly ruleset: Ruleset,
|
36
36
|
) {}
|
37
37
|
|
38
38
|
public get configs(): Output {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
} = this;
|
46
|
-
|
47
|
-
if (ruleset.id !== scope)
|
48
|
-
throw new TypeError(`Option and Ruleset scope mismatch`, { cause: { option: scope, ruleset: ruleset.id } });
|
49
|
-
else if (files.length < 1)
|
50
|
-
return [];
|
51
|
-
else {
|
52
|
-
const baseName = `linted/scope:${scope}/rule:${ruleset.id}` as const;
|
39
|
+
const {
|
40
|
+
scope,
|
41
|
+
ruleset,
|
42
|
+
files,
|
43
|
+
option,
|
44
|
+
} = this;
|
53
45
|
|
54
|
-
|
55
|
-
|
46
|
+
if (ruleset.scope !== scope)
|
47
|
+
throw new TypeError(`Scope mismatch between option and ruleset`, { cause: { option: scope, ruleset: ruleset.scope } });
|
56
48
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
49
|
+
return files.length < 1
|
50
|
+
? []
|
51
|
+
: ruleset.ruleset.map(({ id, rule }) => {
|
52
|
+
return {
|
53
|
+
name: `linted/${id}`,
|
54
|
+
files,
|
55
|
+
rules: rule,
|
56
|
+
...option,
|
57
|
+
};
|
58
|
+
});
|
67
59
|
}
|
68
60
|
|
69
61
|
private get option() {
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import type {
|
4
|
-
import type {
|
1
|
+
export type { Scope, Input, Output } from "../..";
|
2
|
+
|
3
|
+
import type { LanguageOptions } from "./language";
|
4
|
+
import type { Linter } from "./linter";
|
5
|
+
import type { Plugins } from "./plugins";
|
6
|
+
import type { Globals } from "./globals";
|
5
7
|
|
6
8
|
export type {
|
7
9
|
LanguageOptions,
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import type {
|
2
|
-
import type {
|
1
|
+
import type { EcmaVersion } from "./ecma";
|
2
|
+
import type { SourceType } from "./source";
|
3
3
|
|
4
4
|
export type LanguageOptions<
|
5
5
|
IsEcma extends boolean,
|
6
6
|
ParserOptions extends object | boolean,
|
7
7
|
GlobalTypes extends string,
|
8
8
|
> =
|
9
|
-
& (True<IsEcma> extends never ? object : { ecmaVersion:
|
9
|
+
& (True<IsEcma> extends never ? object : { ecmaVersion: EcmaVersion; sourceType: SourceType })
|
10
10
|
& (literalful<GlobalTypes> extends never ? object : { globals: Record<string, unknown> })
|
11
11
|
& (
|
12
12
|
ParserOptions extends boolean
|
@@ -0,0 +1 @@
|
|
1
|
+
export type Plugins<PluginId extends string> = { [P in literalful<PluginId>]: { configs: unknown } };
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import type { Input } from "..";
|
2
|
+
|
3
|
+
export type { Input };
|
4
|
+
|
5
|
+
import { Ruleset } from "./ruleset";
|
6
|
+
|
7
|
+
export class Rulesets {
|
8
|
+
private readonly rulesets = new Map<string, Ruleset>();
|
9
|
+
|
10
|
+
constructor(private readonly input: Input["rules"]) {
|
11
|
+
const { rules, overrides } = this.input,
|
12
|
+
scopes = Object.keys(rules) as (keyof typeof rules)[];
|
13
|
+
|
14
|
+
for (const scope of scopes)
|
15
|
+
this.rulesets.set(scope, new Ruleset(scope, rules[scope], overrides[scope]));
|
16
|
+
}
|
17
|
+
|
18
|
+
public ruleset(scope: string): Ruleset {
|
19
|
+
if (!this.rulesets.has(scope))
|
20
|
+
throw new ReferenceError(`Ruleset not found for scope: ${scope}`);
|
21
|
+
|
22
|
+
return this.rulesets.get(scope) as Ruleset;
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import type { Input } from ".";
|
2
|
+
|
3
|
+
export class Ruleset {
|
4
|
+
public readonly ruleset: { id: string; rule: Input.Rule.Entry.Record }[];
|
5
|
+
|
6
|
+
constructor(
|
7
|
+
public readonly scope: string,
|
8
|
+
rules: (readonly [string, Input.Rule.Entry.Record])[],
|
9
|
+
override?: Input.Rule.Entry.Record,
|
10
|
+
) {
|
11
|
+
const map = ([id, rule]: typeof rules[number]) => {
|
12
|
+
return {
|
13
|
+
id: `${scope}:${id}`,
|
14
|
+
rule,
|
15
|
+
};
|
16
|
+
};
|
17
|
+
|
18
|
+
this.ruleset = [
|
19
|
+
...rules.map(rule => map(rule)),
|
20
|
+
...typeof override === "undefined"
|
21
|
+
? []
|
22
|
+
: [map([`${scope}:override`, override])],
|
23
|
+
];
|
24
|
+
}
|
25
|
+
}
|
package/src/index.ts
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
export type { Scope } from "./scopes";
|
2
|
+
|
1
3
|
import type { Input } from "./input";
|
2
|
-
import type { Scope } from "./scopes";
|
3
4
|
import type { Output } from "./output";
|
4
5
|
|
5
|
-
export type { Input,
|
6
|
+
export type { Input, Output };
|
6
7
|
|
7
8
|
import { scopes } from "./scopes";
|
8
9
|
import {
|
@@ -23,66 +24,66 @@ export default function (
|
|
23
24
|
options: { [S in typeof scopes[number]]: InstanceType<typeof Options[S]>["configs"] } = {
|
24
25
|
js: new Options
|
25
26
|
.js(
|
26
|
-
F.files("js"),
|
27
|
-
R.ruleset("js"),
|
28
27
|
{ "@stylistic": plugins["@stylistic"] },
|
29
28
|
[],
|
29
|
+
F.files("js"),
|
30
|
+
R.ruleset("js"),
|
30
31
|
).configs,
|
31
32
|
ts: new Options
|
32
33
|
.ts(
|
33
|
-
F.files("ts"),
|
34
|
-
R.ruleset("ts"),
|
35
34
|
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] },
|
36
35
|
[parsers.ts],
|
36
|
+
F.files("ts"),
|
37
|
+
R.ruleset("ts"),
|
37
38
|
).configs,
|
38
39
|
svelte: new Options
|
39
40
|
.svelte(
|
40
|
-
F.files("svelte"),
|
41
|
-
R.ruleset("svelte"),
|
42
41
|
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte },
|
43
42
|
[parsers.svelte, parsers.ts],
|
43
|
+
F.files("svelte"),
|
44
|
+
R.ruleset("svelte"),
|
44
45
|
).configs,
|
45
46
|
mocha: new Options
|
46
47
|
.mocha(
|
47
|
-
F.files("mocha"),
|
48
|
-
R.ruleset("mocha"),
|
49
48
|
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha },
|
50
49
|
[parsers.ts],
|
50
|
+
F.files("mocha"),
|
51
|
+
R.ruleset("mocha"),
|
51
52
|
).configs,
|
52
53
|
html: new Options
|
53
54
|
.html(
|
54
|
-
F.files("html"),
|
55
|
-
R.ruleset("html"),
|
56
55
|
{ "@html-eslint": plugins["@html-eslint"] },
|
57
56
|
[parsers.html],
|
57
|
+
F.files("html"),
|
58
|
+
R.ruleset("html"),
|
58
59
|
).configs,
|
59
60
|
json: new Options
|
60
61
|
.json(
|
61
|
-
F.files("json"),
|
62
|
-
R.ruleset("json"),
|
63
62
|
{ jsonc: plugins.jsonc },
|
64
63
|
[parsers.jsonc],
|
64
|
+
F.files("json"),
|
65
|
+
R.ruleset("json"),
|
65
66
|
).configs,
|
66
67
|
jsonc: new Options
|
67
68
|
.jsonc(
|
68
|
-
F.files("jsonc"),
|
69
|
-
R.ruleset("jsonc"),
|
70
69
|
{ jsonc: plugins.jsonc },
|
71
70
|
[parsers.jsonc],
|
71
|
+
F.files("jsonc"),
|
72
|
+
R.ruleset("jsonc"),
|
72
73
|
).configs,
|
73
74
|
yml: new Options
|
74
75
|
.yml(
|
75
|
-
F.files("yml"),
|
76
|
-
R.ruleset("yml"),
|
77
76
|
{ yml: plugins.yml },
|
78
77
|
[parsers.yml],
|
78
|
+
F.files("yml"),
|
79
|
+
R.ruleset("yml"),
|
79
80
|
).configs,
|
80
81
|
md: new Options
|
81
82
|
.md(
|
82
|
-
F.files("md"),
|
83
|
-
R.ruleset("md"),
|
84
83
|
{ markdownlint: plugins.markdownlint },
|
85
84
|
[parsers.md],
|
85
|
+
F.files("md"),
|
86
|
+
R.ruleset("md"),
|
86
87
|
).configs,
|
87
88
|
};
|
88
89
|
|
@@ -91,8 +92,9 @@ export default function (
|
|
91
92
|
catch (e) { throw new Error(`linted-core`, { cause: e }); }
|
92
93
|
}
|
93
94
|
|
95
|
+
// #region DEPRECATED
|
94
96
|
namespace Core {
|
95
|
-
export type Scopes =
|
97
|
+
export type Scopes = typeof scopes[number];
|
96
98
|
export namespace Input {
|
97
99
|
export type Parsers = Input["parsers"];
|
98
100
|
export type Plugins = Input["plugins"];
|
@@ -111,3 +113,5 @@ namespace Core {
|
|
111
113
|
}
|
112
114
|
|
113
115
|
export type { Core };
|
116
|
+
|
117
|
+
// #endregion
|
@@ -0,0 +1,23 @@
|
|
1
|
+
export type { Scope } from "../scopes";
|
2
|
+
|
3
|
+
import type { PluginsInput } from "./plugins";
|
4
|
+
import type { ParsersInput } from "./parsers";
|
5
|
+
import type { FilesInput } from "./files";
|
6
|
+
import type { RulesInput } from "./rules";
|
7
|
+
|
8
|
+
export interface Input {
|
9
|
+
plugins: PluginsInput;
|
10
|
+
parsers: ParsersInput;
|
11
|
+
files: FilesInput;
|
12
|
+
rules: RulesInput;
|
13
|
+
}
|
14
|
+
export namespace Input {
|
15
|
+
export type Rule = RulesInput;
|
16
|
+
export namespace Rule {
|
17
|
+
export type Entry = RulesInput.Entry;
|
18
|
+
export namespace Entry {
|
19
|
+
export type Id = RulesInput.Entry.Id;
|
20
|
+
export type Record = RulesInput.Entry.Record;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { Scope } from "..";
|
2
|
+
import type { RuleEntry } from "./entry";
|
3
|
+
|
4
|
+
export interface RulesInput {
|
5
|
+
rules: Record<Scope, RuleEntry[]>;
|
6
|
+
overrides: Partial<Record<Scope, RuleEntry.Record>>;
|
7
|
+
}
|
8
|
+
export namespace RulesInput {
|
9
|
+
export type Entry = RuleEntry;
|
10
|
+
export namespace Entry {
|
11
|
+
export type Id = RuleEntry.Id;
|
12
|
+
export type Record = RuleEntry.Record;
|
13
|
+
}
|
14
|
+
}
|
package/src/output.ts
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
import type { Input } from "
|
1
|
+
import type { Input } from ".";
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
3
|
+
export type Output = (
|
4
|
+
{
|
5
|
+
name: `linted/${string}`;
|
6
|
+
rules: Input["rules"]["rules"]["html"][number][1];
|
7
|
+
files: string[];
|
8
|
+
linterOptions: {
|
9
|
+
noInlineConfig: true;
|
10
|
+
reportUnusedDisableDirectives: "error";
|
11
|
+
};
|
12
|
+
languageOptions: {
|
13
|
+
sourceType?:
|
14
|
+
| "module"
|
15
|
+
| "script";
|
16
|
+
ecmaVersion?: "latest";
|
17
|
+
globals?: Table<true>;
|
18
|
+
parser?: unknown;
|
19
|
+
parserOptions?: Record<string, unknown>; // TODO: Change to Table<unknown> after lib update
|
20
|
+
};
|
21
|
+
plugins: Table<Record<"configs", unknown>>;
|
22
|
+
processor?: string;
|
23
|
+
}
|
24
|
+
)[];
|
package/src/scopes.ts
CHANGED
package/tsconfig.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"display": "@jimbojet/tsc",
|
3
3
|
"$schema": "https://json.schemastore.org/tsconfig",
|
4
|
-
"_version": "5.6.1-core.
|
4
|
+
"_version": "5.6.1-core.1",
|
5
5
|
"include": [
|
6
6
|
"*.config.ts",
|
7
7
|
"src/**/*.ts",
|
@@ -10,7 +10,7 @@
|
|
10
10
|
],
|
11
11
|
"exclude": [],
|
12
12
|
"compilerOptions": {
|
13
|
-
/*
|
13
|
+
/* https://www.typescriptlang.org/tsconfig/#quick-nav-Top%20Level */
|
14
14
|
|
15
15
|
// #region TYPE CHECKING
|
16
16
|
"allowUnreachableCode": false,
|
@@ -41,7 +41,7 @@
|
|
41
41
|
// "allowUmdGlobalAccess": true,
|
42
42
|
// "baseUrl": "./",
|
43
43
|
// "customConditions": [],
|
44
|
-
"module": "
|
44
|
+
"module": "es2022",
|
45
45
|
"moduleResolution": "bundler",
|
46
46
|
// "moduleSuffixes": [],
|
47
47
|
// "noResolve": true,
|
@@ -118,7 +118,7 @@
|
|
118
118
|
"es2023",
|
119
119
|
/* {CONFIGURE} */
|
120
120
|
],
|
121
|
-
"moduleDetection": "
|
121
|
+
// "moduleDetection": "auto",
|
122
122
|
// "noLib": true,
|
123
123
|
// "reactNamespace": "",
|
124
124
|
"target": "es2022",
|
@@ -1 +0,0 @@
|
|
1
|
-
export type Ecma = "latest";
|
@@ -1 +0,0 @@
|
|
1
|
-
export type Source = "module" | "script";
|
@@ -1 +0,0 @@
|
|
1
|
-
export type Plugins<PluginId extends string> = Record<literalful<PluginId>, { configs: unknown }>;
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import type { Input } from "@eslinted/core";
|
2
|
-
import type { Scope } from "@eslinted/core";
|
3
|
-
import { Rule } from "./rule";
|
4
|
-
|
5
|
-
export { Rule };
|
6
|
-
export class Ruleset<S extends Scope> {
|
7
|
-
public readonly ruleset: readonly Rule[];
|
8
|
-
public overrides: Null<Rule> = null;
|
9
|
-
|
10
|
-
constructor(private readonly scope: literalful<S>, ...rules: readonly Rule[]) {
|
11
|
-
try {
|
12
|
-
this.ruleset = [...rules];
|
13
|
-
}
|
14
|
-
catch (e) { throw new Error(`linted.factory.Ruleset`, { cause: e }); }
|
15
|
-
}
|
16
|
-
|
17
|
-
public get id() {
|
18
|
-
const { scope } = this;
|
19
|
-
|
20
|
-
return scope;
|
21
|
-
}
|
22
|
-
|
23
|
-
public get records() {
|
24
|
-
try {
|
25
|
-
const { ruleset, overrides } = this;
|
26
|
-
|
27
|
-
return [
|
28
|
-
...ruleset.map(rules => [rules.id, rules.rules] as const),
|
29
|
-
...overrides === null ? [] : [[overrides.id, overrides.rules] as const] as const,
|
30
|
-
];
|
31
|
-
}
|
32
|
-
catch (e) { throw new Error(`linted.factory.Ruleset: records`, { cause: e }); }
|
33
|
-
}
|
34
|
-
|
35
|
-
public override(overrides: undefined | Input["rules"]["rules"][Scope][number][1]) {
|
36
|
-
if (typeof overrides !== "undefined")
|
37
|
-
this.overrides = new Rule("override", overrides);
|
38
|
-
|
39
|
-
return this;
|
40
|
-
}
|
41
|
-
}
|
package/src/factory/rulesets.ts
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
import type { Input } from "@eslinted/core";
|
2
|
-
import type { Scope } from "@eslinted/core";
|
3
|
-
import { Ruleset, Rule } from "./ruleset";
|
4
|
-
|
5
|
-
export class Rulesets {
|
6
|
-
constructor(private readonly input: Input["rules"]) {}
|
7
|
-
|
8
|
-
public ruleset<S extends Scope>(scope: literalful<S>): Ruleset<S> {
|
9
|
-
try {
|
10
|
-
const { rules, overrides } = this.input;
|
11
|
-
|
12
|
-
return new Ruleset<S>(scope, ...rules[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
|
-
}
|
package/src/input.ts
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { Plugins } from "./inputs/plugins";
|
2
|
-
import type { Parsers } from "./inputs/parsers";
|
3
|
-
import type { Files } from "./inputs/files";
|
4
|
-
import type { Rules } from "./inputs/rules";
|
5
|
-
|
6
|
-
export interface Input {
|
7
|
-
files: Files;
|
8
|
-
rules: Rules;
|
9
|
-
plugins: Plugins;
|
10
|
-
parsers: Parsers;
|
11
|
-
}
|
package/src/inputs/files/base.ts
DELETED
package/src/inputs/files.ts
DELETED
package/src/inputs/imports.ts
DELETED
package/src/inputs/parsers.ts
DELETED
package/src/inputs/plugins.ts
DELETED