@dword-design/eslint-config 8.1.0 → 9.0.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.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * For some reason eslint-import-resolver-typescript won't load TypeScript project references, so we add them manually.
3
+ */
4
+ declare const _default: ({ cwd }?: {
5
+ cwd?: string;
6
+ }) => string[];
7
+ export default _default;
@@ -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
+ };
@@ -1,4 +1,4 @@
1
1
  declare const _default: ({ cwd }?: {
2
2
  cwd?: string | undefined;
3
- }) => import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
3
+ }) => import("@eslint/config-helpers").Config[];
4
4
  export default _default;
@@ -12,19 +12,24 @@ import { importX } from "eslint-plugin-import-x";
12
12
  import eslintPluginJsonc from "eslint-plugin-jsonc";
13
13
  import pluginPlaywright from "eslint-plugin-playwright";
14
14
  import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
15
- import pluginPromise from "eslint-plugin-promise";
16
15
  import eslintPluginUnicorn from "eslint-plugin-unicorn";
17
16
  import pluginVue from "eslint-plugin-vue";
18
17
  import globals from "globals";
19
- import loadPkg from "load-pkg";
20
18
  import { compact, omit, without } from "lodash-es";
19
+ import { readPackageSync } from "read-pkg";
21
20
  import { sortOrder as packageJsonSortOrder } from "sort-package-json";
22
21
  import tseslint from "typescript-eslint";
22
+ import getTypeScriptProjectReferences from "./get-typescript-project-references.js";
23
23
  import restrictedImports from "./restricted-imports.js";
