@eslinted/core 13.2.0-rc.0 → 13.2.0-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/factory/factory.d.ts +37 -38
- package/dist/factory/factory.d.ts.map +1 -1
- package/dist/factory/factory.js +11 -6
- package/dist/factory/factory.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interface/input.d.ts +2 -1
- package/dist/interface/input.d.ts.map +1 -1
- package/dist/interface/output.d.ts +2 -1
- package/dist/interface/output.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/factory/factory.ts +20 -12
- package/src/index.ts +1 -2
- package/src/interface/input.ts +2 -5
- package/src/interface/output.ts +2 -4
- package/dist/factory/ruleset.d.ts +0 -10
- package/dist/factory/ruleset.d.ts.map +0 -1
- package/dist/factory/ruleset.js +0 -18
- package/dist/factory/ruleset.js.map +0 -1
- package/src/factory/ruleset.ts +0 -23
@@ -1,13 +1,12 @@
|
|
1
|
-
import type { Scopes } from "../index.js";
|
2
|
-
import type Core from "../index.js";
|
1
|
+
import type { Scopes, Rule, Input } from "../index.js";
|
3
2
|
import type Options from "./settings/index.js";
|
4
3
|
export declare class Factory {
|
5
|
-
readonly defaults:
|
4
|
+
readonly defaults: Input["defaults"];
|
6
5
|
readonly extensions: {
|
7
|
-
readonly global: NonNullable<
|
8
|
-
readonly scopes: Omit<
|
6
|
+
readonly global: NonNullable<Input["extensions"]["*"]>;
|
7
|
+
readonly scopes: Omit<Input["extensions"], "*">;
|
9
8
|
};
|
10
|
-
constructor(defaults:
|
9
|
+
constructor(defaults: Input["defaults"], { "*": global, ...scopes }?: Input["extensions"]);
|
11
10
|
get settings(): {
|
12
11
|
readonly name: "linted/*/settings";
|
13
12
|
readonly linterOptions: {
|
@@ -35,30 +34,30 @@ export declare class Factory {
|
|
35
34
|
};
|
36
35
|
readonly name: `linted/svelte:${string}` | `linted/mocha:${string}` | `linted/jsonc:${string}` | `linted/yml:${string}` | `linted/ts:${string}` | `linted/html:${string}` | `linted/js:${string}` | `linted/json:${string}`;
|
37
36
|
readonly files: readonly [
|
38
|
-
...Readonly<Record<"
|
37
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
39
38
|
...string[]
|
40
39
|
];
|
41
40
|
readonly ignores: readonly [
|
42
|
-
...Readonly<Record<"
|
41
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
43
42
|
...string[]
|
44
43
|
];
|
45
|
-
readonly rules: Readonly<Record<string,
|
46
|
-
|
44
|
+
readonly rules: Readonly<Record<string, Rule.State | readonly [
|
45
|
+
Rule.State,
|
47
46
|
...unknown[]
|
48
47
|
]>>;
|
49
48
|
} | {
|
50
49
|
readonly languageOptions: object;
|
51
50
|
readonly name: `linted/svelte:${string}` | `linted/mocha:${string}` | `linted/jsonc:${string}` | `linted/yml:${string}` | `linted/ts:${string}` | `linted/html:${string}` | `linted/js:${string}` | `linted/json:${string}`;
|
52
51
|
readonly files: readonly [
|
53
|
-
...Readonly<Record<"
|
52
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
54
53
|
...string[]
|
55
54
|
];
|
56
55
|
readonly ignores: readonly [
|
57
|
-
...Readonly<Record<"
|
56
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
58
57
|
...string[]
|
59
58
|
];
|
60
|
-
readonly rules: Readonly<Record<string,
|
61
|
-
|
59
|
+
readonly rules: Readonly<Record<string, Rule.State | readonly [
|
60
|
+
Rule.State,
|
62
61
|
...unknown[]
|
63
62
|
]>>;
|
64
63
|
} | {
|
@@ -78,15 +77,15 @@ export declare class Factory {
|
|
78
77
|
readonly processor: "svelte/svelte";
|
79
78
|
readonly name: `linted/svelte:${string}` | `linted/mocha:${string}` | `linted/jsonc:${string}` | `linted/yml:${string}` | `linted/ts:${string}` | `linted/html:${string}` | `linted/js:${string}` | `linted/json:${string}`;
|
80
79
|
readonly files: readonly [
|
81
|
-
...Readonly<Record<"
|
80
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
82
81
|
...string[]
|
83
82
|
];
|
84
83
|
readonly ignores: readonly [
|
85
|
-
...Readonly<Record<"
|
84
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
86
85
|
...string[]
|
87
86
|
];
|
88
|
-
readonly rules: Readonly<Record<string,
|
89
|
-
|
87
|
+
readonly rules: Readonly<Record<string, Rule.State | readonly [
|
88
|
+
Rule.State,
|
90
89
|
...unknown[]
|
91
90
|
]>>;
|
92
91
|
} | {
|
@@ -100,75 +99,75 @@ export declare class Factory {
|
|
100
99
|
};
|
101
100
|
readonly name: `linted/svelte:${string}` | `linted/mocha:${string}` | `linted/jsonc:${string}` | `linted/yml:${string}` | `linted/ts:${string}` | `linted/html:${string}` | `linted/js:${string}` | `linted/json:${string}`;
|
102
101
|
readonly files: readonly [
|
103
|
-
...Readonly<Record<"
|
102
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
104
103
|
...string[]
|
105
104
|
];
|
106
105
|
readonly ignores: readonly [
|
107
|
-
...Readonly<Record<"
|
106
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
108
107
|
...string[]
|
109
108
|
];
|
110
|
-
readonly rules: Readonly<Record<string,
|
111
|
-
|
109
|
+
readonly rules: Readonly<Record<string, Rule.State | readonly [
|
110
|
+
Rule.State,
|
112
111
|
...unknown[]
|
113
112
|
]>>;
|
114
113
|
} | {
|
115
114
|
readonly languageOptions: object;
|
116
115
|
readonly name: `linted/svelte:${string}` | `linted/mocha:${string}` | `linted/jsonc:${string}` | `linted/yml:${string}` | `linted/ts:${string}` | `linted/html:${string}` | `linted/js:${string}` | `linted/json:${string}`;
|
117
116
|
readonly files: readonly [
|
118
|
-
...Readonly<Record<"
|
117
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
119
118
|
...string[]
|
120
119
|
];
|
121
120
|
readonly ignores: readonly [
|
122
|
-
...Readonly<Record<"
|
121
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
123
122
|
...string[]
|
124
123
|
];
|
125
|
-
readonly rules: Readonly<Record<string,
|
126
|
-
|
124
|
+
readonly rules: Readonly<Record<string, Rule.State | readonly [
|
125
|
+
Rule.State,
|
127
126
|
...unknown[]
|
128
127
|
]>>;
|
129
128
|
} | {
|
130
129
|
readonly languageOptions: object;
|
131
130
|
readonly name: `linted/svelte:${string}` | `linted/mocha:${string}` | `linted/jsonc:${string}` | `linted/yml:${string}` | `linted/ts:${string}` | `linted/html:${string}` | `linted/js:${string}` | `linted/json:${string}`;
|
132
131
|
readonly files: readonly [
|
133
|
-
...Readonly<Record<"
|
132
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
134
133
|
...string[]
|
135
134
|
];
|
136
135
|
readonly ignores: readonly [
|
137
|
-
...Readonly<Record<"
|
136
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
138
137
|
...string[]
|
139
138
|
];
|
140
|
-
readonly rules: Readonly<Record<string,
|
141
|
-
|
139
|
+
readonly rules: Readonly<Record<string, Rule.State | readonly [
|
140
|
+
Rule.State,
|
142
141
|
...unknown[]
|
143
142
|
]>>;
|
144
143
|
} | {
|
145
144
|
readonly languageOptions: object;
|
146
145
|
readonly name: `linted/svelte:${string}` | `linted/mocha:${string}` | `linted/jsonc:${string}` | `linted/yml:${string}` | `linted/ts:${string}` | `linted/html:${string}` | `linted/js:${string}` | `linted/json:${string}`;
|
147
146
|
readonly files: readonly [
|
148
|
-
...Readonly<Record<"
|
147
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
149
148
|
...string[]
|
150
149
|
];
|
151
150
|
readonly ignores: readonly [
|
152
|
-
...Readonly<Record<"
|
151
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
153
152
|
...string[]
|
154
153
|
];
|
155
|
-
readonly rules: Readonly<Record<string,
|
156
|
-
|
154
|
+
readonly rules: Readonly<Record<string, Rule.State | readonly [
|
155
|
+
Rule.State,
|
157
156
|
...unknown[]
|
158
157
|
]>>;
|
159
158
|
} | {
|
160
159
|
readonly languageOptions: object;
|
161
160
|
readonly name: `linted/svelte:${string}` | `linted/mocha:${string}` | `linted/jsonc:${string}` | `linted/yml:${string}` | `linted/ts:${string}` | `linted/html:${string}` | `linted/js:${string}` | `linted/json:${string}`;
|
162
161
|
readonly files: readonly [
|
163
|
-
...Readonly<Record<"
|
162
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
164
163
|
...string[]
|
165
164
|
];
|
166
165
|
readonly ignores: readonly [
|
167
|
-
...Readonly<Record<"
|
166
|
+
...Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json" | "*", readonly string[]>>[S],
|
168
167
|
...string[]
|
169
168
|
];
|
170
|
-
readonly rules: Readonly<Record<string,
|
171
|
-
|
169
|
+
readonly rules: Readonly<Record<string, Rule.State | readonly [
|
170
|
+
Rule.State,
|
172
171
|
...unknown[]
|
173
172
|
]>>;
|
174
173
|
})[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/factory/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/factory/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,qBAAa,OAAO;aAOA,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC;IAN7C,SAAgB,UAAU,EAAE;QAC1B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACvD,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC;KACjD,CAAC;gBAGgB,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,EAC3C,EAAE,GAAG,EAAE,MAAW,EAAE,GAAG,MAAM,EAAE,GAAE,KAAK,CAAC,YAAY,CAAe;IAKpE,IAAW,QAAQ;;;;;;;;;;MAkBlB;IAED,IAAW,OAAO;;;MAkBjB;IAEM,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCnF"}
|
package/dist/factory/factory.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import { Ruleset } from "./ruleset.js";
|
2
1
|
export class Factory {
|
3
2
|
defaults;
|
4
3
|
extensions;
|
@@ -25,12 +24,18 @@ export class Factory {
|
|
25
24
|
};
|
26
25
|
}
|
27
26
|
scope(scope, settings) {
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
function Ruleset(scope, defaults, override) {
|
28
|
+
return [
|
29
|
+
...defaults.map(([id, rules]) => ({ id: `${scope}:${id}`, rules })),
|
30
|
+
...typeof override === "undefined"
|
31
|
+
? []
|
32
|
+
: [{ id: `${scope}:override`, rules: override }],
|
33
|
+
];
|
34
|
+
}
|
35
|
+
const { defaults: { files: { [scope]: defaultFiles }, ignores: { [scope]: defaultIgnores }, rules: { [scope]: defaultRules }, }, extensions: { scopes: { [scope]: scopeExtension = {} } }, } = this, { files: extendFiles = [], ignores: extendIgnores = [], rules: extendRules, } = scopeExtension, files = [...defaultFiles, ...extendFiles], ignores = [...defaultIgnores, ...extendIgnores], ruleset = Ruleset(scope, defaultRules, extendRules);
|
31
36
|
return files.length < 1
|
32
37
|
? []
|
33
|
-
: ruleset.
|
38
|
+
: ruleset.map(({ id, rules }) => ({
|
34
39
|
name: `linted/${id}`,
|
35
40
|
files,
|
36
41
|
ignores,
|
@@ -39,4 +44,4 @@ export class Factory {
|
|
39
44
|
}));
|
40
45
|
}
|
41
46
|
}
|
42
|
-
//# sourceMappingURL=factory.js.map
|
47
|
+
//# sourceMappingURL=factory.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/factory/factory.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/factory/factory.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import type { Input, Output } from "./interface/index.js";
|
2
|
-
import type { Scopes, Plugins, Parsers } from "./scopes/index.js";
|
3
2
|
export type * from "./interface/index.js";
|
4
3
|
export type * from "./scopes/index.js";
|
5
|
-
export default function ({ imports: { plugins, parsers }, defaults, extensions, }: Input
|
4
|
+
export default function ({ imports: { plugins, parsers }, defaults, extensions, }: Input): Output;
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIjD,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,UAAU,CAAC;AAC9B,MAAM,CAAC,OAAO,WAAW,EACvB,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAC7B,QAAQ,EACR,UAAU,GACX,EAAE,KAAK,GAAG,MAAM,CAwBhB"}
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAI7C,MAAM,CAAC,OAAO,WAAW,EACvB,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAC7B,QAAQ,EACR,UAAU,GACJ;IACN,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,EACjD,OAAO,GAA+E;YACpF,EAAE,EAAE,IAAI,OAAO,CAAC,EAAE,CAAC,EAAW,CAAC;YAC/B,EAAE,EAAE,IAAI,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAU,CAAC;YACzC,MAAM,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAU,CAAC;YACjE,KAAK,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAU,CAAC;YAC/C,IAAI,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAU,CAAC;YAC/C,IAAI,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAU,CAAC;YAChD,KAAK,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAU,CAAC;YAClD,GAAG,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAU,CAAC;SACpC,CAAC;QAEX,OAAO;YACL,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAW;YAC9C,OAAO,CAAC,QAAQ;YAChB,OAAO,CAAC,OAAO;YACf,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;SACxD,CAAC;IACb,CAAC;IACD,OAAO,CAAC,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
@@ -1,5 +1,6 @@
|
|
1
|
+
import type { Scopes, Plugins, Parsers } from "../scopes/index.js";
|
1
2
|
import type * as Inputs from "./inputs/index.js";
|
2
|
-
export interface Input
|
3
|
+
export interface Input {
|
3
4
|
readonly imports: Inputs.Imports<Plugins, Parsers>;
|
4
5
|
readonly defaults: Inputs.Defaults<Scopes>;
|
5
6
|
readonly extensions: Inputs.Extensions<Scopes>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/interface/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/interface/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAC9B,OAAO,EACP,OAAO,CACR,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;CAChD"}
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import type { Scopes, Plugins } from "../scopes/index.js";
|
1
2
|
import type * as Configs from "./outputs/index.js";
|
2
3
|
export type { Configs };
|
3
|
-
export type Output
|
4
|
+
export type Output = readonly [
|
4
5
|
Configs.Common.Plugins<Plugins>,
|
5
6
|
Configs.Common.Settings,
|
6
7
|
Configs.Common.Ignores,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/interface/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,WAAW,CAAC;AAE1C,YAAY,EAAE,OAAO,EAAE,CAAC;AACxB,MAAM,MAAM,MAAM,
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/interface/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,KAAK,OAAO,MAAM,WAAW,CAAC;AAE1C,YAAY,EAAE,OAAO,EAAE,CAAC;AACxB,MAAM,MAAM,MAAM,GAAG,SAAS;IAC5B,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ;IACvB,OAAO,CAAC,MAAM,CAAC,OAAO;IACtB,GAAG,SAAS,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;CACrC,CAAC"}
|
package/package.json
CHANGED
package/src/factory/factory.ts
CHANGED
@@ -1,17 +1,15 @@
|
|
1
|
-
import type { Scopes } from "..";
|
2
|
-
import type Core from "..";
|
3
|
-
import { Ruleset } from "./ruleset";
|
1
|
+
import type { Scopes, Rule, Input } from "..";
|
4
2
|
import type Options from "./settings";
|
5
3
|
|
6
4
|
export class Factory {
|
7
5
|
public readonly extensions: {
|
8
|
-
readonly global: NonNullable<
|
9
|
-
readonly scopes: Omit<
|
6
|
+
readonly global: NonNullable<Input["extensions"]["*"]>;
|
7
|
+
readonly scopes: Omit<Input["extensions"], "*">;
|
10
8
|
};
|
11
9
|
|
12
10
|
constructor(
|
13
|
-
public readonly defaults:
|
14
|
-
{ "*": global = {}, ...scopes }:
|
11
|
+
public readonly defaults: Input["defaults"],
|
12
|
+
{ "*": global = {}, ...scopes }: Input["extensions"] = {} as const,
|
15
13
|
) {
|
16
14
|
this.extensions = { global, scopes } as const;
|
17
15
|
}
|
@@ -57,6 +55,19 @@ export class Factory {
|
|
57
55
|
}
|
58
56
|
|
59
57
|
public scope<S extends Scopes>(scope: S, settings: InstanceType<typeof Options[S]>) {
|
58
|
+
function Ruleset<Scopes extends string>(
|
59
|
+
scope: Scopes,
|
60
|
+
defaults: readonly Rule.NamedBag[],
|
61
|
+
override?: Rule.Bag,
|
62
|
+
) {
|
63
|
+
return [
|
64
|
+
...defaults.map(([id, rules]: Rule.NamedBag) => ({ id: `${scope}:${id}`, rules } as const)),
|
65
|
+
...typeof override === "undefined"
|
66
|
+
? [] as const
|
67
|
+
: [{ id: `${scope}:override`, rules: override } as const] as const,
|
68
|
+
] as const;
|
69
|
+
}
|
70
|
+
|
60
71
|
const {
|
61
72
|
defaults: {
|
62
73
|
files: { [scope]: defaultFiles },
|
@@ -72,14 +83,11 @@ export class Factory {
|
|
72
83
|
} = scopeExtension,
|
73
84
|
files = [...defaultFiles, ...extendFiles] as const,
|
74
85
|
ignores = [...defaultIgnores, ...extendIgnores] as const,
|
75
|
-
ruleset =
|
76
|
-
|
77
|
-
if (ruleset.scope !== settings.scope)
|
78
|
-
throw new TypeError(`Scope mismatch between config "${settings.scope} and inner ruleset "${ruleset.scope}"`);
|
86
|
+
ruleset = Ruleset<Scopes>(scope, defaultRules, extendRules);
|
79
87
|
|
80
88
|
return files.length < 1
|
81
89
|
? [] as const
|
82
|
-
: ruleset.
|
90
|
+
: ruleset.map(({ id, rules }) => ({
|
83
91
|
name: `linted/${id}`,
|
84
92
|
files,
|
85
93
|
ignores,
|
package/src/index.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import type { Input, Output } from "./interface";
|
2
|
-
import type { Scopes, Plugins, Parsers } from "./scopes";
|
3
2
|
import { scopes } from "./scopes";
|
4
3
|
import { Factory, Options } from "./factory";
|
5
4
|
|
@@ -9,7 +8,7 @@ export default function ({
|
|
9
8
|
imports: { plugins, parsers },
|
10
9
|
defaults,
|
11
10
|
extensions,
|
12
|
-
}: Input
|
11
|
+
}: Input): Output {
|
13
12
|
try {
|
14
13
|
const factory = new Factory(defaults, extensions),
|
15
14
|
options: { readonly [S in typeof scopes[number]]: InstanceType<typeof Options[S]> } = {
|
package/src/interface/input.ts
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
+
import type { Scopes, Plugins, Parsers } from "../scopes";
|
1
2
|
import type * as Inputs from "./inputs";
|
2
3
|
|
3
|
-
export interface Input
|
4
|
-
Scopes extends string,
|
5
|
-
Plugins extends string,
|
6
|
-
Parsers extends string,
|
7
|
-
> {
|
4
|
+
export interface Input {
|
8
5
|
readonly imports: Inputs.Imports<
|
9
6
|
Plugins,
|
10
7
|
Parsers
|
package/src/interface/output.ts
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
+
import type { Scopes, Plugins } from "../scopes";
|
1
2
|
import type * as Configs from "./outputs";
|
2
3
|
|
3
4
|
export type { Configs };
|
4
|
-
export type Output
|
5
|
-
Scopes extends string,
|
6
|
-
Plugins extends string,
|
7
|
-
> = readonly [
|
5
|
+
export type Output = readonly [
|
8
6
|
Configs.Common.Plugins<Plugins>,
|
9
7
|
Configs.Common.Settings,
|
10
8
|
Configs.Common.Ignores,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { Rule } from "../index.js";
|
2
|
-
export declare class Ruleset<Scopes extends string> {
|
3
|
-
readonly scope: Scopes;
|
4
|
-
readonly ruleset: {
|
5
|
-
id: `${Scopes}:${string}`;
|
6
|
-
rules: Rule.Bag;
|
7
|
-
}[];
|
8
|
-
constructor(scope: Scopes, defaults: readonly Rule.NamedBag[], override?: Rule.Bag);
|
9
|
-
}
|
10
|
-
//# sourceMappingURL=ruleset.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ruleset.d.ts","sourceRoot":"","sources":["../../src/factory/ruleset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B,qBAAa,OAAO,CAAC,MAAM,SAAS,MAAM;aAItB,KAAK,EAAE,MAAM;IAH/B,SAAgB,OAAO,EAAE;QAAE,EAAE,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAA;KAAE,EAAE,CAAC;gBAGxD,KAAK,EAAE,MAAM,EAC7B,QAAQ,EAAE,SAAS,IAAI,CAAC,QAAQ,EAAE,EAClC,QAAQ,CAAC,EAAE,IAAI,CAAC,GAAG;CActB"}
|
package/dist/factory/ruleset.js
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
export class Ruleset {
|
2
|
-
scope;
|
3
|
-
ruleset;
|
4
|
-
constructor(scope, defaults, override) {
|
5
|
-
this.scope = scope;
|
6
|
-
const map = ([id, rules]) => ({
|
7
|
-
id: `${scope}:${id}`,
|
8
|
-
rules,
|
9
|
-
});
|
10
|
-
this.ruleset = [
|
11
|
-
...defaults.map(rule => map(rule)),
|
12
|
-
...typeof override === "undefined"
|
13
|
-
? []
|
14
|
-
: [map([`${scope}:override`, override])],
|
15
|
-
];
|
16
|
-
}
|
17
|
-
}
|
18
|
-
//# sourceMappingURL=ruleset.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ruleset.js","sourceRoot":"","sources":["../../src/factory/ruleset.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,OAAO;IAIA;IAHF,OAAO,CAAmD;IAE1E,YACkB,KAAa,EAC7B,QAAkC,EAClC,QAAmB;QAFH,UAAK,GAAL,KAAK,CAAQ;QAI7B,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,CAAgB,EAAE,EAAE,CAAC,CAAC;YAC3C,EAAE,EAAE,GAAG,KAAK,IAAI,EAAE,EAAE;YACpB,KAAK;SACI,CAAA,CAAC;QAEZ,IAAI,CAAC,OAAO,GAAG;YACb,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClC,GAAG,OAAO,QAAQ,KAAK,WAAW;gBAChC,CAAC,CAAC,EAAW;gBACb,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAU;SAC3C,CAAC;IACb,CAAC;CACF"}
|
package/src/factory/ruleset.ts
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
import type { Rule } from "..";
|
2
|
-
|
3
|
-
export class Ruleset<Scopes extends string> {
|
4
|
-
public readonly ruleset: { id: `${Scopes}:${string}`; rules: Rule.Bag }[];
|
5
|
-
|
6
|
-
constructor(
|
7
|
-
public readonly scope: Scopes,
|
8
|
-
defaults: readonly Rule.NamedBag[],
|
9
|
-
override?: Rule.Bag,
|
10
|
-
) {
|
11
|
-
const map = ([id, rules]: Rule.NamedBag) => ({
|
12
|
-
id: `${scope}:${id}`,
|
13
|
-
rules,
|
14
|
-
} as const);
|
15
|
-
|
16
|
-
this.ruleset = [
|
17
|
-
...defaults.map(rule => map(rule)),
|
18
|
-
...typeof override === "undefined"
|
19
|
-
? [] as const
|
20
|
-
: [map([`${scope}:override`, override])] as const,
|
21
|
-
] as const;
|
22
|
-
}
|
23
|
-
}
|