@eslinted/core 32.2.5 → 32.4.0

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 CHANGED
@@ -3,7 +3,7 @@
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": "32.2.5",
6
+ "version": "32.4.0",
7
7
  "repository": "github:jimmy-zhening-luo/linted-core",
8
8
  "description": "Internal core for npm package `linted`, responsible for producing an array of fully-formed ESLint configurations according to `linted` spec.",
9
9
  "keywords": [],
@@ -24,10 +24,6 @@
24
24
  "types": "dist/index.d.ts",
25
25
  "main": "dist/index.js",
26
26
  "devDependencies": {
27
- "@types/chai": "^5.2.3",
28
- "@types/mocha": "^10.0.10",
29
- "chai": "^6.2.2",
30
- "mocha": "^11.7.5",
31
27
  "ts-add-js-extension": "^1.6.6",
32
28
  "typescript": "^5.9.3"
33
29
  },
@@ -41,7 +37,6 @@
41
37
  "lint": "eslint --cache --fix",
42
38
  "pretest": "npm run build",
43
39
  "test": "npm run --if-present test:suite",
44
- "test:suite": "tsc -b tests && ts-add-js-extension --showprogress=false --dir=dist && mocha",
45
40
  "prestart": "npm run build",
46
41
  "start": "npm run start:ts",
47
42
  "start:ts": "node .",
