@html-validate/eslint-config-typescript-typeinfo 9.16.2 → 9.17.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.
package/index.d.mts ADDED
@@ -0,0 +1,5 @@
1
+ import { Linter } from "eslint";
2
+
3
+ declare const config: (tsconfigRootDir: string, config?: Linter.Config) => Linter.Config;
4
+
5
+ export default config;
package/index.mjs CHANGED
@@ -12,6 +12,20 @@ function defineConfig(config) {
12
12
  return config;
13
13
  }
14
14
 
15
+ /**
16
+ * @param {Config} a
17
+ * @param {Config} b
18
+ * @returns {Config}
19
+ */
20
+ function merge(a, b) {
21
+ return {
22
+ ...a,
23
+ ...b,
24
+ languageOptions: { ...a.languageOptions, ...b.languageOptions },
25
+ rules: { ...a.rules, ...b.rules },
26
+ };
27
+ }
28
+
15
29
  function flatten(result, it) {
16
30
  return {
17
31
  rules: {
@@ -27,7 +41,14 @@ const strict = tseConfig.strictTypeCheckedOnly.reduce(flatten, {});
27
41
  /** @type {Config} */
28
42
  const stylistic = tseConfig.stylisticTypeCheckedOnly.reduce(flatten, {});
29
43
 
30
- export default defineConfig({
44
+ const defaultConfig = defineConfig({
45
+ name: "@html-validate/eslint-config-typeinfo",
46
+ files: ["**/*.{ts,cts,mts}"],
47
+ languageOptions: {
48
+ parserOptions: {
49
+ projectService: true,
50
+ },
51
+ },
31
52
  rules: {
32
53
  ...strict.rules,
33
54
  ...stylistic.rules,
@@ -122,3 +143,15 @@ export default defineConfig({
122
143
  "import-x/no-deprecated": "off",
123
144
  },
124
145
  });
146
+
147
+ /**
148
+ * @param {string} tsconfigRootDir
149
+ * @param {Config} [override]
150
+ * @returns {Config}
151
+ */
152
+ const config = (tsconfigrootDir, override) => {
153
+ const merged = merge(defaultConfig, override ?? {});
154
+ merged.languageOptions.parserOptions.tsconfigRootDir = tsconfigrootDir;
155
+ return merged;
156
+ };
157
+ export default config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-validate/eslint-config-typescript-typeinfo",
3
- "version": "9.16.2",
3
+ "version": "9.17.0",
4
4
  "description": "Eslint sharable config used by the various HTML-validate packages",
5
5
  "keywords": [
6
6
  "eslint",
@@ -21,7 +21,7 @@
21
21
  "main": "index.mjs",
22
22
  "files": [
23
23
  "index.mjs",
24
- "index.d.ts"
24
+ "index.d.mts"
25
25
  ],
26
26
  "scripts": {
27
27
  "prepack": "release-prepack --retain-scripts",
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "a8e7a32c4adce29e3277aa419a5a3227950ad25e"
44
+ "gitHead": "e6b5a6d80111c3de4ef5bfbe63f3844d4500caff"
45
45
  }
package/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Linter } from "eslint";
2
-
3
- declare const config: Linter.Config;
4
-
5
- export default config;