@utoo/lint 0.2.9 → 0.3.5
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 +41 -11
- package/bin/fishlint.js +23 -3
- package/bin/migrate.js +476 -10
- package/bin/utoo-lint.js +15 -15
- package/configs/frontend.d.ts +54 -2
- package/configs/frontend.json +15 -0
- package/index.cjs +471 -75
- package/index.d.ts +15 -2
- package/index.js +471 -75
- package/lib/config-loader.cjs +16 -3
- package/lib/config-loader.js +16 -3
- package/package.json +8 -6
- package/schema.json +41 -1
package/lib/config-loader.cjs
CHANGED
|
@@ -13,23 +13,36 @@ const TYPESCRIPT_CONFIG_EXTENSIONS = new Set([".ts", ".mts", ".cts"]);
|
|
|
13
13
|
const JAVASCRIPT_CONFIG_EXTENSIONS = new Set([".js", ".mjs", ".cjs"]);
|
|
14
14
|
const loaderPath = join(__dirname, "load-config.js");
|
|
15
15
|
|
|
16
|
-
function findConfigPath(directory) {
|
|
16
|
+
function findConfigPath(directory, cache) {
|
|
17
17
|
let current = resolvePath(directory);
|
|
18
|
+
const visited = [];
|
|
18
19
|
while (true) {
|
|
20
|
+
if (cache?.has(current)) {
|
|
21
|
+
return cacheConfigPath(cache, visited, cache.get(current));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
visited.push(current);
|
|
19
25
|
for (const filename of CONFIG_FILENAMES) {
|
|
20
26
|
const candidate = resolvePath(current, filename);
|
|
21
27
|
if (isFile(candidate)) {
|
|
22
|
-
return candidate;
|
|
28
|
+
return cacheConfigPath(cache, visited, candidate);
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
const parent = dirname(current);
|
|
26
32
|
if (parent === current) {
|
|
27
|
-
return undefined;
|
|
33
|
+
return cacheConfigPath(cache, visited, undefined);
|
|
28
34
|
}
|
|
29
35
|
current = parent;
|
|
30
36
|
}
|
|
31
37
|
}
|
|
32
38
|
|
|
39
|
+
function cacheConfigPath(cache, directories, configPath) {
|
|
40
|
+
for (const directory of directories) {
|
|
41
|
+
cache?.set(directory, configPath);
|
|
42
|
+
}
|
|
43
|
+
return configPath;
|
|
44
|
+
}
|
|
45
|
+
|
|
33
46
|
function isFile(path) {
|
|
34
47
|
try {
|
|
35
48
|
return statSync(path).isFile();
|
package/lib/config-loader.js
CHANGED
|
@@ -14,23 +14,36 @@ const TYPESCRIPT_CONFIG_EXTENSIONS = new Set([".ts", ".mts", ".cts"]);
|
|
|
14
14
|
const JAVASCRIPT_CONFIG_EXTENSIONS = new Set([".js", ".mjs", ".cjs"]);
|
|
15
15
|
const loaderPath = fileURLToPath(new URL("./load-config.js", import.meta.url));
|
|
16
16
|
|
|
17
|
-
export function findConfigPath(directory) {
|
|
17
|
+
export function findConfigPath(directory, cache) {
|
|
18
18
|
let current = resolvePath(directory);
|
|
19
|
+
const visited = [];
|
|
19
20
|
while (true) {
|
|
21
|
+
if (cache?.has(current)) {
|
|
22
|
+
return cacheConfigPath(cache, visited, cache.get(current));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
visited.push(current);
|
|
20
26
|
for (const filename of CONFIG_FILENAMES) {
|
|
21
27
|
const candidate = resolvePath(current, filename);
|
|
22
28
|
if (isFile(candidate)) {
|
|
23
|
-
return candidate;
|
|
29
|
+
return cacheConfigPath(cache, visited, candidate);
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
const parent = dirname(current);
|
|
27
33
|
if (parent === current) {
|
|
28
|
-
return undefined;
|
|
34
|
+
return cacheConfigPath(cache, visited, undefined);
|
|
29
35
|
}
|
|
30
36
|
current = parent;
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
|
|
40
|
+
function cacheConfigPath(cache, directories, configPath) {
|
|
41
|
+
for (const directory of directories) {
|
|
42
|
+
cache?.set(directory, configPath);
|
|
43
|
+
}
|
|
44
|
+
return configPath;
|
|
45
|
+
}
|
|
46
|
+
|
|
34
47
|
function isFile(path) {
|
|
35
48
|
try {
|
|
36
49
|
return statSync(path).isFile();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/lint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "High-performance JavaScript and TypeScript linter powered by Yuku",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -76,13 +76,15 @@
|
|
|
76
76
|
"use-at-your-own-risk.js"
|
|
77
77
|
],
|
|
78
78
|
"optionalDependencies": {
|
|
79
|
-
"@utoo/lint-darwin-arm64": "0.
|
|
80
|
-
"@utoo/lint-darwin-x64": "0.
|
|
81
|
-
"@utoo/lint-linux-arm64": "0.
|
|
82
|
-
"@utoo/lint-linux-x64": "0.
|
|
83
|
-
"@utoo/lint-win32-x64": "0.
|
|
79
|
+
"@utoo/lint-darwin-arm64": "0.3.5",
|
|
80
|
+
"@utoo/lint-darwin-x64": "0.3.5",
|
|
81
|
+
"@utoo/lint-linux-arm64": "0.3.5",
|
|
82
|
+
"@utoo/lint-linux-x64": "0.3.5",
|
|
83
|
+
"@utoo/lint-win32-x64": "0.3.5"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
+
"@eslint/eslintrc": "2.1.4",
|
|
87
|
+
"@eslint/js": "8.57.1",
|
|
86
88
|
"jiti": "2.7.0"
|
|
87
89
|
},
|
|
88
90
|
"publishConfig": {
|
package/schema.json
CHANGED
|
@@ -28,6 +28,35 @@
|
|
|
28
28
|
"$ref": "#/definitions/ruleSeverity"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
+
"settings": {
|
|
32
|
+
"description": "Shared plugin settings.",
|
|
33
|
+
"type": "object",
|
|
34
|
+
"additionalProperties": true,
|
|
35
|
+
"properties": {
|
|
36
|
+
"jest": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": true,
|
|
39
|
+
"properties": {
|
|
40
|
+
"version": {
|
|
41
|
+
"description": "Jest version used by version-aware Jest rules.",
|
|
42
|
+
"oneOf": [
|
|
43
|
+
{ "type": "integer", "minimum": 1 },
|
|
44
|
+
{ "type": "string", "pattern": "^[0-9]+(?:\\..*)?$" }
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"globalAliases": {
|
|
48
|
+
"description": "Additional global aliases for canonical Jest functions.",
|
|
49
|
+
"type": "object",
|
|
50
|
+
"additionalProperties": {
|
|
51
|
+
"type": "array",
|
|
52
|
+
"items": { "type": "string", "minLength": 1 },
|
|
53
|
+
"uniqueItems": true
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
31
60
|
"files": {
|
|
32
61
|
"description": "File globs this config entry applies to.",
|
|
33
62
|
"oneOf": [
|
|
@@ -37,7 +66,18 @@
|
|
|
37
66
|
{
|
|
38
67
|
"type": "array",
|
|
39
68
|
"items": {
|
|
40
|
-
"
|
|
69
|
+
"oneOf": [
|
|
70
|
+
{
|
|
71
|
+
"type": "string"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"type": "array",
|
|
75
|
+
"items": {
|
|
76
|
+
"type": "string"
|
|
77
|
+
},
|
|
78
|
+
"minItems": 1
|
|
79
|
+
}
|
|
80
|
+
]
|
|
41
81
|
}
|
|
42
82
|
}
|
|
43
83
|
]
|