@eslinted/core 16.2.5 → 17.0.1
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/README.md +1 -1
- package/dist/factory/index.d.ts +4 -4
- package/dist/factory/index.js +6 -6
- package/dist/factory/index.js.map +1 -1
- package/dist/index.input.spec.d.ts +3 -0
- package/dist/index.input.spec.d.ts.map +1 -0
- package/dist/{test/input.js → index.input.spec.js} +65 -27
- package/dist/index.input.spec.js.map +1 -0
- package/dist/index.spec.js +1 -1
- package/dist/index.spec.js.map +1 -1
- package/dist/interface/input/scopes/defaults.d.ts +1 -1
- package/dist/interface/input/scopes/defaults.d.ts.map +1 -1
- package/dist/interface/input/scopes/extensions.d.ts +1 -1
- package/dist/interface/input/scopes/extensions.d.ts.map +1 -1
- package/dist/interface/shared/config/index.d.ts +1 -1
- package/dist/interface/shared/config/index.d.ts.map +1 -1
- package/dist/interface/shared/config/rule/index.d.ts +6 -6
- package/dist/interface/shared/config/rule/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/factory/index.ts +8 -8
- package/src/{test/input.ts → index.input.spec.ts} +65 -27
- package/src/index.spec.ts +1 -1
- package/src/interface/input/scopes/defaults.ts +1 -1
- package/src/interface/input/scopes/extensions.ts +1 -1
- package/src/interface/shared/config/index.ts +1 -1
- package/src/interface/shared/config/rule/index.ts +8 -8
- package/dist/test/input.d.ts +0 -3
- package/dist/test/input.d.ts.map +0 -1
- package/dist/test/input.js.map +0 -1
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
# [`@eslinted/core`](https://www.npmjs.com/package/@eslinted/core)
|
2
2
|
[](https://github.com/jimmy-zhening-luo/linted-core/actions/workflows/RELEASE.yml)
|
3
3
|
|
4
|
-
|
4
|
+
Internal core for npm package `linted`, responsible for producing an array of fully-formed ESLint configurations according to `linted` spec.
|
package/dist/factory/index.d.ts
CHANGED
@@ -12,7 +12,7 @@ export declare class Factory {
|
|
12
12
|
};
|
13
13
|
readonly languageOptions: {
|
14
14
|
readonly sourceType: "module" | "script";
|
15
|
-
readonly ecmaVersion:
|
15
|
+
readonly ecmaVersion: "latest" | 3 | 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024;
|
16
16
|
};
|
17
17
|
};
|
18
18
|
readonly ignores: {
|
@@ -23,7 +23,7 @@ export declare class Factory {
|
|
23
23
|
readonly scopes: {
|
24
24
|
readonly files: Readonly<Record<"mocha" | "svelte" | "css" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>;
|
25
25
|
readonly ignores: Readonly<Record<"*" | "mocha" | "svelte" | "css" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>;
|
26
|
-
readonly rules: Readonly<Record<"mocha" | "svelte" | "css" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", import("../interface/shared/config/rule/index.js").
|
26
|
+
readonly rules: Readonly<Record<"mocha" | "svelte" | "css" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", import("../interface/shared/config/rule/index.js").NamedRuleBag[]>>;
|
27
27
|
};
|
28
28
|
constructor(tree: typeof Tree, parsers: Input["imports"]["parsers"], { settings: defaultSettings, files: defaultFiles, ignores: defaultIgnores, rules: defaultRules, }: Input["defaults"], { "*": commonExtension, ...scopeExtensions }?: Input["extensions"]);
|
29
29
|
scope<S extends keyof typeof ScopeManifests>(scope: S): readonly [
|
@@ -31,8 +31,8 @@ export declare class Factory {
|
|
31
31
|
readonly name: `linted/${S}/${string}/`;
|
32
32
|
readonly files: Readonly<Record<"mocha" | "svelte" | "css" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>[S];
|
33
33
|
readonly ignores: Readonly<Record<"*" | "mocha" | "svelte" | "css" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>[S];
|
34
|
-
readonly rules: Readonly<Record<string, import("../interface/shared/config/rule/index.js").
|
35
|
-
import("../interface/shared/config/rule/index.js").
|
34
|
+
readonly rules: Readonly<Record<string, import("../interface/shared/config/rule/index.js").RuleState | readonly [
|
35
|
+
import("../interface/shared/config/rule/index.js").RuleState,
|
36
36
|
...unknown[]
|
37
37
|
]>>;
|
38
38
|
} | {
|
package/dist/factory/index.js
CHANGED
@@ -27,11 +27,11 @@ export class Factory {
|
|
27
27
|
rules: defaultRules,
|
28
28
|
};
|
29
29
|
for (const scope in scopeExtensions) {
|
30
|
-
const { [scope]: { files:
|
31
|
-
this.scopes.files[scope].push(...
|
32
|
-
this.scopes.ignores[scope].push(...
|
33
|
-
if (
|
34
|
-
this.scopes.rules[scope].push(
|
30
|
+
const { [scope]: { files: userFiles = [], ignores: userIgnores = [], rules: userRules = null, } = {}, } = scopeExtensions;
|
31
|
+
this.scopes.files[scope].push(...userFiles);
|
32
|
+
this.scopes.ignores[scope].push(...userIgnores);
|
33
|
+
if (userRules !== null)
|
34
|
+
this.scopes.rules[scope].push({ id: `${scope}/override`, rules: userRules });
|
35
35
|
}
|
36
36
|
tree.forEach(([scope, parents]) => {
|
37
37
|
parents.forEach(parent => {
|
@@ -41,7 +41,7 @@ export class Factory {
|
|
41
41
|
});
|
42
42
|
}
|
43
43
|
scope(scope) {
|
44
|
-
const { files: { [scope]: files }, ignores: { [scope]: ignores }, rules: { [scope]: rules }, } = this.scopes, ruleset = rules.map((
|
44
|
+
const { files: { [scope]: files }, ignores: { [scope]: ignores }, rules: { [scope]: rules }, } = this.scopes, ruleset = rules.map(({ id, rules }) => ({ id: `${scope}/${id}`, rules })), { languageOptions: { parser = null, globals: global = null, ...languageOptionsStatic }, parserOptions: { parser: subparser = null, ...parserOptionsStatic }, processor, language, } = new ScopeManifests[scope]();
|
45
45
|
return files.length < 1
|
46
46
|
? []
|
47
47
|
: ruleset.length < 1
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,cA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,EAAE,OAAO,CAAC,MAA8B,CAAC,EAAW,CAAC,CAAC,CAAC,EAAW;4BACrH,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAW;4BAC5E,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,KAAK,IAAI;gCAClE,CAAC,CAAC,EAAW;gCACb,CAAC,CAAC;oCACE,aAAa,EAAE;wCACb,GAAG,mBAAmB;wCACtB,GAAG,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,EAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAW;qCAC1E;iCACF;yBACN;wBACV,GAAG,SAAS;wBACZ,GAAG,QAAQ;qBACH;oBACV,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;wBACjC,IAAI,EAAE,UAAU,EAAE,GAAG;wBACrB,KAAK;wBACL,OAAO;wBACP,KAAK;qBACI,CAAA,CAAC;iBACb,CAAC;IACV,CAAC;CACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.input.spec.d.ts","sourceRoot":"","sources":["../src/index.input.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,GAAG,CAAC;AAO1B,eAAO,MAAM,SAAS,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CA8IvC,CAAC"}
|
@@ -54,54 +54,92 @@ export const TestInput = {
|
|
54
54
|
},
|
55
55
|
rules: {
|
56
56
|
js: [
|
57
|
-
|
58
|
-
"enable",
|
59
|
-
{
|
57
|
+
{
|
58
|
+
id: "enable",
|
59
|
+
rules: {
|
60
60
|
vanilla: ERROR,
|
61
61
|
vanilla0: ERROR,
|
62
62
|
vanilla1: ERROR,
|
63
63
|
vanilla2: ERROR,
|
64
64
|
},
|
65
|
-
|
66
|
-
|
65
|
+
},
|
66
|
+
{
|
67
|
+
id: "enable/stylistic",
|
68
|
+
rules: { "@stylistic/style-rule": ERROR },
|
69
|
+
},
|
67
70
|
],
|
68
71
|
ts: [
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
72
|
+
{
|
73
|
+
id: "disable",
|
74
|
+
rules: { vanilla0: OFF },
|
75
|
+
},
|
76
|
+
{
|
77
|
+
id: "enable/extension",
|
78
|
+
rules: {
|
74
79
|
"@typescript-eslint/enums": ERROR,
|
75
80
|
"@typescript-eslint/destructure-expression": ERROR,
|
76
81
|
"@typescript-eslint/global": ERROR,
|
77
82
|
},
|
78
|
-
|
83
|
+
},
|
79
84
|
],
|
80
85
|
mocha: [
|
81
|
-
|
82
|
-
|
83
|
-
|
86
|
+
{
|
87
|
+
id: "disable",
|
88
|
+
rules: { vanilla2: OFF },
|
89
|
+
},
|
90
|
+
{
|
91
|
+
id: "disable/ts",
|
92
|
+
rules: { "@typescript-eslint/global": ERROR },
|
93
|
+
},
|
94
|
+
{
|
95
|
+
id: "enable",
|
96
|
+
rules: { "mocha/test-expression": ERROR },
|
97
|
+
},
|
84
98
|
],
|
85
99
|
svelte: [
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
100
|
+
{
|
101
|
+
id: "disable",
|
102
|
+
rules: { vanilla1: OFF },
|
103
|
+
},
|
104
|
+
{
|
105
|
+
id: "enable-extension",
|
106
|
+
rules: { "svelte/tags": ERROR },
|
107
|
+
},
|
108
|
+
],
|
109
|
+
html: [
|
110
|
+
{
|
111
|
+
id: "enable",
|
112
|
+
rules: { "html/attribute": ERROR },
|
113
|
+
},
|
114
|
+
],
|
115
|
+
css: [
|
116
|
+
{
|
117
|
+
id: "enable",
|
118
|
+
rules: { "css/property": ERROR },
|
119
|
+
},
|
90
120
|
],
|
91
|
-
html: [["enable", { "html/attribute": ERROR }]],
|
92
|
-
css: [["enable", { "css/property": ERROR }]],
|
93
121
|
json: [
|
94
|
-
|
95
|
-
"enable",
|
96
|
-
{
|
122
|
+
{
|
123
|
+
id: "enable",
|
124
|
+
rules: {
|
97
125
|
"jsonc/property-check": ERROR,
|
98
126
|
"jsonc/trailing-comma": [ERROR, "always"],
|
99
127
|
},
|
100
|
-
|
128
|
+
},
|
129
|
+
],
|
130
|
+
jsonc: [
|
131
|
+
{
|
132
|
+
id: "override",
|
133
|
+
rules: { "jsonc/trailing-comma": [ERROR, "never"] },
|
134
|
+
},
|
135
|
+
],
|
136
|
+
yml: [
|
137
|
+
{
|
138
|
+
id: "enable",
|
139
|
+
rules: { "yml/property-check": ERROR },
|
140
|
+
},
|
101
141
|
],
|
102
|
-
jsonc: [["override", { "jsonc/trailing-comma": [ERROR, "never"] }]],
|
103
|
-
yml: [["enable", { "yml/property-check": ERROR }]],
|
104
142
|
},
|
105
143
|
},
|
106
144
|
};
|
107
|
-
//# sourceMappingURL=input.js.map
|
145
|
+
//# sourceMappingURL=index.input.spec.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.input.spec.js","sourceRoot":"","sources":["../src/index.input.spec.ts"],"names":[],"mappings":"AAEA,MACA,KAAK,GAAG,OAAO,EACf,GAAG,GAAG,KAAK,EACX,MAAM,GAAG,aAAa,CAAC;AAEvB,MAAM,CAAC,MAAM,SAAS,GAA+B;IACnD,OAAO,EAAE;QACP,OAAO,EAAE;YACP,YAAY,EAAE,MAAM;YACpB,oBAAoB,EAAE,MAAM;YAC5B,KAAK,EAAE,MAAM;YACb,eAAe,EAAE,MAAM;YACvB,aAAa,EAAE,MAAM;YACrB,MAAM,EAAE,MAAM;YACd,cAAc,EAAE,MAAM;YACtB,GAAG,EAAE,MAAM;YACX,KAAK,EAAE,MAAM;YACb,GAAG,EAAE,MAAM;SACH;QACV,OAAO,EAAE;YACP,EAAE,EAAE,YAAY;YAChB,MAAM,E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gBACL;oBACE,EAAE,EAAE,UAAU;oBACd,KAAK,EAAE,EAAE,sBAAsB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE;iBAC3C;aACX;YACD,GAAG,EAAE;gBACH;oBACE,EAAE,EAAE,QAAQ;oBACZ,KAAK,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE;iBAC9B;aACX;SACO;KACF;CACF,CAAC"}
|
package/dist/index.spec.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { expect } from "chai";
|
2
2
|
import core from "./index.js";
|
3
3
|
import { scopes } from "./scopes/index.js";
|
4
|
-
import { TestInput } from "./
|
4
|
+
import { TestInput } from "./index.input.spec.js";
|
5
5
|
const configs = core(TestInput);
|
6
6
|
describe("Core", function () {
|
7
7
|
describe("shape", function () {
|
package/dist/index.spec.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,IAAI,MAAM,GAAG,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,IAAI,MAAM,GAAG,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;AAEhC,QAAQ,CAAC,MAAM,EAAE;IACf,QAAQ,CAAC,OAAO,EAAE;QAChB,EAAE,CAAC,eAAe,EAAE;YAClB,MAAM,CAAC,IAAI,CAAC;iBACT,CAA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,CAAC,CAAC;iBACf,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YACrC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBACf,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC;iBAC7B,EAAE,CAAC,QAAQ,CAAC,CAAC;YAChB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBACf,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,CAAC;iBACjD,CAAC,CAAC,QAAQ,CAAC,CAAC;YACf,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBACf,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -3,6 +3,6 @@ export interface Defaults<Scopes extends string> {
|
|
3
3
|
readonly settings: Config["linterOptions"] & Config["languageOptions"];
|
4
4
|
readonly files: Readonly<Record<Scopes, string[]>>;
|
5
5
|
readonly ignores: Readonly<Record<"*" | Scopes, string[]>>;
|
6
|
-
readonly rules: Readonly<Record<Scopes, Rule.
|
6
|
+
readonly rules: Readonly<Record<Scopes, Rule.NamedRuleBag[]>>;
|
7
7
|
}
|
8
8
|
//# sourceMappingURL=defaults.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../src/interface/input/scopes/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,QAAQ,CAAC,MAAM,SAAS,MAAM;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACvE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../src/interface/input/scopes/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,QAAQ,CAAC,MAAM,SAAS,MAAM;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACvE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;CAC/D"}
|
@@ -7,6 +7,6 @@ export type Extensions<Scopes extends string> = ({
|
|
7
7
|
} & Partial<Record<Scopes, {
|
8
8
|
readonly files?: Defaults<Scopes>["files"][Scopes];
|
9
9
|
readonly ignores?: Defaults<Scopes>["ignores"][Scopes];
|
10
|
-
readonly rules?: Defaults<Scopes>["rules"][Scopes][number][
|
10
|
+
readonly rules?: Defaults<Scopes>["rules"][Scopes][number]["rules"];
|
11
11
|
}>>);
|
12
12
|
//# sourceMappingURL=extensions.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../../src/interface/input/scopes/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,MAAM,IAAI,CAC5C;IACA,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG;QACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;KACrD,CAAC;CACH,GACC,OAAO,CAAC,MAAM,CACd,MAAM,EACN;IACE,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;IACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IACvD,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../../src/interface/input/scopes/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,MAAM,IAAI,CAC5C;IACA,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG;QACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;KACrD,CAAC;CACH,GACC,OAAO,CAAC,MAAM,CACd,MAAM,EACN;IACE,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;IACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IACvD,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;CACrE,CACF,CAAC,CACH,CAAC"}
|
@@ -6,7 +6,7 @@ export interface Config<Plugins extends string = string> {
|
|
6
6
|
readonly plugins: Readonly<Record<Plugins, unknown>>;
|
7
7
|
readonly files: readonly string[];
|
8
8
|
readonly ignores: readonly string[];
|
9
|
-
readonly rules: Rule.
|
9
|
+
readonly rules: Rule.RuleBag;
|
10
10
|
readonly linterOptions: {
|
11
11
|
readonly noInlineConfig: boolean;
|
12
12
|
readonly reportUnusedDisableDirectives: "error" | "warn" | "off";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interface/shared/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,QAAQ,CAAC;AAEpC,mBAAmB,WAAW,CAAC;AAC/B,YAAY,EAAE,IAAI,EAAE,CAAC;AACrB,MAAM,WAAW,MAAM,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACrD,QAAQ,CAAC,IAAI,EAAE,CACX,SAAS,GACT,UAAU,MAAM,GAAG,CACtB,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,QAAQ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C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACvD"}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
export
|
2
|
-
string
|
3
|
-
|
4
|
-
|
5
|
-
export type
|
6
|
-
export type
|
1
|
+
export interface NamedRuleBag {
|
2
|
+
id: string;
|
3
|
+
readonly rules: RuleBag;
|
4
|
+
}
|
5
|
+
export type RuleBag = Readonly<Record<string, RuleState | readonly [RuleState, ...readonly unknown[]]>>;
|
6
|
+
export type RuleState = ("error" | "warn" | "off");
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/interface/shared/config/rule/index.ts"],"names":[],"mappings":"AAAA,MAAM,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/interface/shared/config/rule/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AACD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CACnC,MAAM,EACJ,SAAS,GACT,SAAS,CAAC,SAAS,EAAE,GAAG,SAAS,OAAO,EAAE,CAAC,CAC9C,CAAC,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CACpB,OAAO,GACP,MAAM,GACN,KAAK,CACR,CAAC"}
|
package/package.json
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
"$schema": "https://json.schemastore.org/package",
|
4
4
|
"$help": "https://docs.npmjs.com/cli/configuring-npm/package-json",
|
5
5
|
"name": "@eslinted/core",
|
6
|
-
"version": "
|
7
|
-
"description": "
|
6
|
+
"version": "17.0.1",
|
7
|
+
"description": "Internal core for npm package `linted`, responsible for producing an array of fully-formed ESLint configurations according to `linted` spec.",
|
8
8
|
"repository": "github:jimmy-zhening-luo/linted-core",
|
9
9
|
"license": "MIT",
|
10
10
|
"private": false,
|
package/src/factory/index.ts
CHANGED
@@ -53,17 +53,17 @@ export class Factory {
|
|
53
53
|
for (const scope in scopeExtensions) {
|
54
54
|
const {
|
55
55
|
[scope as keyof typeof scopeExtensions]: {
|
56
|
-
files:
|
57
|
-
ignores:
|
58
|
-
rules:
|
56
|
+
files: userFiles = [],
|
57
|
+
ignores: userIgnores = [],
|
58
|
+
rules: userRules = null,
|
59
59
|
} = {} as const,
|
60
60
|
} = scopeExtensions;
|
61
61
|
|
62
|
-
this.scopes.files[scope as keyof typeof scopeExtensions].push(...
|
63
|
-
this.scopes.ignores[scope as keyof typeof scopeExtensions].push(...
|
62
|
+
this.scopes.files[scope as keyof typeof scopeExtensions].push(...userFiles);
|
63
|
+
this.scopes.ignores[scope as keyof typeof scopeExtensions].push(...userIgnores);
|
64
64
|
|
65
|
-
if (
|
66
|
-
this.scopes.rules[scope as keyof typeof scopeExtensions].push(
|
65
|
+
if (userRules !== null)
|
66
|
+
this.scopes.rules[scope as keyof typeof scopeExtensions].push({ id: `${scope}/override`, rules: userRules } as const);
|
67
67
|
}
|
68
68
|
|
69
69
|
tree.forEach(([scope, parents]) => {
|
@@ -84,7 +84,7 @@ export class Factory {
|
|
84
84
|
ignores: { [scope]: ignores },
|
85
85
|
rules: { [scope]: rules },
|
86
86
|
} = this.scopes,
|
87
|
-
ruleset = rules.map((
|
87
|
+
ruleset = rules.map(({ id, rules }) => ({ id: `${scope}/${id}`, rules } as const)),
|
88
88
|
{
|
89
89
|
languageOptions: {
|
90
90
|
parser = null,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type Core from "
|
1
|
+
import type Core from ".";
|
2
2
|
|
3
3
|
const
|
4
4
|
ERROR = "error",
|
@@ -60,53 +60,91 @@ export const TestInput: Parameters<typeof Core>[0] = {
|
|
60
60
|
} as const,
|
61
61
|
rules: {
|
62
62
|
js: [
|
63
|
-
|
64
|
-
"enable",
|
65
|
-
{
|
63
|
+
{
|
64
|
+
id: "enable",
|
65
|
+
rules: {
|
66
66
|
vanilla: ERROR,
|
67
67
|
vanilla0: ERROR,
|
68
68
|
vanilla1: ERROR,
|
69
69
|
vanilla2: ERROR,
|
70
70
|
},
|
71
|
-
|
72
|
-
|
71
|
+
} as const,
|
72
|
+
{
|
73
|
+
id: "enable/stylistic",
|
74
|
+
rules: { "@stylistic/style-rule": ERROR },
|
75
|
+
} as const,
|
73
76
|
],
|
74
77
|
ts: [
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
78
|
+
{
|
79
|
+
id: "disable",
|
80
|
+
rules: { vanilla0: OFF },
|
81
|
+
} as const,
|
82
|
+
{
|
83
|
+
id: "enable/extension",
|
84
|
+
rules: {
|
80
85
|
"@typescript-eslint/enums": ERROR,
|
81
86
|
"@typescript-eslint/destructure-expression": ERROR,
|
82
87
|
"@typescript-eslint/global": ERROR,
|
83
88
|
},
|
84
|
-
|
89
|
+
} as const,
|
85
90
|
],
|
86
91
|
mocha: [
|
87
|
-
|
88
|
-
|
89
|
-
|
92
|
+
{
|
93
|
+
id: "disable",
|
94
|
+
rules: { vanilla2: OFF },
|
95
|
+
} as const,
|
96
|
+
{
|
97
|
+
id: "disable/ts",
|
98
|
+
rules: { "@typescript-eslint/global": ERROR },
|
99
|
+
} as const,
|
100
|
+
{
|
101
|
+
id: "enable",
|
102
|
+
rules: { "mocha/test-expression": ERROR },
|
103
|
+
} as const,
|
90
104
|
],
|
91
105
|
svelte: [
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
106
|
+
{
|
107
|
+
id: "disable",
|
108
|
+
rules: { vanilla1: OFF },
|
109
|
+
} as const,
|
110
|
+
{
|
111
|
+
id: "enable-extension",
|
112
|
+
rules: { "svelte/tags": ERROR },
|
113
|
+
} as const,
|
114
|
+
],
|
115
|
+
html: [
|
116
|
+
{
|
117
|
+
id: "enable",
|
118
|
+
rules: { "html/attribute": ERROR },
|
119
|
+
} as const,
|
120
|
+
],
|
121
|
+
css: [
|
122
|
+
{
|
123
|
+
id: "enable",
|
124
|
+
rules: { "css/property": ERROR },
|
125
|
+
} as const,
|
96
126
|
],
|
97
|
-
html: [["enable", { "html/attribute": ERROR }] as const],
|
98
|
-
css: [["enable", { "css/property": ERROR }] as const],
|
99
127
|
json: [
|
100
|
-
|
101
|
-
"enable",
|
102
|
-
{
|
128
|
+
{
|
129
|
+
id: "enable",
|
130
|
+
rules: {
|
103
131
|
"jsonc/property-check": ERROR,
|
104
132
|
"jsonc/trailing-comma": [ERROR, "always"],
|
105
133
|
},
|
106
|
-
|
134
|
+
} as const,
|
135
|
+
],
|
136
|
+
jsonc: [
|
137
|
+
{
|
138
|
+
id: "override",
|
139
|
+
rules: { "jsonc/trailing-comma": [ERROR, "never"] },
|
140
|
+
} as const,
|
141
|
+
],
|
142
|
+
yml: [
|
143
|
+
{
|
144
|
+
id: "enable",
|
145
|
+
rules: { "yml/property-check": ERROR },
|
146
|
+
} as const,
|
107
147
|
],
|
108
|
-
jsonc: [["override", { "jsonc/trailing-comma": [ERROR, "never"] }] as const],
|
109
|
-
yml: [["enable", { "yml/property-check": ERROR }] as const],
|
110
148
|
} as const,
|
111
149
|
} as const,
|
112
150
|
} as const;
|
package/src/index.spec.ts
CHANGED
@@ -4,5 +4,5 @@ export interface Defaults<Scopes extends string> {
|
|
4
4
|
readonly settings: Config["linterOptions"] & Config["languageOptions"];
|
5
5
|
readonly files: Readonly<Record<Scopes, string[]>>;
|
6
6
|
readonly ignores: Readonly<Record<"*" | Scopes, string[]>>;
|
7
|
-
readonly rules: Readonly<Record<Scopes, Rule.
|
7
|
+
readonly rules: Readonly<Record<Scopes, Rule.NamedRuleBag[]>>;
|
8
8
|
}
|
@@ -12,7 +12,7 @@ export type Extensions<Scopes extends string> = (
|
|
12
12
|
{
|
13
13
|
readonly files?: Defaults<Scopes>["files"][Scopes];
|
14
14
|
readonly ignores?: Defaults<Scopes>["ignores"][Scopes];
|
15
|
-
readonly rules?: Defaults<Scopes>["rules"][Scopes][number][
|
15
|
+
readonly rules?: Defaults<Scopes>["rules"][Scopes][number]["rules"];
|
16
16
|
}
|
17
17
|
>>
|
18
18
|
);
|
@@ -10,7 +10,7 @@ export interface Config<Plugins extends string = string> {
|
|
10
10
|
readonly plugins: Readonly<Record<Plugins, unknown>>;
|
11
11
|
readonly files: readonly string[];
|
12
12
|
readonly ignores: readonly string[];
|
13
|
-
readonly rules: Rule.
|
13
|
+
readonly rules: Rule.RuleBag;
|
14
14
|
readonly linterOptions: {
|
15
15
|
readonly noInlineConfig: boolean;
|
16
16
|
readonly reportUnusedDisableDirectives:
|
@@ -1,13 +1,13 @@
|
|
1
|
-
export
|
1
|
+
export interface NamedRuleBag {
|
2
|
+
id: string;
|
3
|
+
readonly rules: RuleBag;
|
4
|
+
}
|
5
|
+
export type RuleBag = Readonly<Record<
|
2
6
|
string,
|
3
|
-
|
4
|
-
]
|
5
|
-
export type Bag = Readonly<Record<
|
6
|
-
string,
|
7
|
-
| State
|
8
|
-
| readonly [State, ...readonly unknown[]]
|
7
|
+
| RuleState
|
8
|
+
| readonly [RuleState, ...readonly unknown[]]
|
9
9
|
>>;
|
10
|
-
export type
|
10
|
+
export type RuleState = (
|
11
11
|
| "error"
|
12
12
|
| "warn"
|
13
13
|
| "off"
|
package/dist/test/input.d.ts
DELETED
package/dist/test/input.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/test/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,IAAI,CAAC;AAO3B,eAAO,MAAM,SAAS,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAwGvC,CAAC"}
|
package/dist/test/input.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/test/input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