@eslinted/core 13.4.0-rc.7 → 13.4.0-rc.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/factory/index.d.ts +1 -1
- package/dist/factory/index.js +6 -6
- package/dist/factory/index.js.map +1 -1
- package/dist/index.spec.d.ts +2 -0
- package/dist/index.spec.d.ts.map +1 -0
- package/dist/index.spec.js +29 -0
- package/dist/index.spec.js.map +1 -0
- package/dist/test/input.d.ts +3 -0
- package/dist/test/input.d.ts.map +1 -0
- package/dist/test/input.js +102 -0
- package/dist/test/input.js.map +1 -0
- package/package.json +1 -1
- package/src/factory/index.ts +11 -11
- package/src/index.spec.ts +30 -0
- package/src/test/input.ts +107 -0
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: 3 | 5 | "latest" | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024;
|
16
16
|
};
|
17
17
|
};
|
18
18
|
readonly ignores: {
|
package/dist/factory/index.js
CHANGED
@@ -31,13 +31,13 @@ export class Factory {
|
|
31
31
|
this.scopes.ignores[scope].push(...moreIgnores);
|
32
32
|
if (moreRules !== null)
|
33
33
|
this.scopes.rules[scope].push([`${scope}/override`, moreRules]);
|
34
|
-
tree.forEach(([scope, parents]) => {
|
35
|
-
parents.forEach(parent => {
|
36
|
-
this.scopes.files[parent].push(...this.scopes.files[scope]);
|
37
|
-
this.scopes.ignores[parent].push(...this.scopes.ignores[scope]);
|
38
|
-
});
|
39
|
-
});
|
40
34
|
}
|
35
|
+
tree.forEach(([scope, parents]) => {
|
36
|
+
parents.forEach(parent => {
|
37
|
+
this.scopes.files[parent].push(...this.scopes.files[scope]);
|
38
|
+
this.scopes.ignores[parent].push(...this.scopes.ignores[scope]);
|
39
|
+
});
|
40
|
+
});
|
41
41
|
}
|
42
42
|
scope(scope) {
|
43
43
|
const { files: { [scope]: files }, ignores: { [scope]: ignores }, rules: { [scope]: rules }, } = this.scopes, ruleset = rules.map(([id, rules]) => ({ id: `${scope}/${id}`, rules })), { processor, language, languageOptions: { parser = null, ...languageOptionsStatic }, parserOptions: { parser: subparser = null, ...parserOptionsStatic }, } = new ScopeManifests[scope]();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAI7C,MAAM,OAAO,OAAO;IAMA;IALF,MAAM,CAAC;IACP,MAAM,CAAC;IAEvB,YACE,IAAiB,EACD,OAAoC,EACpD,EACE,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,YAAY,GACD,EACpB,EAAE,GAAG,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,eAAe,KAA0B,EAAW;QAPpE,YAAO,GAAP,OAAO,CAA6B;QASpD,MAAM,EACJ,cAAc,GAAG,eAAe,CAAC,cAAc,EAC/C,6BAA6B,GAAG,eAAe,CAAC,6BAA6B,EAC7E,UAAU,GAAG,eAAe,CAAC,UAAU,EACvC,WAAW,GAAG,eAAe,CAAC,WAAW,EACzC,OAAO,GAAG,EAAW,EACrB,QAAQ,GAAG,KAAK,GACjB,GAAG,eAAe,CAAC;QAEpB,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EAAE;gBACR,IAAI,EAAE,WAAW;gBACjB,aAAa,EAAE,EAAE,cAAc,EAAE,6BAA6B,EAAW;gBACzE,eAAe,EAAE,EAAE,UAAU,EAAE,WAAW,EAAW;aAC7C;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE;oBACP,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAW,CAAC,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC;oBAC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AAW;YACb,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;gBAClB,CAAC,CAAC,EAAW;gBACb,CAAC,CAAC;oBACE;wBACE,IAAI,EAAE,UAAU,KAAK,GAAG;wBACxB,KAAK;wBACL,OAAO;wBACP,GAAG,SAAS;wBACZ,GAAG,QAAQ;wBACX,eAAe,EAAE;4BACf,GAAG,qBAAqB;4BACxB,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;qBACF;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.spec.d.ts","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { expect } from "chai";
|
2
|
+
import core from "./index.js";
|
3
|
+
import { TestInput } from "./test/input.js";
|
4
|
+
const configs = core(TestInput);
|
5
|
+
describe("Core", function () {
|
6
|
+
describe("shape", function () {
|
7
|
+
it("is a function", function () {
|
8
|
+
expect(core)
|
9
|
+
.a("function");
|
10
|
+
});
|
11
|
+
});
|
12
|
+
describe("output", function () {
|
13
|
+
it("is an array", function () {
|
14
|
+
expect(configs)
|
15
|
+
.an("array");
|
16
|
+
});
|
17
|
+
it("is non-empty", function () {
|
18
|
+
expect(configs)
|
19
|
+
.lengthOf.at.least(1);
|
20
|
+
});
|
21
|
+
});
|
22
|
+
describe("TBD: configs", function () {
|
23
|
+
it("have first three common", function () {
|
24
|
+
expect(configs[0])
|
25
|
+
.to.be.an("object");
|
26
|
+
});
|
27
|
+
});
|
28
|
+
});
|
29
|
+
//# sourceMappingURL=index.spec.js.map
|
@@ -0,0 +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,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,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,CAAC,CAAC,UAAU,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,QAAQ,EAAE;QACjB,EAAE,CAAC,aAAa,EAAE;YAChB,MAAM,CAAC,OAAO,CAAC;iBACZ,EAAE,CAAC,OAAO,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,cAAc,EAAE;YACjB,MAAM,CAAC,OAAO,CAAC;iBACZ,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,cAAc,EAAE;QACvB,EAAE,CAAC,yBAAyB,EAAE;YAC5B,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBACf,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
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,CAmGvC,CAAC"}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
const ERROR = "error", OFF = "off", Plugin = { configs: null };
|
2
|
+
export const TestInput = {
|
3
|
+
imports: {
|
4
|
+
plugins: {
|
5
|
+
"@html-eslint": Plugin,
|
6
|
+
"@stylistic": Plugin,
|
7
|
+
"@typescript-eslint": Plugin,
|
8
|
+
mocha: Plugin,
|
9
|
+
svelte: Plugin,
|
10
|
+
jsonc: Plugin,
|
11
|
+
yml: Plugin,
|
12
|
+
},
|
13
|
+
parsers: {
|
14
|
+
ts: "parsers.ts",
|
15
|
+
svelte: "parsers.svelte",
|
16
|
+
html: "parsers.html",
|
17
|
+
jsonc: "parsers.jsonc",
|
18
|
+
yml: "parsers.yml",
|
19
|
+
},
|
20
|
+
},
|
21
|
+
extensions: {},
|
22
|
+
defaults: {
|
23
|
+
settings: {
|
24
|
+
ecmaVersion: 2024,
|
25
|
+
sourceType: "module",
|
26
|
+
noInlineConfig: true,
|
27
|
+
reportUnusedDisableDirectives: "error",
|
28
|
+
},
|
29
|
+
files: {
|
30
|
+
"*": ["default.*"],
|
31
|
+
js: ["default.js"],
|
32
|
+
ts: ["default.ts"],
|
33
|
+
svelte: ["default.svelte"],
|
34
|
+
mocha: ["default.mocha"],
|
35
|
+
html: ["default.html"],
|
36
|
+
json: ["default.json"],
|
37
|
+
jsonc: ["default.jsonc"],
|
38
|
+
yml: ["default.yml"],
|
39
|
+
},
|
40
|
+
ignores: {
|
41
|
+
"*": ["ignore/default.*"],
|
42
|
+
js: ["ignore/default.js"],
|
43
|
+
ts: ["ignore/default.ts"],
|
44
|
+
svelte: ["ignore/default.svelte"],
|
45
|
+
mocha: ["ignore/default.mocha"],
|
46
|
+
html: ["ignore/default.html"],
|
47
|
+
json: ["ignore/default.json"],
|
48
|
+
jsonc: ["ignore/default.jsonc"],
|
49
|
+
yml: ["ignore/default.yml"],
|
50
|
+
},
|
51
|
+
rules: {
|
52
|
+
js: [
|
53
|
+
[
|
54
|
+
"enable",
|
55
|
+
{
|
56
|
+
vanilla: ERROR,
|
57
|
+
vanilla0: ERROR,
|
58
|
+
vanilla1: ERROR,
|
59
|
+
vanilla2: ERROR,
|
60
|
+
},
|
61
|
+
],
|
62
|
+
["enable/stylistic", { "@stylistic/style-rule": ERROR }],
|
63
|
+
],
|
64
|
+
ts: [
|
65
|
+
["disable", { vanilla0: OFF }],
|
66
|
+
["enable", { "@typescript-eslint/vanilla-typed": ERROR }],
|
67
|
+
[
|
68
|
+
"enable/extension",
|
69
|
+
{
|
70
|
+
"@typescript-eslint/enums": ERROR,
|
71
|
+
"@typescript-eslint/destructure-expression": ERROR,
|
72
|
+
"@typescript-eslint/global": ERROR,
|
73
|
+
},
|
74
|
+
],
|
75
|
+
],
|
76
|
+
svelte: [
|
77
|
+
["disable", { vanilla1: OFF }],
|
78
|
+
["disable/ts", { "@typescript-eslint/destructure-expression": ERROR }],
|
79
|
+
["enable", { "svelte/destructure-expression": ERROR }],
|
80
|
+
["enable-extension", { "svelte/tags": ERROR }],
|
81
|
+
],
|
82
|
+
mocha: [
|
83
|
+
["disable", { vanilla2: OFF }],
|
84
|
+
["disable/ts", { "@typescript-eslint/global": ERROR }],
|
85
|
+
["enable", { "mocha/test-expression": ERROR }],
|
86
|
+
],
|
87
|
+
html: [["enable", { "html/attribute": ERROR }]],
|
88
|
+
json: [
|
89
|
+
[
|
90
|
+
"enable",
|
91
|
+
{
|
92
|
+
"jsonc/property-check": ERROR,
|
93
|
+
"jsonc/trailing-comma": [ERROR, "always"],
|
94
|
+
},
|
95
|
+
],
|
96
|
+
],
|
97
|
+
jsonc: [["override", { "jsonc/trailing-comma": [ERROR, "never"] }]],
|
98
|
+
yml: [["enable", { "yml/property-check": ERROR }]],
|
99
|
+
},
|
100
|
+
},
|
101
|
+
};
|
102
|
+
//# sourceMappingURL=input.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/test/input.ts"],"names":[],"mappings":"AAEA,MACA,KAAK,GAAG,OAAO,EACf,GAAG,GAAG,KAAK,EACX,MAAM,GAAG,EAAE,OAAO,EAAE,IAAI,EAAW,CAAC;AAEpC,MAAM,CAAC,MAAM,SAAS,GAA+B;IACnD,OAAO,EAAE;QACP,OAAO,EAAE;YACP,cAAc,EAAE,MAAM;YACtB,YAAY,EAAE,MAAM;YACpB,oBAAoB,EAAE,MAAM;YAC5B,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;YACb,GAAG,EAAE,MAAM;SACH;QACV,OAAO,EAAE;YACP,EAAE,EAAE,YAAY;YAChB,MAAM,EAAE,gBAAgB;YACxB,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,eAAe;YACtB,GAAG,EAAE,aAAa;SACV;KACF;IACV,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,WAAW,EAAE,IAAI;YACjB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,IAAI;YACpB,6BAA6B,EAAE,OAAO;SACvC;QACD,KAAK,EAAE;YACL,GAAG,EAAE,CAAC,WAAW,CAAC;YAClB,EAAE,EAAE,CAAC,YAAY,CAAC;YAClB,EAAE,EAAE,CAAC,YAAY,CAAC;YAClB,MAAM,EAAE,C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AAU;gBAC/E,CAAC,QAAQ,EAAE,EAAE,+BAA+B,EAAE,KAAK,EAAE,CAAU;gBAC/D,CAAC,kBAAkB,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAU;aACxD;YACD,KAAK,EAAE;gBACL,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAU;gBACvC,CAAC,YAAY,EAAE,EAAE,2BAA2B,EAAE,KAAK,EAAE,CAAU;gBAC/D,CAAC,QAAQ,EAAE,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAU;aACxD;YACD,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAU,CAAC;YACxD,IAAI,EAAE;gBACJ;oBACE,QAAQ;oBACR;wBACE,sBAAsB,EAAE,KAAK;wBAC7B,sBAAsB,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;qBAC1C;iBACO;aACX;YACD,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,EAAE,sBAAsB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAU,CAAC;YAC5E,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAU,CAAC;SACnD;KACF;CACF,CAAC"}
|
package/package.json
CHANGED
package/src/factory/index.ts
CHANGED
@@ -60,18 +60,18 @@ export class Factory {
|
|
60
60
|
|
61
61
|
if (moreRules !== null)
|
62
62
|
this.scopes.rules[scope as keyof typeof scopeExtensions].push([`${scope}/override`, moreRules]);
|
63
|
+
}
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
});
|
65
|
+
tree.forEach(([scope, parents]) => {
|
66
|
+
parents.forEach(parent => {
|
67
|
+
this.scopes.files[parent].push(
|
68
|
+
...this.scopes.files[scope],
|
69
|
+
);
|
70
|
+
this.scopes.ignores[parent].push(
|
71
|
+
...this.scopes.ignores[scope],
|
72
|
+
);
|
73
73
|
});
|
74
|
-
}
|
74
|
+
});
|
75
75
|
}
|
76
76
|
|
77
77
|
public scope<S extends keyof typeof ScopeManifests>(scope: S) {
|
@@ -114,7 +114,7 @@ export class Factory {
|
|
114
114
|
parserOptions: {
|
115
115
|
...parserOptionsStatic,
|
116
116
|
...subparser === null ? {} as const : { parser: this.parsers[subparser] } as const,
|
117
|
-
},
|
117
|
+
} as const,
|
118
118
|
} as const,
|
119
119
|
} as const,
|
120
120
|
} as const,
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { expect } from "chai";
|
2
|
+
import core from ".";
|
3
|
+
import { TestInput } from "./test/input";
|
4
|
+
|
5
|
+
const configs = core(TestInput);
|
6
|
+
|
7
|
+
describe("Core", function () {
|
8
|
+
describe("shape", function () {
|
9
|
+
it("is a function", function () {
|
10
|
+
expect(core)
|
11
|
+
.a("function");
|
12
|
+
});
|
13
|
+
});
|
14
|
+
describe("output", function () {
|
15
|
+
it("is an array", function () {
|
16
|
+
expect(configs)
|
17
|
+
.an("array");
|
18
|
+
});
|
19
|
+
it("is non-empty", function () {
|
20
|
+
expect(configs)
|
21
|
+
.lengthOf.at.least(1);
|
22
|
+
});
|
23
|
+
});
|
24
|
+
describe("TBD: configs", function () {
|
25
|
+
it("have first three common", function () {
|
26
|
+
expect(configs[0])
|
27
|
+
.to.be.an("object");
|
28
|
+
});
|
29
|
+
});
|
30
|
+
});
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import type Core from "..";
|
2
|
+
|
3
|
+
const
|
4
|
+
ERROR = "error",
|
5
|
+
OFF = "off",
|
6
|
+
Plugin = { configs: null } as const;
|
7
|
+
|
8
|
+
export const TestInput: Parameters<typeof Core>[0] = {
|
9
|
+
imports: {
|
10
|
+
plugins: {
|
11
|
+
"@html-eslint": Plugin,
|
12
|
+
"@stylistic": Plugin,
|
13
|
+
"@typescript-eslint": Plugin,
|
14
|
+
mocha: Plugin,
|
15
|
+
svelte: Plugin,
|
16
|
+
jsonc: Plugin,
|
17
|
+
yml: Plugin,
|
18
|
+
} as const,
|
19
|
+
parsers: {
|
20
|
+
ts: "parsers.ts",
|
21
|
+
svelte: "parsers.svelte",
|
22
|
+
html: "parsers.html",
|
23
|
+
jsonc: "parsers.jsonc",
|
24
|
+
yml: "parsers.yml",
|
25
|
+
} as const,
|
26
|
+
} as const,
|
27
|
+
extensions: {},
|
28
|
+
defaults: {
|
29
|
+
settings: {
|
30
|
+
ecmaVersion: 2024,
|
31
|
+
sourceType: "module",
|
32
|
+
noInlineConfig: true,
|
33
|
+
reportUnusedDisableDirectives: "error",
|
34
|
+
},
|
35
|
+
files: {
|
36
|
+
"*": ["default.*"],
|
37
|
+
js: ["default.js"],
|
38
|
+
ts: ["default.ts"],
|
39
|
+
svelte: ["default.svelte"],
|
40
|
+
mocha: ["default.mocha"],
|
41
|
+
html: ["default.html"],
|
42
|
+
json: ["default.json"],
|
43
|
+
jsonc: ["default.jsonc"],
|
44
|
+
yml: ["default.yml"],
|
45
|
+
} as const,
|
46
|
+
ignores: {
|
47
|
+
"*": ["ignore/default.*"],
|
48
|
+
js: ["ignore/default.js"],
|
49
|
+
ts: ["ignore/default.ts"],
|
50
|
+
svelte: ["ignore/default.svelte"],
|
51
|
+
mocha: ["ignore/default.mocha"],
|
52
|
+
html: ["ignore/default.html"],
|
53
|
+
json: ["ignore/default.json"],
|
54
|
+
jsonc: ["ignore/default.jsonc"],
|
55
|
+
yml: ["ignore/default.yml"],
|
56
|
+
} as const,
|
57
|
+
rules: {
|
58
|
+
js: [
|
59
|
+
[
|
60
|
+
"enable",
|
61
|
+
{
|
62
|
+
vanilla: ERROR,
|
63
|
+
vanilla0: ERROR,
|
64
|
+
vanilla1: ERROR,
|
65
|
+
vanilla2: ERROR,
|
66
|
+
},
|
67
|
+
] as const,
|
68
|
+
["enable/stylistic", { "@stylistic/style-rule": ERROR }] as const,
|
69
|
+
],
|
70
|
+
ts: [
|
71
|
+
["disable", { vanilla0: OFF }] as const,
|
72
|
+
["enable", { "@typescript-eslint/vanilla-typed": ERROR }] as const,
|
73
|
+
[
|
74
|
+
"enable/extension",
|
75
|
+
{
|
76
|
+
"@typescript-eslint/enums": ERROR,
|
77
|
+
"@typescript-eslint/destructure-expression": ERROR,
|
78
|
+
"@typescript-eslint/global": ERROR,
|
79
|
+
},
|
80
|
+
] as const,
|
81
|
+
],
|
82
|
+
svelte: [
|
83
|
+
["disable", { vanilla1: OFF }] as const,
|
84
|
+
["disable/ts", { "@typescript-eslint/destructure-expression": ERROR }] as const,
|
85
|
+
["enable", { "svelte/destructure-expression": ERROR }] as const,
|
86
|
+
["enable-extension", { "svelte/tags": ERROR }] as const,
|
87
|
+
],
|
88
|
+
mocha: [
|
89
|
+
["disable", { vanilla2: OFF }] as const,
|
90
|
+
["disable/ts", { "@typescript-eslint/global": ERROR }] as const,
|
91
|
+
["enable", { "mocha/test-expression": ERROR }] as const,
|
92
|
+
],
|
93
|
+
html: [["enable", { "html/attribute": ERROR }] as const],
|
94
|
+
json: [
|
95
|
+
[
|
96
|
+
"enable",
|
97
|
+
{
|
98
|
+
"jsonc/property-check": ERROR,
|
99
|
+
"jsonc/trailing-comma": [ERROR, "always"],
|
100
|
+
},
|
101
|
+
] as const,
|
102
|
+
],
|
103
|
+
jsonc: [["override", { "jsonc/trailing-comma": [ERROR, "never"] }] as const],
|
104
|
+
yml: [["enable", { "yml/property-check": ERROR }] as const],
|
105
|
+
} as const,
|
106
|
+
} as const,
|
107
|
+
} as const;
|