linted 32.5.1 → 32.6.0-rc.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/scope/index.d.ts +16 -0
- package/dist/scope/index.d.ts.map +1 -0
- package/dist/scope/index.js +14 -0
- package/dist/scope/index.js.map +1 -0
- package/dist/scope/index.spec.d.ts +2 -0
- package/dist/scope/index.spec.d.ts.map +1 -0
- package/dist/scope/index.spec.js +86 -0
- package/dist/scope/index.spec.js.map +1 -0
- package/dist/scope/tree.d.ts +2 -0
- package/dist/scope/tree.d.ts.map +1 -0
- package/dist/scope/tree.js +23 -0
- package/dist/scope/tree.js.map +1 -0
- package/dist/scope/tree.spec.d.ts +2 -0
- package/dist/scope/tree.spec.d.ts.map +1 -0
- package/dist/scope/tree.spec.js +78 -0
- package/dist/scope/tree.spec.js.map +1 -0
- package/package.json +3 -3
- package/src/index.ts +12 -6
- package/src/scope/index.spec.ts +136 -0
- package/src/scope/index.ts +14 -0
- package/src/scope/tree.spec.ts +124 -0
- package/src/scope/tree.ts +22 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import Core from "@eslinted/core";
|
|
2
|
-
export default function (extensions?: Parameters<typeof Core>[
|
|
2
|
+
export default function (extensions?: Parameters<typeof Core>[4]["extensions"]): unknown[];
|
|
3
3
|
//# 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,IAAI,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,gBAAgB,CAAC;AASlC,MAAM,CAAC,OAAO,WACZ,UAAU,GAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAM,aAY1D"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import Core from "@eslinted/core";
|
|
2
2
|
import defaults from "@eslinted/defaults";
|
|
3
3
|
import imports from "./imports/index.js";
|
|
4
|
+
import { scopes, optional, tree, } from "./scope/index.js";
|
|
4
5
|
export default function (extensions = {}) {
|
|
5
|
-
return Core({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
defaults,
|
|
9
|
-
extensions,
|
|
10
|
-
},
|
|
6
|
+
return Core(scopes, optional, tree, imports, {
|
|
7
|
+
defaults,
|
|
8
|
+
extensions,
|
|
11
9
|
});
|
|
12
10
|
}
|
|
13
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,OAAO,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EACL,MAAM,EACN,QAAQ,EACR,IAAI,GACL,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,WACZ,aAAuD,EAAE;IAEzD,OAAO,IAAI,CACT,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP;QACE,QAAQ;QACR,UAAU;KACX,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { tree } from "./tree.js";
|
|
2
|
+
export declare const scopes: readonly [
|
|
3
|
+
"js",
|
|
4
|
+
"ts",
|
|
5
|
+
"mocha",
|
|
6
|
+
"svelte",
|
|
7
|
+
"html",
|
|
8
|
+
"css",
|
|
9
|
+
"json",
|
|
10
|
+
"jsonc",
|
|
11
|
+
"jsoncc",
|
|
12
|
+
"yml"
|
|
13
|
+
], optional: readonly [
|
|
14
|
+
"svelte"
|
|
15
|
+
];
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,eAAO,MAAM,MAAM,2FAWT,EACV,QAAQ,qBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,KAAK;CACG,EACV,QAAQ,GAAG,CAAC,QAAQ,CAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../src/scope/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import "chai/register-should.js";
|
|
2
|
+
import { scopes } from "./index.js";
|
|
3
|
+
describe("Scopes", function () {
|
|
4
|
+
describe("shape", function () {
|
|
5
|
+
it("is a non-empty array", function () {
|
|
6
|
+
scopes
|
|
7
|
+
.should.be
|
|
8
|
+
.an("array")
|
|
9
|
+
.not.empty;
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
describe("members", function () {
|
|
13
|
+
it("are unique", function () {
|
|
14
|
+
scopes
|
|
15
|
+
.length
|
|
16
|
+
.should
|
|
17
|
+
.equal(new Set(scopes)
|
|
18
|
+
.size);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe("order", function () {
|
|
22
|
+
it("`jsoncc` > `jsonc` > `json`", function () {
|
|
23
|
+
scopes
|
|
24
|
+
.should
|
|
25
|
+
.include
|
|
26
|
+
.members([
|
|
27
|
+
"jsoncc",
|
|
28
|
+
"jsonc",
|
|
29
|
+
"json",
|
|
30
|
+
]);
|
|
31
|
+
scopes
|
|
32
|
+
.indexOf("jsoncc")
|
|
33
|
+
.should.be
|
|
34
|
+
.greaterThan(scopes
|
|
35
|
+
.indexOf("jsonc"));
|
|
36
|
+
scopes
|
|
37
|
+
.indexOf("jsonc")
|
|
38
|
+
.should.be
|
|
39
|
+
.greaterThan(scopes
|
|
40
|
+
.indexOf("json"));
|
|
41
|
+
});
|
|
42
|
+
it("`mocha` > `ts`", function () {
|
|
43
|
+
scopes
|
|
44
|
+
.should
|
|
45
|
+
.include
|
|
46
|
+
.members([
|
|
47
|
+
"mocha",
|
|
48
|
+
"ts",
|
|
49
|
+
]);
|
|
50
|
+
scopes
|
|
51
|
+
.indexOf("mocha")
|
|
52
|
+
.should.be
|
|
53
|
+
.greaterThan(scopes
|
|
54
|
+
.indexOf("ts"));
|
|
55
|
+
});
|
|
56
|
+
it("`svelte` > `ts`", function () {
|
|
57
|
+
scopes
|
|
58
|
+
.should
|
|
59
|
+
.include
|
|
60
|
+
.members([
|
|
61
|
+
"svelte",
|
|
62
|
+
"ts",
|
|
63
|
+
]);
|
|
64
|
+
scopes
|
|
65
|
+
.indexOf("svelte")
|
|
66
|
+
.should.be
|
|
67
|
+
.greaterThan(scopes
|
|
68
|
+
.indexOf("ts"));
|
|
69
|
+
});
|
|
70
|
+
it("`ts` > `js`", function () {
|
|
71
|
+
scopes
|
|
72
|
+
.should
|
|
73
|
+
.include
|
|
74
|
+
.members([
|
|
75
|
+
"ts",
|
|
76
|
+
"js",
|
|
77
|
+
]);
|
|
78
|
+
scopes
|
|
79
|
+
.indexOf("ts")
|
|
80
|
+
.should.be
|
|
81
|
+
.greaterThan(scopes
|
|
82
|
+
.indexOf("js"));
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=index.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../src/scope/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAE3B,QAAQ,CACN,QAAQ,EACR;IACE,QAAQ,CACN,OAAO,EACP;QACE,EAAE,CACA,sBAAsB,EACtB;YACE,MAAM;iBACH,MAAM,CAAC,EAAE;iBACT,EAAE,CAAC,OAAO,CAAC;iBACX,GAAG,CAAC,KAAK,CAAC;QACf,CAAC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;IACF,QAAQ,CACN,SAAS,EACT;QACE,EAAE,CACA,YAAY,EACZ;YACE,MAAM;iBACH,MAAM;iBACN,MAAM;iBACN,KAAK,CACJ,IAAI,GAAG,CAAC,MAAM,CAAC;iBACZ,IAAI,CACR,CAAC;QACN,CAAC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;IACF,QAAQ,CACN,OAAO,EACP;QACE,EAAE,CACA,6BAA6B,EAC7B;YACE,MAAM;iBACH,MAAM;iBACN,OAAO;iBACP,OAAO,CACN;gBACE,QAAQ;gBACR,OAAO;gBACP,MAAM;aACP,CACF,CAAC;YACJ,MAAM;iBACH,OAAO,CAAC,QAAQ,CAAC;iBACjB,MAAM,CAAC,EAAE;iBACT,WAAW,CACV,MAAM;iBACH,OAAO,CAAC,OAAO,CAAC,CACpB,CAAC;YACJ,MAAM;iBACH,OAAO,CAAC,OAAO,CAAC;iBAChB,MAAM,CAAC,EAAE;iBACT,WAAW,CACV,MAAM;iBACH,OAAO,CAAC,MAAM,CAAC,CACnB,CAAC;QACN,CAAC,CACF,CAAC;QACF,EAAE,CACA,gBAAgB,EAChB;YACE,MAAM;iBACH,MAAM;iBACN,OAAO;iBACP,OAAO,CACN;gBACE,OAAO;gBACP,IAAI;aACL,CACF,CAAC;YACJ,MAAM;iBACH,OAAO,CAAC,OAAO,CAAC;iBAChB,MAAM,CAAC,EAAE;iBACT,WAAW,CACV,MAAM;iBACH,OAAO,CAAC,IAAI,CAAC,CACjB,CAAC;QACN,CAAC,CACF,CAAC;QACF,EAAE,CACA,iBAAiB,EACjB;YACE,MAAM;iBACH,MAAM;iBACN,OAAO;iBACP,OAAO,CACN;gBACE,QAAQ;gBACR,IAAI;aACL,CACF,CAAC;YACJ,MAAM;iBACH,OAAO,CAAC,QAAQ,CAAC;iBACjB,MAAM,CAAC,EAAE;iBACT,WAAW,CACV,MAAM;iBACH,OAAO,CAAC,IAAI,CAAC,CACjB,CAAC;QACN,CAAC,CACF,CAAC;QACF,EAAE,CACA,aAAa,EACb;YACE,MAAM;iBACH,MAAM;iBACN,OAAO;iBACP,OAAO,CACN;gBACE,IAAI;gBACJ,IAAI;aACL,CACF,CAAC;YACJ,MAAM;iBACH,OAAO,CAAC,IAAI,CAAC;iBACb,MAAM,CAAC,EAAE;iBACT,WAAW,CACV,MAAM;iBACH,OAAO,CAAC,IAAI,CAAC,CACjB,CAAC;QACN,CAAC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/scope/tree.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,qMAqBhB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/scope/tree.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB;QACE,QAAQ;QACR,CAAC,OAAO,CAAC;KACD;IACV;QACE,OAAO;QACP,CAAC,MAAM,CAAC;KACA;IACV;QACE,OAAO;QACP,CAAC,IAAI,CAAC;KACE;IACV;QACE,QAAQ;QACR,CAAC,IAAI,CAAC;KACE;IACV;QACE,IAAI;QACJ,CAAC,IAAI,CAAC;KACE;CACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.spec.d.ts","sourceRoot":"","sources":["../../src/scope/tree.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import "chai/register-should.js";
|
|
2
|
+
import { tree } from "./tree.js";
|
|
3
|
+
const nodes = tree.map(([scope]) => scope);
|
|
4
|
+
describe("Tree", function () {
|
|
5
|
+
describe("shape", function () {
|
|
6
|
+
it("is an array", function () {
|
|
7
|
+
tree
|
|
8
|
+
.should.be
|
|
9
|
+
.an("array");
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
describe("members", function () {
|
|
13
|
+
it("are unique", function () {
|
|
14
|
+
tree
|
|
15
|
+
.length
|
|
16
|
+
.should
|
|
17
|
+
.equal(new Set(nodes)
|
|
18
|
+
.size);
|
|
19
|
+
});
|
|
20
|
+
it("omit `js`", function () {
|
|
21
|
+
nodes
|
|
22
|
+
.should
|
|
23
|
+
.not.include
|
|
24
|
+
.members(["js"]);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
describe("order", function () {
|
|
28
|
+
it("`jsoncc` < [`jsonc`]?", function () {
|
|
29
|
+
nodes
|
|
30
|
+
.should
|
|
31
|
+
.include
|
|
32
|
+
.members(["jsoncc"]);
|
|
33
|
+
nodes
|
|
34
|
+
.indexOf("jsoncc")
|
|
35
|
+
.should.be
|
|
36
|
+
.lessThan(nodes.indexOf("jsonc") * tree.length);
|
|
37
|
+
});
|
|
38
|
+
it("`mocha` < `ts`", function () {
|
|
39
|
+
nodes
|
|
40
|
+
.should
|
|
41
|
+
.include
|
|
42
|
+
.members([
|
|
43
|
+
"mocha",
|
|
44
|
+
"ts",
|
|
45
|
+
]);
|
|
46
|
+
nodes
|
|
47
|
+
.indexOf("mocha")
|
|
48
|
+
.should.be
|
|
49
|
+
.lessThan(nodes
|
|
50
|
+
.indexOf("ts"));
|
|
51
|
+
});
|
|
52
|
+
it("`svelte` < `ts`", function () {
|
|
53
|
+
nodes
|
|
54
|
+
.should
|
|
55
|
+
.include
|
|
56
|
+
.members([
|
|
57
|
+
"svelte",
|
|
58
|
+
"ts",
|
|
59
|
+
]);
|
|
60
|
+
nodes
|
|
61
|
+
.indexOf("svelte")
|
|
62
|
+
.should.be
|
|
63
|
+
.lessThan(nodes
|
|
64
|
+
.indexOf("ts"));
|
|
65
|
+
});
|
|
66
|
+
it("`ts` is last", function () {
|
|
67
|
+
nodes
|
|
68
|
+
.should
|
|
69
|
+
.include
|
|
70
|
+
.members(["ts"]);
|
|
71
|
+
nodes
|
|
72
|
+
.indexOf("ts")
|
|
73
|
+
.should
|
|
74
|
+
.equal(tree.length - 1);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=tree.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.spec.js","sourceRoot":"","sources":["../../src/scope/tree.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAE3C,QAAQ,CACN,MAAM,EACN;IACE,QAAQ,CACN,OAAO,EACP;QACE,EAAE,CACA,aAAa,EACb;YACE,IAAI;iBACD,MAAM,CAAC,EAAE;iBACT,EAAE,CAAC,OAAO,CAAC,CAAC;QACjB,CAAC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;IACF,QAAQ,CACN,SAAS,EACT;QACE,EAAE,CACA,YAAY,EACZ;YACE,IAAI;iBACD,MAAM;iBACN,MAAM;iBACN,KAAK,CACJ,IAAI,GAAG,CAAC,KAAK,CAAC;iBACX,IAAI,CACR,CAAC;QACN,CAAC,CACF,CAAC;QACF,EAAE,CACA,WAAW,EACX;YACE,KAAK;iBACF,MAAM;iBACN,GAAG,CAAC,OAAO;iBACX,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACrB,CAAC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;IACF,QAAQ,CACN,OAAO,EACP;QACE,EAAE,CACA,uBAAuB,EACvB;YACE,KAAK;iBACF,MAAM;iBACN,OAAO;iBACP,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YACvB,KAAK;iBACF,OAAO,CAAC,QAAQ,CAAC;iBACjB,MAAM,CAAC,EAAE;iBACT,QAAQ,CACP,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CACrC,CAAC;QACN,CAAC,CACF,CAAC;QACF,EAAE,CACA,gBAAgB,EAChB;YACE,KAAK;iBACF,MAAM;iBACN,OAAO;iBACP,OAAO,CACN;gBACE,OAAO;gBACP,IAAI;aACL,CACF,CAAC;YACJ,KAAK;iBACF,OAAO,CAAC,OAAO,CAAC;iBAChB,MAAM,CAAC,EAAE;iBACT,QAAQ,CACP,KAAK;iBACF,OAAO,CAAC,IAAI,CAAC,CACjB,CAAC;QACN,CAAC,CACF,CAAC;QACF,EAAE,CACA,iBAAiB,EACjB;YACE,KAAK;iBACF,MAAM;iBACN,OAAO;iBACP,OAAO,CACN;gBACE,QAAQ;gBACR,IAAI;aACL,CACF,CAAC;YACJ,KAAK;iBACF,OAAO,CAAC,QAAQ,CAAC;iBACjB,MAAM,CAAC,EAAE;iBACT,QAAQ,CACP,KAAK;iBACF,OAAO,CAAC,IAAI,CAAC,CACjB,CAAC;QACN,CAAC,CACF,CAAC;QACF,EAAE,CACA,cAAc,EACd;YACE,KAAK;iBACF,MAAM;iBACN,OAAO;iBACP,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACnB,KAAK;iBACF,OAAO,CAAC,IAAI,CAAC;iBACb,MAAM;iBACN,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC5B,CAAC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CACF,CAAC"}
|
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": "linted",
|
|
6
|
-
"version": "32.
|
|
6
|
+
"version": "32.6.0-rc.1",
|
|
7
7
|
"repository": "github:jimmy-zhening-luo/linted",
|
|
8
8
|
"description": "ESLint mono-plugin bundler with strict, opinionated defaults for (Stylistic) JavaScript, TypeScript, Svelte, HTML, Tailwind/CSS, JSON, JSONC, YAML, and Mocha.",
|
|
9
9
|
"keywords": [
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@eslint/css": "0.13.0",
|
|
55
55
|
"@eslint/json": "0.13.2",
|
|
56
|
-
"@eslinted/core": "
|
|
57
|
-
"@eslinted/defaults": "15.0.
|
|
56
|
+
"@eslinted/core": "27.0.0",
|
|
57
|
+
"@eslinted/defaults": "15.0.1",
|
|
58
58
|
"@html-eslint/eslint-plugin": "0.47.0",
|
|
59
59
|
"@stylistic/eslint-plugin": "5.4.0",
|
|
60
60
|
"eslint-plugin-chai-expect": "3.1.0",
|
package/src/index.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import Core from "@eslinted/core";
|
|
2
2
|
import defaults from "@eslinted/defaults";
|
|
3
3
|
import imports from "./imports";
|
|
4
|
+
import {
|
|
5
|
+
scopes,
|
|
6
|
+
optional,
|
|
7
|
+
tree,
|
|
8
|
+
} from "./scope";
|
|
4
9
|
|
|
5
10
|
export default function (
|
|
6
|
-
extensions: Parameters<typeof Core>[
|
|
11
|
+
extensions: Parameters<typeof Core>[4]["extensions"] = {},
|
|
7
12
|
) {
|
|
8
13
|
return Core(
|
|
14
|
+
scopes,
|
|
15
|
+
optional,
|
|
16
|
+
tree,
|
|
17
|
+
imports,
|
|
9
18
|
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
defaults,
|
|
13
|
-
extensions,
|
|
14
|
-
},
|
|
19
|
+
defaults,
|
|
20
|
+
extensions,
|
|
15
21
|
},
|
|
16
22
|
);
|
|
17
23
|
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import "chai/register-should.js";
|
|
2
|
+
import { scopes } from ".";
|
|
3
|
+
|
|
4
|
+
describe(
|
|
5
|
+
"Scopes",
|
|
6
|
+
function () {
|
|
7
|
+
describe(
|
|
8
|
+
"shape",
|
|
9
|
+
function () {
|
|
10
|
+
it(
|
|
11
|
+
"is a non-empty array",
|
|
12
|
+
function () {
|
|
13
|
+
scopes
|
|
14
|
+
.should.be
|
|
15
|
+
.an("array")
|
|
16
|
+
.not.empty;
|
|
17
|
+
},
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
describe(
|
|
22
|
+
"members",
|
|
23
|
+
function () {
|
|
24
|
+
it(
|
|
25
|
+
"are unique",
|
|
26
|
+
function () {
|
|
27
|
+
scopes
|
|
28
|
+
.length
|
|
29
|
+
.should
|
|
30
|
+
.equal(
|
|
31
|
+
new Set(scopes)
|
|
32
|
+
.size,
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
describe(
|
|
39
|
+
"order",
|
|
40
|
+
function () {
|
|
41
|
+
it(
|
|
42
|
+
"`jsoncc` > `jsonc` > `json`",
|
|
43
|
+
function () {
|
|
44
|
+
scopes
|
|
45
|
+
.should
|
|
46
|
+
.include
|
|
47
|
+
.members(
|
|
48
|
+
[
|
|
49
|
+
"jsoncc",
|
|
50
|
+
"jsonc",
|
|
51
|
+
"json",
|
|
52
|
+
],
|
|
53
|
+
);
|
|
54
|
+
scopes
|
|
55
|
+
.indexOf("jsoncc")
|
|
56
|
+
.should.be
|
|
57
|
+
.greaterThan(
|
|
58
|
+
scopes
|
|
59
|
+
.indexOf("jsonc"),
|
|
60
|
+
);
|
|
61
|
+
scopes
|
|
62
|
+
.indexOf("jsonc")
|
|
63
|
+
.should.be
|
|
64
|
+
.greaterThan(
|
|
65
|
+
scopes
|
|
66
|
+
.indexOf("json"),
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
it(
|
|
71
|
+
"`mocha` > `ts`",
|
|
72
|
+
function () {
|
|
73
|
+
scopes
|
|
74
|
+
.should
|
|
75
|
+
.include
|
|
76
|
+
.members(
|
|
77
|
+
[
|
|
78
|
+
"mocha",
|
|
79
|
+
"ts",
|
|
80
|
+
],
|
|
81
|
+
);
|
|
82
|
+
scopes
|
|
83
|
+
.indexOf("mocha")
|
|
84
|
+
.should.be
|
|
85
|
+
.greaterThan(
|
|
86
|
+
scopes
|
|
87
|
+
.indexOf("ts"),
|
|
88
|
+
);
|
|
89
|
+
},
|
|
90
|
+
);
|
|
91
|
+
it(
|
|
92
|
+
"`svelte` > `ts`",
|
|
93
|
+
function () {
|
|
94
|
+
scopes
|
|
95
|
+
.should
|
|
96
|
+
.include
|
|
97
|
+
.members(
|
|
98
|
+
[
|
|
99
|
+
"svelte",
|
|
100
|
+
"ts",
|
|
101
|
+
],
|
|
102
|
+
);
|
|
103
|
+
scopes
|
|
104
|
+
.indexOf("svelte")
|
|
105
|
+
.should.be
|
|
106
|
+
.greaterThan(
|
|
107
|
+
scopes
|
|
108
|
+
.indexOf("ts"),
|
|
109
|
+
);
|
|
110
|
+
},
|
|
111
|
+
);
|
|
112
|
+
it(
|
|
113
|
+
"`ts` > `js`",
|
|
114
|
+
function () {
|
|
115
|
+
scopes
|
|
116
|
+
.should
|
|
117
|
+
.include
|
|
118
|
+
.members(
|
|
119
|
+
[
|
|
120
|
+
"ts",
|
|
121
|
+
"js",
|
|
122
|
+
],
|
|
123
|
+
);
|
|
124
|
+
scopes
|
|
125
|
+
.indexOf("ts")
|
|
126
|
+
.should.be
|
|
127
|
+
.greaterThan(
|
|
128
|
+
scopes
|
|
129
|
+
.indexOf("js"),
|
|
130
|
+
);
|
|
131
|
+
},
|
|
132
|
+
);
|
|
133
|
+
},
|
|
134
|
+
);
|
|
135
|
+
},
|
|
136
|
+
);
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import "chai/register-should.js";
|
|
2
|
+
import { tree } from "./tree";
|
|
3
|
+
|
|
4
|
+
const nodes = tree.map(([scope]) => scope);
|
|
5
|
+
|
|
6
|
+
describe(
|
|
7
|
+
"Tree",
|
|
8
|
+
function () {
|
|
9
|
+
describe(
|
|
10
|
+
"shape",
|
|
11
|
+
function () {
|
|
12
|
+
it(
|
|
13
|
+
"is an array",
|
|
14
|
+
function () {
|
|
15
|
+
tree
|
|
16
|
+
.should.be
|
|
17
|
+
.an("array");
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
describe(
|
|
23
|
+
"members",
|
|
24
|
+
function () {
|
|
25
|
+
it(
|
|
26
|
+
"are unique",
|
|
27
|
+
function () {
|
|
28
|
+
tree
|
|
29
|
+
.length
|
|
30
|
+
.should
|
|
31
|
+
.equal(
|
|
32
|
+
new Set(nodes)
|
|
33
|
+
.size,
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
it(
|
|
38
|
+
"omit `js`",
|
|
39
|
+
function () {
|
|
40
|
+
nodes
|
|
41
|
+
.should
|
|
42
|
+
.not.include
|
|
43
|
+
.members(["js"]);
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
describe(
|
|
49
|
+
"order",
|
|
50
|
+
function () {
|
|
51
|
+
it(
|
|
52
|
+
"`jsoncc` < [`jsonc`]?",
|
|
53
|
+
function () {
|
|
54
|
+
nodes
|
|
55
|
+
.should
|
|
56
|
+
.include
|
|
57
|
+
.members(["jsoncc"]);
|
|
58
|
+
nodes
|
|
59
|
+
.indexOf("jsoncc")
|
|
60
|
+
.should.be
|
|
61
|
+
.lessThan(
|
|
62
|
+
nodes.indexOf("jsonc") * tree.length,
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
it(
|
|
67
|
+
"`mocha` < `ts`",
|
|
68
|
+
function () {
|
|
69
|
+
nodes
|
|
70
|
+
.should
|
|
71
|
+
.include
|
|
72
|
+
.members(
|
|
73
|
+
[
|
|
74
|
+
"mocha",
|
|
75
|
+
"ts",
|
|
76
|
+
],
|
|
77
|
+
);
|
|
78
|
+
nodes
|
|
79
|
+
.indexOf("mocha")
|
|
80
|
+
.should.be
|
|
81
|
+
.lessThan(
|
|
82
|
+
nodes
|
|
83
|
+
.indexOf("ts"),
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
it(
|
|
88
|
+
"`svelte` < `ts`",
|
|
89
|
+
function () {
|
|
90
|
+
nodes
|
|
91
|
+
.should
|
|
92
|
+
.include
|
|
93
|
+
.members(
|
|
94
|
+
[
|
|
95
|
+
"svelte",
|
|
96
|
+
"ts",
|
|
97
|
+
],
|
|
98
|
+
);
|
|
99
|
+
nodes
|
|
100
|
+
.indexOf("svelte")
|
|
101
|
+
.should.be
|
|
102
|
+
.lessThan(
|
|
103
|
+
nodes
|
|
104
|
+
.indexOf("ts"),
|
|
105
|
+
);
|
|
106
|
+
},
|
|
107
|
+
);
|
|
108
|
+
it(
|
|
109
|
+
"`ts` is last",
|
|
110
|
+
function () {
|
|
111
|
+
nodes
|
|
112
|
+
.should
|
|
113
|
+
.include
|
|
114
|
+
.members(["ts"]);
|
|
115
|
+
nodes
|
|
116
|
+
.indexOf("ts")
|
|
117
|
+
.should
|
|
118
|
+
.equal(tree.length - 1);
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
},
|
|
122
|
+
);
|
|
123
|
+
},
|
|
124
|
+
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const tree = [
|
|
2
|
+
[
|
|
3
|
+
"jsoncc",
|
|
4
|
+
["jsonc"],
|
|
5
|
+
] as const,
|
|
6
|
+
[
|
|
7
|
+
"jsonc",
|
|
8
|
+
["json"],
|
|
9
|
+
] as const,
|
|
10
|
+
[
|
|
11
|
+
"mocha",
|
|
12
|
+
["ts"],
|
|
13
|
+
] as const,
|
|
14
|
+
[
|
|
15
|
+
"svelte",
|
|
16
|
+
["ts"],
|
|
17
|
+
] as const,
|
|
18
|
+
[
|
|
19
|
+
"ts",
|
|
20
|
+
["js"],
|
|
21
|
+
] as const,
|
|
22
|
+
];
|