@eslinted/core 14.0.0-rc.4 → 14.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.spec.js +3 -6
- package/dist/index.spec.js.map +1 -1
- package/dist/scopes/index.spec.js +16 -10
- package/dist/scopes/index.spec.js.map +1 -1
- package/dist/scopes/tree.spec.d.ts +2 -0
- package/dist/scopes/tree.spec.d.ts.map +1 -0
- package/dist/scopes/tree.spec.js +47 -0
- package/dist/scopes/tree.spec.js.map +1 -0
- package/package.json +2 -2
- package/src/index.spec.ts +3 -8
- package/src/scopes/index.spec.ts +16 -10
- package/src/scopes/tree.spec.ts +49 -0
package/dist/index.spec.js
CHANGED
@@ -11,13 +11,10 @@ describe("Core", function () {
|
|
11
11
|
});
|
12
12
|
});
|
13
13
|
describe("output", function () {
|
14
|
-
it("is
|
14
|
+
it("is a non-empty array", function () {
|
15
15
|
expect(configs)
|
16
|
-
.an("array")
|
17
|
-
|
18
|
-
it("non-empty", function () {
|
19
|
-
expect(configs)
|
20
|
-
.has.lengthOf.above(1);
|
16
|
+
.an("array")
|
17
|
+
.not.empty;
|
21
18
|
});
|
22
19
|
it(`with length >= plugins + */ignores + */settings + ${scopes.length} scopes = ${scopes.length + 3} [Actual: ${configs.length}`, function () {
|
23
20
|
expect(configs)
|
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,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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8
|
-
.
|
8
|
+
.not.empty;
|
9
|
+
});
|
10
|
+
});
|
11
|
+
describe("members", function () {
|
12
|
+
it("are unique", function () {
|
13
|
+
expect(scopes.length)
|
14
|
+
.equals(new Set(scopes).size);
|
9
15
|
});
|
10
16
|
});
|
11
17
|
describe("order", function () {
|
12
|
-
it("jsonc > json", function () {
|
18
|
+
it("`jsonc` > `json`", function () {
|
13
19
|
expect(scopes)
|
14
20
|
.includes.members(["jsonc", "json"]);
|
15
21
|
expect(scopes.indexOf("jsonc"))
|
16
22
|
.greaterThan(scopes.indexOf("json"));
|
17
23
|
});
|
18
|
-
it("
|
19
|
-
expect(scopes)
|
20
|
-
.includes.members(["ts", "js"]);
|
21
|
-
expect(scopes.indexOf("ts"))
|
22
|
-
.greaterThan(scopes.indexOf("js"));
|
23
|
-
});
|
24
|
-
it("mocha > ts", function () {
|
24
|
+
it("`mocha` > `ts`", function () {
|
25
25
|
expect(scopes)
|
26
26
|
.includes.members(["mocha", "ts"]);
|
27
27
|
expect(scopes.indexOf("mocha"))
|
28
28
|
.greaterThan(scopes.indexOf("ts"));
|
29
29
|
});
|
30
|
-
it("svelte > ts", function () {
|
30
|
+
it("`svelte` > `ts`", function () {
|
31
31
|
expect(scopes).includes.members(["svelte", "ts"]);
|
32
32
|
expect(scopes.indexOf("svelte"))
|
33
33
|
.greaterThan(scopes.indexOf("ts"));
|
34
34
|
});
|
35
|
+
it("`ts` > `js`", function () {
|
36
|
+
expect(scopes)
|
37
|
+
.includes.members(["ts", "js"]);
|
38
|
+
expect(scopes.indexOf("ts"))
|
39
|
+
.greaterThan(scopes.indexOf("js"));
|
40
|
+
});
|
35
41
|
});
|
36
42
|
});
|
37
43
|
//# sourceMappingURL=index.spec.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../src/scopes/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAA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C,OAAO,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;YACrC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;iBAC5B,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,iBAAiB,EAAE;YACpB,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;YAClD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;iBAC7B,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,aAAa,EAAE;YAChB,MAAM,CAAC,MAAM,CAAC;iBACX,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YAClC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;iBACzB,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tree.spec.d.ts","sourceRoot":"","sources":["../../src/scopes/tree.spec.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { expect } from "chai";
|
2
|
+
import { tree } from "./index.js";
|
3
|
+
const nodes = tree.map(([scope]) => scope);
|
4
|
+
describe("Scope Tree", function () {
|
5
|
+
describe("shape", function () {
|
6
|
+
it("is an array", function () {
|
7
|
+
expect(tree)
|
8
|
+
.an("array");
|
9
|
+
});
|
10
|
+
});
|
11
|
+
describe("members", function () {
|
12
|
+
it("are unique", function () {
|
13
|
+
expect(tree.length)
|
14
|
+
.equals(new Set(nodes).size);
|
15
|
+
});
|
16
|
+
it("omit `js`", function () {
|
17
|
+
expect(nodes)
|
18
|
+
.to.not.include.members(["js"]);
|
19
|
+
});
|
20
|
+
});
|
21
|
+
describe("order", function () {
|
22
|
+
it("`jsonc` < [`json`]?", function () {
|
23
|
+
expect(nodes)
|
24
|
+
.includes.members(["jsonc"]);
|
25
|
+
expect(nodes.indexOf("jsonc"))
|
26
|
+
.lessThan(-nodes.indexOf("json") * tree.length);
|
27
|
+
});
|
28
|
+
it("`mocha` < `ts`", function () {
|
29
|
+
expect(nodes)
|
30
|
+
.includes.members(["mocha", "ts"]);
|
31
|
+
expect(nodes.indexOf("mocha"))
|
32
|
+
.lessThan(nodes.indexOf("ts"));
|
33
|
+
});
|
34
|
+
it("`svelte` < `ts`", function () {
|
35
|
+
expect(nodes).includes.members(["svelte", "ts"]);
|
36
|
+
expect(nodes.indexOf("svelte"))
|
37
|
+
.lessThan(nodes.indexOf("ts"));
|
38
|
+
});
|
39
|
+
it("`ts` is last", function () {
|
40
|
+
expect(nodes)
|
41
|
+
.includes.members(["ts"]);
|
42
|
+
expect(nodes.indexOf("ts"))
|
43
|
+
.equals(tree.length - 1);
|
44
|
+
});
|
45
|
+
});
|
46
|
+
});
|
47
|
+
//# sourceMappingURL=tree.spec.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tree.spec.js","sourceRoot":"","sources":["../../src/scopes/tree.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAEzB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAE3C,QAAQ,CAAC,YAAY,EAAE;IACrB,QAAQ,CAAC,OAAO,EAAE;QAChB,EAAE,CAAC,aAAa,EAAE;YA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EAAE,IAAI,CAAC,CAAC,CAAC;YACjD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;iBAC5B,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,cAAc,EAAE;YACjB,MAAM,CAAC,KAAK,CAAC;iBACV,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YAC5B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;iBACxB,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"_schemaVersion": "22.11.0",
|
3
3
|
"name": "@eslinted/core",
|
4
|
-
"version": "14.0.
|
4
|
+
"version": "14.0.1",
|
5
5
|
"description": "Core ESLint flat config factory npm package `linted`.",
|
6
6
|
"keywords": [],
|
7
7
|
"repository": "github:jimmy-zhening-luo/linted-core",
|
@@ -32,7 +32,7 @@
|
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
34
34
|
"@types/chai": "^5.0.1",
|
35
|
-
"@types/mocha": "^10.0.
|
35
|
+
"@types/mocha": "^10.0.10",
|
36
36
|
"chai": "^5.1.2",
|
37
37
|
"mocha": "^10.8.2",
|
38
38
|
"npm-run-all": "^4.1.5",
|
package/src/index.spec.ts
CHANGED
@@ -13,15 +13,10 @@ describe("Core", function () {
|
|
13
13
|
});
|
14
14
|
});
|
15
15
|
describe("output", function () {
|
16
|
-
it("is
|
16
|
+
it("is a non-empty array", function () {
|
17
17
|
expect(configs)
|
18
|
-
.an("array")
|
19
|
-
|
20
|
-
it("non-empty", function () {
|
21
|
-
expect(configs)
|
22
|
-
.has.lengthOf.above(1);
|
23
|
-
// .not.empty;
|
24
|
-
// replace with not.empty after new rule
|
18
|
+
.an("array")
|
19
|
+
.not.empty;
|
25
20
|
});
|
26
21
|
it(`with length >= plugins + */ignores + */settings + ${scopes.length} scopes = ${scopes.length + 3} [Actual: ${configs.length}`, function () {
|
27
22
|
expect(configs)
|
package/src/scopes/index.spec.ts
CHANGED
@@ -6,32 +6,38 @@ describe("Scopes", function () {
|
|
6
6
|
it("is a non-empty array", function () {
|
7
7
|
expect(scopes)
|
8
8
|
.an("array")
|
9
|
-
.
|
9
|
+
.not.empty;
|
10
|
+
});
|
11
|
+
});
|
12
|
+
describe("members", function () {
|
13
|
+
it("are unique", function () {
|
14
|
+
expect(scopes.length)
|
15
|
+
.equals(new Set(scopes).size);
|
10
16
|
});
|
11
17
|
});
|
12
18
|
describe("order", function () {
|
13
|
-
it("jsonc > json", function () {
|
19
|
+
it("`jsonc` > `json`", function () {
|
14
20
|
expect(scopes)
|
15
21
|
.includes.members(["jsonc", "json"]);
|
16
22
|
expect(scopes.indexOf("jsonc"))
|
17
23
|
.greaterThan(scopes.indexOf("json"));
|
18
24
|
});
|
19
|
-
it("
|
20
|
-
expect(scopes)
|
21
|
-
.includes.members(["ts", "js"]);
|
22
|
-
expect(scopes.indexOf("ts"))
|
23
|
-
.greaterThan(scopes.indexOf("js"));
|
24
|
-
});
|
25
|
-
it("mocha > ts", function () {
|
25
|
+
it("`mocha` > `ts`", function () {
|
26
26
|
expect(scopes)
|
27
27
|
.includes.members(["mocha", "ts"]);
|
28
28
|
expect(scopes.indexOf("mocha"))
|
29
29
|
.greaterThan(scopes.indexOf("ts"));
|
30
30
|
});
|
31
|
-
it("svelte > ts", function () {
|
31
|
+
it("`svelte` > `ts`", function () {
|
32
32
|
expect(scopes).includes.members(["svelte", "ts"]);
|
33
33
|
expect(scopes.indexOf("svelte"))
|
34
34
|
.greaterThan(scopes.indexOf("ts"));
|
35
35
|
});
|
36
|
+
it("`ts` > `js`", function () {
|
37
|
+
expect(scopes)
|
38
|
+
.includes.members(["ts", "js"]);
|
39
|
+
expect(scopes.indexOf("ts"))
|
40
|
+
.greaterThan(scopes.indexOf("js"));
|
41
|
+
});
|
36
42
|
});
|
37
43
|
});
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { expect } from "chai";
|
2
|
+
import { tree } from ".";
|
3
|
+
|
4
|
+
const nodes = tree.map(([scope]) => scope);
|
5
|
+
|
6
|
+
describe("Scope Tree", function () {
|
7
|
+
describe("shape", function () {
|
8
|
+
it("is an array", function () {
|
9
|
+
expect(tree)
|
10
|
+
.an("array");
|
11
|
+
});
|
12
|
+
});
|
13
|
+
describe("members", function () {
|
14
|
+
it("are unique", function () {
|
15
|
+
expect(tree.length)
|
16
|
+
.equals(new Set(nodes).size);
|
17
|
+
});
|
18
|
+
it("omit `js`", function () {
|
19
|
+
expect(nodes)
|
20
|
+
.to.not.include.members(["js"]);
|
21
|
+
});
|
22
|
+
});
|
23
|
+
describe("order", function () {
|
24
|
+
it("`jsonc` < [`json`]?", function () {
|
25
|
+
expect(nodes)
|
26
|
+
.includes.members(["jsonc"]);
|
27
|
+
expect(nodes.indexOf("jsonc"))
|
28
|
+
// @ts-expect-error: TEST: `json` is not in the tree
|
29
|
+
.lessThan(-nodes.indexOf("json") * tree.length);
|
30
|
+
});
|
31
|
+
it("`mocha` < `ts`", function () {
|
32
|
+
expect(nodes)
|
33
|
+
.includes.members(["mocha", "ts"]);
|
34
|
+
expect(nodes.indexOf("mocha"))
|
35
|
+
.lessThan(nodes.indexOf("ts"));
|
36
|
+
});
|
37
|
+
it("`svelte` < `ts`", function () {
|
38
|
+
expect(nodes).includes.members(["svelte", "ts"]);
|
39
|
+
expect(nodes.indexOf("svelte"))
|
40
|
+
.lessThan(nodes.indexOf("ts"));
|
41
|
+
});
|
42
|
+
it("`ts` is last", function () {
|
43
|
+
expect(nodes)
|
44
|
+
.includes.members(["ts"]);
|
45
|
+
expect(nodes.indexOf("ts"))
|
46
|
+
.equals(tree.length - 1);
|
47
|
+
});
|
48
|
+
});
|
49
|
+
});
|