@codfish/eslint-config 0.0.0-PR-142--26a9a42 → 0.0.0-PR-143--f3e67b3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../rules/typescript.js"],"names":[],"mappings":";AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCO;AA9CP,8BACa,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAC8C"}
1
+ {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../rules/typescript.js"],"names":[],"mappings":";AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCO;AA9CP,8BACa,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CACsC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=react-integration.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-integration.spec.d.ts","sourceRoot":"","sources":["../../../tests/integration/react-integration.spec.js"],"names":[],"mappings":""}
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Get the version of a dependency from the consumer's package.json.
3
+ * Returns the major version as a string (e.g. '18', '19'), or null if not found.
4
+ */
5
+ export function getDepVersion(dep: any): string | null;
1
6
  export function hasLocalConfig(moduleName: any, searchOptions?: {}): boolean;
2
7
  export function hasDep(props: any): boolean;
3
8
  export function hasDevDep(props: any): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"AAyBA,6EAKC;AAfgC,4CAA+D;AAA/D,+CAA+D;AAA/D,gDAA+D;AAMzF,8CAA8E;AAE9E,yDAAmE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"AAyBA;;;GAGG;AACH,uDAMC;AAED,6EAKC;AA3BgC,4CAA+D;AAA/D,+CAA+D;AAA/D,gDAA+D;AAMzF,8CAA8E;AAE9E,yDAAmE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codfish/eslint-config",
3
- "version": "0.0.0-PR-142--26a9a42",
3
+ "version": "0.0.0-PR-143--f3e67b3",
4
4
  "description": "Modern ESLint configuration with TypeScript, React, and testing framework support.",
5
5
  "type": "module",
6
6
  "repository": {
package/rules/react.js CHANGED
@@ -7,7 +7,7 @@ import reactHooks from 'eslint-plugin-react-hooks';
7
7
  import reactRefresh from 'eslint-plugin-react-refresh';
8
8
  import globals from 'globals';
9
9
 
10
- import { ifAnyDep } from '../utils.js';
10
+ import { getDepVersion, ifAnyDep } from '../utils.js';
11
11
 
12
12
  /**
13
13
  * React ESLint configuration. Includes React, React Hooks, and JSX accessibility rules.
@@ -41,7 +41,9 @@ export default defineConfig([
41
41
 
42
42
  settings: {
43
43
  react: {
44
- version: 'detect',
44
+ // Avoid 'detect' — it uses context.getFilename() which was removed in ESLint 10.
45
+ // Read the major version from the consumer's package.json instead.
46
+ version: getDepVersion('react') || 'detect',
45
47
  },
46
48
  },
47
49
 
@@ -9,7 +9,7 @@ import { hasAnyDep } from '../utils.js';
9
9
  const hasTypeScript = hasAnyDep('typescript');
10
10
  const tseslintConfig =
11
11
  /** @type {import('eslint').Linter.Config[]} */
12
- (hasTypeScript ? [(await import('typescript-eslint')).default.configs.recommended] : []);
12
+ (hasTypeScript ? [(await import('typescript-eslint')).configs.recommended] : []);
13
13
 
14
14
  export default tseslintConfig;
15
15
 
package/utils.js CHANGED
@@ -23,6 +23,18 @@ export const hasAnyDep = args => [hasDep, hasDevDep, hasPeerDep].some(fn => fn(a
23
23
 
24
24
  export const ifAnyDep = (deps, t, f) => (hasAnyDep([deps].flat()) ? t : f);
25
25
 
26
+ /**
27
+ * Get the version of a dependency from the consumer's package.json.
28
+ * Returns the major version as a string (e.g. '18', '19'), or null if not found.
29
+ */
30
+ export function getDepVersion(dep) {
31
+ const spec =
32
+ pkg?.dependencies?.[dep] || pkg?.devDependencies?.[dep] || pkg?.peerDependencies?.[dep];
33
+ if (!spec) return null;
34
+ const match = spec.match(/\d+/);
35
+ return match ? match[0] : null;
36
+ }
37
+
26
38
  export function hasLocalConfig(moduleName, searchOptions = {}) {
27
39
  const explorerSync = cosmiconfigSync(moduleName, searchOptions);
28
40
  const result = explorerSync.search(pkgPath || './');