@dword-design/eslint-config 9.0.0 → 9.0.2
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.
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
export default ({
|
|
3
|
+
cwd = "."
|
|
4
|
+
} = {}) => {
|
|
5
|
+
const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, "tsconfig.json");
|
|
6
|
+
if (!configPath) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
10
|
+
if (configFile.error) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd);
|
|
14
|
+
if (parsedConfig.projectReferences && parsedConfig.projectReferences.length > 0) {
|
|
15
|
+
return parsedConfig.projectReferences.map(reference => reference.path);
|
|
16
|
+
}
|
|
17
|
+
return [configPath];
|
|
18
|
+
};
|
package/dist/create/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import { compact, omit, without } from "lodash-es";
|
|
|
19
19
|
import { readPackageSync } from "read-pkg";
|
|
20
20
|
import { sortOrder as packageJsonSortOrder } from "sort-package-json";
|
|
21
21
|
import tseslint from "typescript-eslint";
|
|
22
|
+
import getTypeScriptProjectReferences from "./get-typescript-project-references.js";
|
|
22
23
|
import restrictedImports from "./restricted-imports.js";
|
|
23
24
|
export default ({
|
|
24
25
|
cwd = "."
|
|
@@ -26,6 +27,9 @@ export default ({
|
|
|
26
27
|
const packageConfig = readPackageSync({
|
|
27
28
|
cwd
|
|
28
29
|
});
|
|
30
|
+
const projectPaths = getTypeScriptProjectReferences({
|
|
31
|
+
cwd
|
|
32
|
+
});
|
|
29
33
|
const eslintRestrictedImports = restrictedImports.filter(importDef => importDef.alternative === void 0 || importDef.alternative !== packageConfig.name).map(importDef => ({
|
|
30
34
|
...omit(importDef, ["alternative"]),
|
|
31
35
|
message: compact([importDef.message, importDef.alternative ? `Use '${importDef.alternative}' instead` : ""]).join(" ")
|
|
@@ -203,7 +207,7 @@ export default ({
|
|
|
203
207
|
".js": [".js"]
|
|
204
208
|
},
|
|
205
209
|
// Disable auto-guessing of .ts when .js is imported
|
|
206
|
-
project:
|
|
210
|
+
project: projectPaths
|
|
207
211
|
})]
|
|
208
212
|
}
|
|
209
213
|
}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dword-design/eslint-config",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"repository": "dword-design/eslint-config",
|
|
5
5
|
"funding": "https://github.com/sponsors/dword-design",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,39 +29,42 @@
|
|
|
29
29
|
"verify": "base verify"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@dword-design/eslint-plugin-import-alias": "^8.
|
|
33
|
-
"@eslint/eslintrc": "^3.3.
|
|
34
|
-
"@stylistic/eslint-plugin": "^5.
|
|
32
|
+
"@dword-design/eslint-plugin-import-alias": "^8.1.2",
|
|
33
|
+
"@eslint/eslintrc": "^3.3.3",
|
|
34
|
+
"@stylistic/eslint-plugin": "^5.6.1",
|
|
35
35
|
"confusing-browser-globals": "^1.0.11",
|
|
36
36
|
"depcheck-package-name": "^5.0.0",
|
|
37
|
-
"eslint": "^9.
|
|
37
|
+
"eslint": "^9.39.2",
|
|
38
38
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
39
|
-
"eslint-config-prettier": "^10.1.
|
|
40
|
-
"eslint-import-resolver-typescript": "^4.4.
|
|
41
|
-
"eslint-plugin-import-x": "^4.
|
|
42
|
-
"eslint-plugin-jsonc": "^2.
|
|
43
|
-
"eslint-plugin-playwright": "^2.
|
|
39
|
+
"eslint-config-prettier": "^10.1.8",
|
|
40
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
41
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
42
|
+
"eslint-plugin-jsonc": "^2.21.0",
|
|
43
|
+
"eslint-plugin-playwright": "^2.4.0",
|
|
44
44
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
45
|
-
"eslint-plugin-prettier": "^5.5.
|
|
45
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
46
46
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
47
47
|
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
48
48
|
"eslint-plugin-unicorn": "^62.0.0",
|
|
49
|
-
"eslint-plugin-vue": "^10.2
|
|
49
|
+
"eslint-plugin-vue": "^10.6.2",
|
|
50
50
|
"globals": "^17.0.0",
|
|
51
|
-
"lodash-es": "^4.17.
|
|
52
|
-
"prettier": "^3.
|
|
51
|
+
"lodash-es": "^4.17.22",
|
|
52
|
+
"prettier": "^3.7.4",
|
|
53
53
|
"read-pkg": "^10.0.0",
|
|
54
|
-
"sort-package-json": "^3.
|
|
55
|
-
"typescript-eslint": "^8.
|
|
54
|
+
"sort-package-json": "^3.6.0",
|
|
55
|
+
"typescript-eslint": "^8.51.0",
|
|
56
56
|
"vue-eslint-parser": "^10.2.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@dword-design/base": "^16.
|
|
60
|
-
"@playwright/test": "^1.
|
|
59
|
+
"@dword-design/base": "^16.1.8",
|
|
60
|
+
"@playwright/test": "^1.57.0",
|
|
61
61
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
62
|
-
"endent": "npm:@dword-design/endent@^1.4.
|
|
62
|
+
"endent": "npm:@dword-design/endent@^1.4.7",
|
|
63
63
|
"output-files": "^3.0.0"
|
|
64
64
|
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"typescript": "*"
|
|
67
|
+
},
|
|
65
68
|
"packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad",
|
|
66
69
|
"engines": {
|
|
67
70
|
"node": ">=22"
|