24
24
  export default ({
25
25
  cwd = "."
26
26
  } = {}) => {
27
- const packageConfig = loadPkg.sync(cwd) || {};
27
+ const packageConfig = readPackageSync({
28
+ cwd
29
+ });
30
+ const projectPaths = getTypeScriptProjectReferences({
31
+ cwd
32
+ });
28
33
  const eslintRestrictedImports = restrictedImports.filter(importDef => importDef.alternative === void 0 || importDef.alternative !== packageConfig.name).map(importDef => ({
29
34
  ...omit(importDef, ["alternative"]),
30
35
  message: compact([importDef.message, importDef.alternative ? `Use '${importDef.alternative}' instead` : ""]).join(" ")
@@ -36,7 +41,11 @@ export default ({
36
41
  });
37
42
  return defineConfig([gitignore({
38
43
  strict: false
39
- }), tseslint.configs.recommended, importX.flatConfigs.recommended, importX.flatConfigs.typescript, pluginPromise.configs["flat/recommended"], ...pluginVue.configs["flat/recommended"].map(plugin => ({
44
+ }), tseslint.configs.recommended,
45
+ // @ts-expect-error https://github.com/un-ts/eslint-plugin-import-x/issues/439
46
+ importX.flatConfigs.recommended,
47
+ // @ts-expect-error https://github.com/un-ts/eslint-plugin-import-x/issues/439
48
+ importX.flatConfigs.typescript, ...pluginVue.configs["flat/recommended"].map(plugin => ({
40
49
  files: ["**/*.ts", "**/*.vue"],
41
50
  ...plugin
42
51
  })), {
@@ -83,11 +92,6 @@ export default ({
83
92
  }
84
93
  },
85
94
  rules: {
86
- "@dword-design/import-alias/prefer-alias": ["error", {
87
- alias: {
88
- "@": "."
89
- }
90
- }],
91
95
  "@stylistic/linebreak-style": ["error", "unix"],
92
96
  "@stylistic/padding-line-between-statements": ["error", {
93
97
  blankLine: "never",
@@ -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: pathLib.join(cwd, "tsconfig.json")
210
+ project: projectPaths
207
211
  })]
208
212
  }
209
213
  }, {
@@ -228,6 +232,7 @@ export default ({
228
232
  alphabetical: true
229
233
  }],
230
234
  "vue/component-api-style": ["error", ["script-setup"]],
235
+ "vue/define-emits-declaration": "error",
231
236
  "vue/multi-word-component-names": "off",
232
237
  "vue/no-deprecated-functional-template": "error",
233
238
  "vue/prefer-true-attribute-shorthand": "error",
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
1
+ declare const _default: import("@eslint/config-helpers").Config[];
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dword-design/eslint-config",
3
- "version": "8.1.0",
3
+ "version": "9.0.1",
4
4
  "repository": "dword-design/eslint-config",
5
5
  "funding": "https://github.com/sponsors/dword-design",
6
6
  "license": "MIT",
@@ -8,10 +8,8 @@
8
8
  "type": "module",
9
9
  "exports": {
10
10
  ".": {
11
- "import": {
12
- "default": "./dist/index.js",
13
- "types": "./dist/index.d.ts"
14
- }
11
+ "default": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
15
13
  }
16
14
  },
17
15
  "main": "dist/index.js",
@@ -31,42 +29,45 @@
31
29
  "verify": "base verify"
32
30
  },
33
31
  "dependencies": {
34
- "@dword-design/eslint-plugin-import-alias": "^6.0.3",
35
- "@eslint/eslintrc": "^3.3.1",
36
- "@stylistic/eslint-plugin": "^5.2.0",
32
+ "@dword-design/eslint-plugin-import-alias": "^8.1.2",
33
+ "@eslint/eslintrc": "^3.3.3",
34
+ "@stylistic/eslint-plugin": "^5.6.1",
37
35
  "confusing-browser-globals": "^1.0.11",
38
- "depcheck-package-name": "^4.0.0",
39
- "eslint": "^9.29.0",
36
+ "depcheck-package-name": "^5.0.0",
37
+ "eslint": "^9.39.2",
40
38
  "eslint-config-flat-gitignore": "^2.1.0",
41
- "eslint-config-prettier": "^10.1.5",
42
- "eslint-import-resolver-typescript": "^4.4.3",
43
- "eslint-plugin-import-x": "^4.15.2",
44
- "eslint-plugin-jsonc": "^2.20.1",
45
- "eslint-plugin-playwright": "^2.2.0",
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",
46
44
  "eslint-plugin-prefer-arrow": "^1.2.3",
47
- "eslint-plugin-prettier": "^5.5.0",
48
- "eslint-plugin-promise": "^7.2.1",
45
+ "eslint-plugin-prettier": "^5.5.4",
49
46
  "eslint-plugin-simple-import-sort": "^12.1.1",
50
47
  "eslint-plugin-sort-keys-fix": "^1.1.2",
51
- "eslint-plugin-unicorn": "npm:@dword-design/eslint-plugin-unicorn@^0.0.1",
52
- "eslint-plugin-vue": "^10.2.0",
53
- "globals": "^16.2.0",
54
- "load-pkg": "^4.0.0",
55
- "lodash-es": "^4.17.21",
56
- "prettier": "^3.5.3",
57
- "sort-package-json": "^3.2.1",
58
- "typescript-eslint": "^8.34.1",
48
+ "eslint-plugin-unicorn": "^62.0.0",
49
+ "eslint-plugin-vue": "^10.6.2",
50
+ "globals": "^17.0.0",
51
+ "lodash-es": "^4.17.22",
52
+ "prettier": "^3.7.4",
53
+ "read-pkg": "^10.0.0",
54
+ "sort-package-json": "^3.6.0",
55
+ "typescript-eslint": "^8.51.0",
59
56
  "vue-eslint-parser": "^10.2.0"
60
57
  },
61
58
  "devDependencies": {
62
- "@dword-design/base": "^15.0.0",
63
- "@playwright/test": "^1.53.1",
64
- "endent": "npm:@dword-design/endent@^1.4.1",
59
+ "@dword-design/base": "^16.1.8",
60
+ "@playwright/test": "^1.57.0",
61
+ "@types/confusing-browser-globals": "^1.0.3",
62
+ "endent": "npm:@dword-design/endent@^1.4.7",
65
63
  "output-files": "^3.0.0"
66
64
  },
65
+ "peerDependencies": {
66
+ "typescript": "*"
67
+ },
67
68
  "packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad",
68
69
  "engines": {
69
- "node": ">=20"
70
+ "node": ">=22"
70
71
  },
71
72
  "publishConfig": {
72
73
  "access": "public"