@caspeco/eslint-config-react 5.0.0-beta.1 → 5.0.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/README.md CHANGED
@@ -54,11 +54,13 @@ This configuration includes everything from our TypeScript config plus React-spe
54
54
 
55
55
  This package requires the following peer dependencies (automatically installed by npm 7+):
56
56
 
57
- - `eslint` >=9
58
- - `eslint-plugin-react` >=7.37.0
59
- - `eslint-plugin-react-hooks` >=7
60
- - `eslint-plugin-react-refresh` >=0.4.0
61
- - `globals` >=15
57
+ - `eslint`
58
+ - `eslint-plugin-react`
59
+ - `eslint-plugin-react-hooks`
60
+ - `eslint-plugin-react-refresh`
61
+ - `globals`
62
+
63
+ See [package.json](./package.json) for specific version requirements.
62
64
 
63
65
  **Note:** Additional TypeScript-related peer dependencies are inherited from `@caspeco/eslint-config-ts` (installed automatically as a regular dependency).
64
66
 
@@ -5,11 +5,14 @@
5
5
  *
6
6
  * This script updates:
7
7
  * - Package imports: @caspeco/eslint-config → @caspeco/eslint-config-react
8
- * - Named imports: { reactConfig } → default import
9
- * - Variable references: reactConfig → config
8
+ * - Named imports: { reactConfig } → default import reactConfig
10
9
  * - Rule names: caspeco/discourage-chakra-import → caspeco-react/discourage-chakra-import
11
10
  * - ESLint disable comments
12
11
  *
12
+ * Handles both:
13
+ * - Full migration: import { reactConfig } from "@caspeco/eslint-config"
14
+ * - Partial migration: import { reactConfig } from "@caspeco/eslint-config-react"
15
+ *
13
16
  * Usage:
14
17
  * npx caspeco-react-migrate-v5 [path] [--dry-run]
15
18
  *
@@ -47,14 +50,24 @@ function transformImports(content, filename) {
47
50
  let transformed = content;
48
51
  let hasChanges = false;
49
52
 
50
- // Replace import { reactConfig } from "@caspeco/eslint-config" → import config from "@caspeco/eslint-config-react"
51
- const importPattern = /import\s*\{\s*reactConfig\s*\}\s*from\s*["']@caspeco\/eslint-config["']/;
52
- if (importPattern.test(transformed)) {
53
- transformed = transformed.replace(importPattern, 'import config from "@caspeco/eslint-config-react"');
54
- hasChanges = true;
53
+ // Replace import { reactConfig } from "@caspeco/eslint-config" → import reactConfig from "@caspeco/eslint-config-react"
54
+ // Also handle the case where package name is already updated but still using named import
55
+ const oldPackagePattern = /import\s*\{\s*reactConfig\s*\}\s*from\s*["']@caspeco\/eslint-config["']/;
56
+ const newPackagePattern = /import\s*\{\s*reactConfig\s*\}\s*from\s*["']@caspeco\/eslint-config-react["']/;
55
57
 
56
- // If we changed the import, also update variable references
57
- transformed = transformed.replace(/\breactConfig\b/g, "config");
58
+ if (oldPackagePattern.test(transformed)) {
59
+ transformed = transformed.replace(
60
+ oldPackagePattern,
61
+ 'import reactConfig from "@caspeco/eslint-config-react"',
62
+ );
63
+ hasChanges = true;
64
+ } else if (newPackagePattern.test(transformed)) {
65
+ // Package name already updated, just change from named to default import
66
+ transformed = transformed.replace(
67
+ newPackagePattern,
68
+ 'import reactConfig from "@caspeco/eslint-config-react"',
69
+ );
70
+ hasChanges = true;
58
71
  }
59
72
 
60
73
  return { content: transformed, hasChanges };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caspeco/eslint-config-react",
3
- "version": "5.0.0-beta.1",
3
+ "version": "5.0.0",
4
4
  "description": "Caspeco ESLint configuration for React projects",
5
5
  "keywords": [
6
6
  "eslint",
@@ -32,7 +32,7 @@
32
32
  "test": "vitest"
33
33
  },
34
34
  "dependencies": {
35
- "@caspeco/eslint-config-ts": "5.0.0-beta.1"
35
+ "@caspeco/eslint-config-ts": "5.0.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@caspeco/test-utils": "*"
@@ -44,10 +44,6 @@
44
44
  "eslint-plugin-react-refresh": ">=0.4.0",
45
45
  "globals": ">=15"
46
46
  },
47
- "engines": {
48
- "node": ">=24",
49
- "npm": ">=11.5.1"
50
- },
51
47
  "publishConfig": {
52
48
  "access": "public"
53
49
  }