package/.mocharc.yml DELETED
@@ -1,11 +0,0 @@
1
- ####################
2
- ### .mocharc ###
3
- ### 1107.1.0 ###
4
- ####################
5
-
6
- # https://mochajs.org/#configuration-format
7
- # https://mochajs.org/#command-line-usage
8
-
9
- extension: [js]
10
- require: dist/tests/index.js
11
- spec: [dist/tests/**/*.spec.js]
@@ -1,2 +0,0 @@
1
- export declare function mochaGlobalSetup(): void;
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../tests/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,SAE/B"}
@@ -1,130 +0,0 @@
1
- declare const enum State {
2
- OFF = 0,
3
- WARN = 1,
4
- ERROR = 2
5
- }
6
- export declare const scopes: readonly ["js", "ts", "svelte", "html", "json", "jsonc", "jsoncc"], optional: readonly ["svelte"], tree: readonly [readonly ["jsoncc", readonly ["jsonc"]], readonly ["jsonc", readonly ["json"]], readonly ["svelte", readonly ["ts"]], readonly ["ts", readonly ["js"]]], imports: {
7
- plugins: {
8
- "@typescript-eslint": string;
9
- html: string;
10
- json: string;
11
- jsonc: string;
12
- };
13
- parsers: {
14
- ts: string;
15
- html: string;
16
- };
17
- }, settings: {
18
- ts: {
19
- languageOptions: {
20
- parser: "ts";
21
- };
22
- };
23
- svelte: {
24
- languageOptions: {
25
- parser: "svelte";
26
- };
27
- parserOptions: {
28
- parser: "ts";
29
- extraFileExtensions: string[];
30
- };
31
- processor: string;
32
- };
33
- html: {
34
- languageOptions: {
35
- parser: "html";
36
- };
37
- parserOptions: {
38
- frontmatter: boolean;
39
- };
40
- language: string;
41
- };
42
- json: {
43
- languageOptions: {
44
- allowTrailingCommas: boolean;
45
- };
46
- language: string;
47
- };
48
- }, defaults: {
49
- files: {
50
- js: string[];
51
- ts: string[];
52
- svelte: string[];
53
- html: string[];
54
- json: string[];
55
- jsonc: string[];
56
- jsoncc: string[];
57
- };
58
- ignores: {
59
- "*": string[];
60
- js: string[];
61
- json: string[];
62
- jsoncc: string[];
63
- };
64
- rules: {
65
- "*": {
66
- rules: {
67
- global0: State;
68
- global1: State;
69
- };
70
- }[];
71
- js: {
72
- rules: {
73
- vanilla: State;
74
- vanilla0: State;
75
- vanilla1: State;
76
- vanilla2: State;
77
- };
78
- }[];
79
- ts: ({
80
- rules: {
81
- vanilla0: State;
82
- "@typescript-eslint/enums"?: never;
83
- "@typescript-eslint/destructure-expression"?: never;
84
- "@typescript-eslint/global"?: never;
85
- };
86
- } | {
87
- rules: {
88
- "@typescript-eslint/enums": State;
89
- "@typescript-eslint/destructure-expression": State;
90
- "@typescript-eslint/global": State;
91
- vanilla0?: never;
92
- };
93
- })[];
94
- svelte: ({
95
- rules: {
96
- vanilla1: State;
97
- "svelte/tags"?: never;
98
- };
99
- } | {
100
- rules: {
101
- "svelte/tags": State;
102
- vanilla1?: never;
103
- };
104
- })[];
105
- html: {
106
- rules: {
107
- "html/attribute": State;
108
- };
109
- }[];
110
- json: {
111
- rules: {
112
- "jsonc/property-check": State;
113
- "jsonc/comment": readonly [State.ERROR, "never"];
114
- "jsonc/trailing-comma": readonly [State.ERROR, "never"];
115
- };
116
- }[];
117
- jsonc: {
118
- rules: {
119
- "jsonc/comment": readonly [State.ERROR, "allow"];
120
- };
121
- }[];
122
- jsoncc: {
123
- rules: {
124
- "jsonc/trailing-comma": readonly [State.ERROR, "allow"];
125
- };
126
- }[];
127
- };
128
- }, extensions: {};
129
- export {};
130
- //# sourceMappingURL=index.input.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.input.spec.d.ts","sourceRoot":"","sources":["../../tests/index.input.spec.ts"],"names":[],"mappings":"AAAA,mBAAW,KAAK;IACd,GAAG,IAAI;IACP,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAID,eAAO,MAAM,MAAM,oEAQT,EACV,QAAQ,qBAAsB,EAC9B,IAAI,mKAiBM,EACV,OAAO;;;;;;;;;;;CAWN,EACD,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BP,EACD,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGP,EACD,UAAU,IAAK,CAAC"}
@@ -1,174 +0,0 @@
1
- const Plugin = "MOCK_PLUGIN", Parser = (scope) => `MOCK_PARSER:${scope}`;
2
- export const scopes = [
3
- "js",
4
- "ts",
5
- "svelte",
6
- "html",
7
- "json",
8
- "jsonc",
9
- "jsoncc",
10
- ], optional = ["svelte"], tree = [
11
- [
12
- "jsoncc",
13
- ["jsonc"],
14
- ],
15
- [
16
- "jsonc",
17
- ["json"],
18
- ],
19
- [
20
- "svelte",
21
- ["ts"],
22
- ],
23
- [
24
- "ts",
25
- ["js"],
26
- ],
27
- ], imports = {
28
- plugins: {
29
- "@typescript-eslint": Plugin,
30
- html: Plugin,
31
- json: Plugin,
32
- jsonc: Plugin,
33
- },
34
- parsers: {
35
- ts: Parser("TS"),
36
- html: Parser("HTML"),
37
- },
38
- }, settings = {
39
- ts: {
40
- languageOptions: {
41
- parser: "ts",
42
- },
43
- },
44
- svelte: {
45
- languageOptions: {
46
- parser: "svelte",
47
- },
48
- parserOptions: {
49
- parser: "ts",
50
- extraFileExtensions: [".svelte"],
51
- },
52
- processor: "svelte/svelte",
53
- },
54
- html: {
55
- languageOptions: {
56
- parser: "html",
57
- },
58
- parserOptions: {
59
- frontmatter: true,
60
- },
61
- language: "html/html",
62
- },
63
- json: {
64
- languageOptions: {
65
- allowTrailingCommas: true,
66
- },
67
- language: "json/jsonc",
68
- },
69
- }, defaults = {
70
- files: {
71
- js: ["default.js"],
72
- ts: ["default.ts"],
73
- svelte: ["default.svelte"],
74
- html: ["default.html"],
75
- json: ["default.json"],
76
- jsonc: ["default.jsonc"],
77
- jsoncc: ["default-comma.jsonc"],
78
- },
79
- ignores: {
80
- "*": ["ignore/default.*"],
81
- js: ["ignore/default.js"],
82
- json: ["ignore/default.json"],
83
- jsoncc: ["ignore/default-comma.jsonc"],
84
- },
85
- rules: {
86
- "*": [
87
- {
88
- rules: {
89
- global0: 1,
90
- global1: 2,
91
- },
92
- },
93
- ],
94
- js: [
95
- {
96
- rules: {
97
- vanilla: 2,
98
- vanilla0: 2,
99
- vanilla1: 2,
100
- vanilla2: 2,
101
- },
102
- },
103
- ],
104
- ts: [
105
- {
106
- rules: {
107
- vanilla0: 0,
108
- },
109
- },
110
- {
111
- rules: {
112
- "@typescript-eslint/enums": 2,
113
- "@typescript-eslint/destructure-expression": 2,
114
- "@typescript-eslint/global": 2,
115
- },
116
- },
117
- ],
118
- svelte: [
119
- {
120
- rules: {
121
- vanilla1: 0,
122
- },
123
- },
124
- {
125
- rules: {
126
- "svelte/tags": 2,
127
- },
128
- },
129
- ],
130
- html: [
131
- {
132
- rules: {
133
- "html/attribute": 2,
134
- },
135
- },
136
- ],
137
- json: [
138
- {
139
- rules: {
140
- "jsonc/property-check": 2,
141
- "jsonc/comment": [
142
- 2,
143
- "never",
144
- ],
145
- "jsonc/trailing-comma": [
146
- 2,
147
- "never",
148
- ],
149
- },
150
- },
151
- ],
152
- jsonc: [
153
- {
154
- rules: {
155
- "jsonc/comment": [
156
- 2,
157
- "allow",
158
- ],
159
- },
160
- },
161
- ],
162
- jsoncc: [
163
- {
164
- rules: {
165
- "jsonc/trailing-comma": [
166
- 2,
167
- "allow",
168
- ],
169
- },
170
- },
171
- ],
172
- },
173
- }, extensions = {};
174
- //# sourceMappingURL=index.input.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.input.spec.js","sourceRoot":"","sources":["../../tests/index.input.spec.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,GAAG,aAAa,EAC5B,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,eAAe,KAAK,EAAE,CAAC;AAEnD,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;CACA,EACV,QAAQ,GAAG,CAAC,QAAQ,CAAU,EAC9B,IAAI,GAAG;IACL;QACE,QAAQ;QACR,CAAC,OAAO,CAAC;KACV;IACD;QACE,OAAO;QACP,CAAC,MAAM,CAAC;KACT;IACD;QACE,QAAQ;QACR,CAAC,IAAI,CAAC;KACP;IACD;QACE,IAAI;QACJ,CAAC,IAAI,CAAC;KACP;CACO,EACV,OAAO,GAAG;IACR,OAAO,EAAE;QACP,oBAAoB,EAAE,MAAM;QAC5B,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,MAAM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BACE,KAAK,EAAE;oBACL,OAAO,GAAa;oBACpB,QAAQ,GAAa;oBACrB,QAAQ,GAAa;oBACrB,QAAQ,GAAa;iBACtB;aACF;SACF;QACD,EAAE,EAAE;YACF;gBACE,KAAK,EAAE;oBACL,QAAQ,GAAW;iBACpB;aACF;YACD;gBACE,KAAK,EAAE;oBACL,0BAA0B,GAAa;oBACvC,2CAA2C,GAAa;oBACxD,2BAA2B,GAAa;iBACzC;aACF;SACF;QACD,MAAM,EAAE;YACN;gBACE,KAAK,EAAE;oBACL,QAAQ,GAAW;iBACpB;aACF;YACD;gBACE,KAAK,EAAE;oBACL,aAAa,GAAa;iBAC3B;aACF;SACF;QACD,IAAI,EAAE;YACJ;gBACE,KAAK,EAAE;oBACL,gBAAgB,GAAa;iBAC9B;aACF;SACF;QACD,IAAI,EAAE;YACJ;gBACE,KAAK,EAAE;oBACL,sBAAsB,GAAa;oBACnC,eAAe,EAAE;;wBAEf,OAAO;qBACC;oBACV,sBAAsB,EAAE;;wBAEtB,OAAO;qBACC;iBACX;aACF;SACF;QACD,KAAK,EAAE;YACL;gBACE,KAAK,EAAE;oBACL,eAAe,EAAE;;wBAEf,OAAO;qBACC;iBACX;aACF;SACF;QACD,MAAM,EAAE;YACN;gBACE,KAAK,EAAE;oBACL,sBAAsB,EAAE;;wBAEtB,OAAO;qBACC;iBACX;aACF;SACF;KACF;CACF,EACD,UAAU,GAAG,EAAE,CAAC"}
@@ -1,3 +0,0 @@
1
- export function mochaGlobalSetup() {
2
- }
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../tests/index.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB;AAEhC,CAAC"}
@@ -1,2 +0,0 @@
1
- import "chai/register-should.js";
2
- //# sourceMappingURL=index.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../tests/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC"}
@@ -1,92 +0,0 @@
1
- import "chai/register-should.js";
2
- import Core from "../index.js";
3
- import { scopes, optional, tree, imports, settings, defaults, extensions, } from "./index.input.spec.js";
4
- const GLOBAL_CONFIG_COUNT = 1, configs = Core(scopes, optional, tree, imports, settings, defaults, extensions), Scopes = new Set(scopes);
5
- for (const scope of optional)
6
- Scopes.delete(scope);
7
- describe("Core", () => {
8
- describe("module", () => {
9
- it("is a function", () => {
10
- Core
11
- .should.be
12
- .a("function");
13
- });
14
- });
15
- describe("output", () => {
16
- it("is a non-empty array", () => {
17
- configs
18
- .should.be
19
- .an("array")
20
- .not.empty;
21
- });
22
- it(`length >= (*/plugins + */ignores + ${Scopes.size} scopes = ${Scopes.size + GLOBAL_CONFIG_COUNT}) [Actual: ${configs.length}]`, () => {
23
- configs
24
- .should.have
25
- .lengthOf
26
- .at.least(Scopes.size + GLOBAL_CONFIG_COUNT);
27
- });
28
- it("of config objects", () => {
29
- for (const config of configs)
30
- config
31
- .should.be
32
- .an("object")
33
- .includes
34
- .any
35
- .keys("plugins", "files", "ignores", "rules");
36
- });
37
- it("with valid plugins", () => {
38
- for (const config of configs)
39
- if ("plugins" in config)
40
- config.plugins
41
- .should.be
42
- .an("object");
43
- });
44
- it("or valid files", () => {
45
- for (const config of configs)
46
- if ("files" in config)
47
- config.files
48
- .should.be
49
- .an("array")
50
- .not.empty;
51
- });
52
- it("or valid ignores", () => {
53
- for (const config of configs)
54
- if ("ignores" in config) {
55
- config
56
- .ignores
57
- .should.be
58
- .an("array");
59
- for (const pattern of config.ignores)
60
- pattern
61
- .should.be
62
- .a("string")
63
- .not.empty;
64
- }
65
- });
66
- it("or valid rules", () => {
67
- for (const config of configs)
68
- if ("rules" in config) {
69
- config
70
- .rules
71
- .should.be
72
- .an("object")
73
- .not.empty;
74
- for (const rule of Object.keys(config.rules)) {
75
- rule
76
- .should
77
- .be
78
- .a("string");
79
- if (typeof config.rules[rule] !== "number")
80
- config.rules[rule]
81
- .should
82
- .be
83
- .an("array")
84
- .with
85
- .property("0")
86
- .a("number");
87
- }
88
- }
89
- });
90
- });
91
- });
92
- //# sourceMappingURL=index.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../tests/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,IAAI,MAAM,IAAI,CAAC;AACtB,OAAO,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,MAAM,mBAAmB,GAAG,CAAC,EAC7B,OAAO,GAAG,IAAI,CACZ,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAU,CAMT,EACH,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;AAEzB,KAAK,MAAM,KAAK,IAAI,QAAQ;IAC1B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAEvB,QAAQ,CACN,MAAM,EACN,GAAG,EAAE;IACH,QAAQ,CACN,QAAQ,EACR,GAAG,EAAE;QACH,EAAE,CACA,eAAe,EACf,GAAG,EAAE;YACH,IAAI;iBACD,MAAM,CAAC,EAAE;iBACT,CAAC,CAAC,UAAU,CAAC,CAAC;QACnB,CAAC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;IACF,QAAQ,CACN,QAAQ,EACR,GAAG,EAAE;QACH,EAAE,CACA,sBAAsB,EACtB,GAAG,EAAE;YACH,OAAO;iBACJ,MAAM,CAAC,EAAE;iBACT,EAAE,CAAC,OAAO,CAAC;iBACX,GAAG,CAAC,KAAK,CAAC;QACf,CAAC,CACF,CAAC;QACF,EAAE,CACA,sCAAsC,MAAM,CAAC,IAAI,aAAa,MAAM,CAAC,IAAI,GAAG,mBAAmB,cAAc,OAAO,CAAC,MAAM,GAAG,EA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AK,CAAC;gBACjB,CAAC;QACL,CAAC,CACF,CAAC;QACF,EAAE,CACA,gBAAgB,EAChB,GAAG,EAAE;YACH,KAAK,MAAM,MAAM,IAAI,OAAO;gBAC1B,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;oBACtB,MAAM;yBACH,KAAK;yBACL,MAAM,CAAC,EAAE;yBACT,EAAE,CAAC,QAAQ,CAAC;yBACZ,GAAG,CAAC,KAAK,CAAC;oBAEb,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;wBAC7C,IAAI;6BACD,MAAM;6BACN,EAAE;6BACF,CAAC,CAAC,QAAQ,CAAC,CAAC;wBAEf,IAAI,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ;4BACxC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAE;iCAChB,MAAM;iCACN,EAAE;iCACF,EAAE,CAAC,OAAO,CAAC;iCACX,IAAI;iCACJ,QAAQ,CAAC,GAAG,CAAC;iCACb,CAAC,CAAC,QAAQ,CAAC,CAAC;oBACnB,CAAC;gBACH,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -1,186 +0,0 @@
1
- const enum State {
2
- OFF = 0,
3
- WARN = 1,
4
- ERROR = 2,
5
- }
6
- const Plugin = "MOCK_PLUGIN",
7
- Parser = (scope: string) => `MOCK_PARSER:${scope}`;
8
-
9
- export const scopes = [
10
- "js",
11
- "ts",
12
- "svelte",
13
- "html",
14
- "json",
15
- "jsonc",
16
- "jsoncc",
17
- ] as const,
18
- optional = ["svelte"] as const,
19
- tree = [
20
- [
21
- "jsoncc",
22
- ["jsonc"],
23
- ],
24
- [
25
- "jsonc",
26
- ["json"],
27
- ],
28
- [
29
- "svelte",
30
- ["ts"],
31
- ],
32
- [
33
- "ts",
34
- ["js"],
35
- ],
36
- ] as const,
37
- imports = {
38
- plugins: {
39
- "@typescript-eslint": Plugin,
40
- html: Plugin,
41
- json: Plugin,
42
- jsonc: Plugin,
43
- },
44
- parsers: {
45
- ts: Parser("TS"),
46
- html: Parser("HTML"),
47
- },
48
- },
49
- settings = {
50
- ts: {
51
- languageOptions: {
52
- parser: "ts" as const,
53
- },
54
- },
55
- svelte: {
56
- languageOptions: {
57
- parser: "svelte" as const,
58
- },
59
- parserOptions: {
60
- parser: "ts" as const,
61
- extraFileExtensions: [".svelte"],
62
- },
63
- processor: "svelte/svelte",
64
- },
65
- html: {
66
- languageOptions: {
67
- parser: "html" as const,
68
- },
69
- parserOptions: {
70
- frontmatter: true,
71
- },
72
- language: "html/html",
73
- },
74
- json: {
75
- languageOptions: {
76
- allowTrailingCommas: true,
77
- },
78
- language: "json/jsonc",
79
- },
80
- },
81
- defaults = {
82
- files: {
83
- js: ["default.js"],
84
- ts: ["default.ts"],
85
- svelte: ["default.svelte"],
86
- html: ["default.html"],
87
- json: ["default.json"],
88
- jsonc: ["default.jsonc"],
89
- jsoncc: ["default-comma.jsonc"],
90
- },
91
- ignores: {
92
- "*": ["ignore/default.*"],
93
- js: ["ignore/default.js"],
94
- json: ["ignore/default.json"],
95
- jsoncc: ["ignore/default-comma.jsonc"],
96
- },
97
- rules: {
98
- "*": [
99
- {
100
- rules: {
101
- global0: State.WARN,
102
- global1: State.ERROR,
103
- },
104
- },
105
- ],
106
- js: [
107
- {
108
- rules: {
109
- vanilla: State.ERROR,
110
- vanilla0: State.ERROR,
111
- vanilla1: State.ERROR,
112
- vanilla2: State.ERROR,
113
- },
114
- },
115
- ],
116
- ts: [
117
- {
118
- rules: {
119
- vanilla0: State.OFF,
120
- },
121
- },
122
- {
123
- rules: {
124
- "@typescript-eslint/enums": State.ERROR,
125
- "@typescript-eslint/destructure-expression": State.ERROR,
126
- "@typescript-eslint/global": State.ERROR,
127
- },
128
- },
129
- ],
130
- svelte: [
131
- {
132
- rules: {
133
- vanilla1: State.OFF,
134
- },
135
- },
136
- {
137
- rules: {
138
- "svelte/tags": State.ERROR,
139
- },
140
- },
141
- ],
142
- html: [
143
- {
144
- rules: {
145
- "html/attribute": State.ERROR,
146
- },
147
- },
148
- ],
149
- json: [
150
- {
151
- rules: {
152
- "jsonc/property-check": State.ERROR,
153
- "jsonc/comment": [
154
- State.ERROR,
155
- "never",
156
- ] as const,
157
- "jsonc/trailing-comma": [
158
- State.ERROR,
159
- "never",
160
- ] as const,
161
- },
162
- },
163
- ],
164
- jsonc: [
165
- {
166
- rules: {
167
- "jsonc/comment": [
168
- State.ERROR,
169
- "allow",
170
- ] as const,
171
- },
172
- },
173
- ],
174
- jsoncc: [
175
- {
176
- rules: {
177
- "jsonc/trailing-comma": [
178
- State.ERROR,
179
- "allow",
180
- ] as const,
181
- },
182
- },
183
- ],
184
- },
185
- },
186
- extensions = {};
@@ -1,158 +0,0 @@
1
- import "chai/register-should.js";
2
- import Core from "..";
3
- import {
4
- scopes,
5
- optional,
6
- tree,
7
- imports,
8
- settings,
9
- defaults,
10
- extensions,
11
- } from "./index.input.spec";
12
-
13
- const GLOBAL_CONFIG_COUNT = 1,
14
- configs = Core(
15
- scopes,
16
- optional,
17
- tree,
18
- imports,
19
- settings,
20
- defaults,
21
- extensions,
22
- ) as {
23
- files?: (string | string[])[];
24
- ignores?: string[];
25
- rules?: Record<string, unknown>;
26
- plugins?: object;
27
- }[],
28
- Scopes = new Set(scopes);
29
-
30
- for (const scope of optional)
31
- Scopes.delete(scope);
32
-
33
- describe(
34
- "Core",
35
- () => {
36
- describe(
37
- "module",
38
- () => {
39
- it(
40
- "is a function",
41
- () => {
42
- Core
43
- .should.be
44
- .a("function");
45
- },
46
- );
47
- },
48
- );
49
- describe(
50
- "output",
51
- () => {
52
- it(
53
- "is a non-empty array",
54
- () => {
55
- configs
56
- .should.be
57
- .an("array")
58
- .not.empty;
59
- },
60
- );
61
- it(
62
- `length >= (*/plugins + */ignores + ${Scopes.size} scopes = ${Scopes.size + GLOBAL_CONFIG_COUNT}) [Actual: ${configs.length}]`,
63
- () => {
64
- configs
65
- .should.have
66
- .lengthOf
67
- .at.least(Scopes.size + GLOBAL_CONFIG_COUNT);
68
- },
69
- );
70
- it(
71
- "of config objects",
72
- () => {
73
- for (const config of configs)
74
- config
75
- .should.be
76
- .an("object")
77
- .includes
78
- .any
79
- .keys(
80
- "plugins",
81
- "files",
82
- "ignores",
83
- "rules",
84
- );
85
- },
86
- );
87
- it(
88
- "with valid plugins",
89
- () => {
90
- for (const config of configs)
91
- if ("plugins" in config)
92
- config.plugins
93
- .should.be
94
- .an("object");
95
- },
96
- );
97
- it(
98
- "or valid files",
99
- () => {
100
- for (const config of configs)
101
- if ("files" in config)
102
- config.files
103
- .should.be
104
- .an("array")
105
- .not.empty;
106
- },
107
- );
108
- it(
109
- "or valid ignores",
110
- () => {
111
- for (const config of configs)
112
- if ("ignores" in config) {
113
- config
114
- .ignores
115
- .should.be
116
- .an("array");
117
-
118
- for (const pattern of config.ignores)
119
- pattern
120
- .should.be
121
- .a("string")
122
- .not.empty;
123
- }
124
- },
125
- );
126
- it(
127
- "or valid rules",
128
- () => {
129
- for (const config of configs)
130
- if ("rules" in config) {
131
- config
132
- .rules
133
- .should.be
134
- .an("object")
135
- .not.empty;
136
-
137
- for (const rule of Object.keys(config.rules)) {
138
- rule
139
- .should
140
- .be
141
- .a("string");
142
-
143
- if (typeof config.rules[rule] !== "number")
144
- config.rules[rule]!
145
- .should
146
- .be
147
- .an("array")
148
- .with
149
- .property("0")
150
- .a("number");
151
- }
152
- }
153
- },
154
- );
155
- },
156
- );
157
- },
158
- );
package/tests/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export function mochaGlobalSetup() {
2
- //
3
- }
@@ -1,24 +0,0 @@
1
- {
2
- "extends": "../tsconfig-base",
3
- "include": [
4
- "../typings/**/*",
5
- "**/*",
6
- ],
7
- "references": [
8
- {
9
- "path": "../src",
10
- },
11
- ],
12
- "compilerOptions": {
13
- "rootDirs": [
14
- "..",
15
- "../src",
16
- ],
17
- "types": [
18
- "mocha",
19
- "chai",
20
- /* {CONFIGURE} */
21
- ],
22
- "outDir": "../dist/tests",
23
- },
24
- }