@html-validate/eslint-config-typescript-typeinfo 5.28.0 → 5.29.0

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.
Files changed (2) hide show
  1. package/index.mjs +89 -16
  2. package/package.json +3 -5
package/index.mjs CHANGED
@@ -1,21 +1,94 @@
1
- import { fileURLToPath } from "node:url";
2
- import path from "node:path";
3
- import { FlatCompat } from "@eslint/eslintrc";
4
- import legacyConfig from "./legacy.cjs";
1
+ import { configs as tseConfig } from "typescript-eslint";
5
2
 
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
3
+ /**
4
+ * @typedef {import("eslint").Linter.Config} Config
5
+ */
8
6
 
9
- const compat = new FlatCompat({
10
- baseDirectory: __dirname,
11
- resolvePluginsRelativeTo: __dirname,
12
- });
13
-
14
- const migrated = compat.config(legacyConfig);
7
+ /**
8
+ * @param {Config} config
9
+ * @returns {Config}
10
+ */
11
+ function defineConfig(config) {
12
+ return config;
13
+ }
15
14
 
16
- for (const ruleset of migrated) {
17
- ruleset.files = ["src/**/*.ts"];
18
- ruleset.ignores = ["src/**/*.spec.ts"];
15
+ function flatten(result, it) {
16
+ return {
17
+ rules: {
18
+ ...result.rules,
19
+ ...it.rules,
20
+ },
21
+ };
19
22
  }
20
23
 
21
- export default migrated;
24
+ /** @type {Config} */
25
+ const strict = tseConfig.strictTypeCheckedOnly.reduce(flatten, {});
26
+
27
+ /** @type {Config} */
28
+ const stylistic = tseConfig.stylisticTypeCheckedOnly.reduce(flatten, {});
29
+
30
+ export default defineConfig({
31
+ rules: {
32
+ ...strict.rules,
33
+ ...stylistic.rules,
34
+
35
+ /* prefer T[] for simple types, Array<T> for complex types (unions, etc) */
36
+ "@typescript-eslint/array-type": ["error", { default: "array-simple" }],
37
+
38
+ /* allow getters which returns a literal */
39
+ "@typescript-eslint/class-literal-property-style": "off",
40
+
41
+ /* no-explicit-any is enabled and for now this rule is a bit to tedious to
42
+ * actually help */
43
+ "@typescript-eslint/no-unsafe-member-access": "off",
44
+
45
+ "@typescript-eslint/no-inferrable-types": "off",
46
+
47
+ /* allow function(this: void, ...) */
48
+ "@typescript-eslint/no-invalid-void-type": [
49
+ "error",
50
+ {
51
+ allowAsThisParameter: true,
52
+ },
53
+ ],
54
+
55
+ /* prefer interface over type = { .. } */
56
+ "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
57
+
58
+ /* enforce usage of "type" with export/import */
59
+ "@typescript-eslint/consistent-type-exports": [
60
+ "error",
61
+ {
62
+ fixMixedExportsWithInlineTypeSpecifier: true,
63
+ },
64
+ ],
65
+ "@typescript-eslint/consistent-type-imports": [
66
+ "error",
67
+ {
68
+ fixStyle: "inline-type-imports",
69
+ },
70
+ ],
71
+
72
+ /* allow constructs such as `unknown | null`, while `unknown` does override
73
+ * `null` it can still serve as a self-documenting type to signal that
74
+ * `null` has a special meaning. It also helps when the type is to be
75
+ * replaced with a better type later. */
76
+ "@typescript-eslint/no-redundant-type-constituents": "off",
77
+
78
+ "@typescript-eslint/no-unused-vars": [
79
+ "error",
80
+ {
81
+ ignoreRestSiblings: true,
82
+ argsIgnorePattern: "^_",
83
+ },
84
+ ],
85
+
86
+ /* allow overloading only if the parameters have different names */
87
+ "@typescript-eslint/unified-signatures": [
88
+ "error",
89
+ {
90
+ ignoreDifferentlyNamedParameters: true,
91
+ },
92
+ ],
93
+ },
94
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-validate/eslint-config-typescript-typeinfo",
3
- "version": "5.28.0",
3
+ "version": "5.29.0",
4
4
  "description": "Eslint sharable config used by the various HTML-validate packages",
5
5
  "keywords": [
6
6
  "eslint",
@@ -28,9 +28,7 @@
28
28
  "prepublishOnly": "release-prepublish --retain-scripts"
29
29
  },
30
30
  "dependencies": {
31
- "@eslint/eslintrc": "3.3.0",
32
- "@typescript-eslint/eslint-plugin": "8.26.0",
33
- "@typescript-eslint/parser": "8.26.0"
31
+ "typescript-eslint": "8.26.1"
34
32
  },
35
33
  "peerDependencies": {
36
34
  "eslint": "^8.0.0"
@@ -42,5 +40,5 @@
42
40
  "publishConfig": {
43
41
  "access": "public"
44
42
  },
45
- "gitHead": "943b446e6793777ceb880c87aed74551789b2c4a"
43
+ "gitHead": "ca95247b7c60f1ba1a30795bece5fa762670d917"
46
44
  }