|
1 | 1 | import { defineAction } from "codeup"; |
2 | | -import { runScript } from "../../src/utils/pkg"; |
3 | 2 |
|
4 | 3 | // https://eslint.org/docs/latest/use/configure/configuration-files |
5 | 4 | const ESLINT_CONFIG_FILES = [ |
@@ -27,7 +26,8 @@ export default defineAction({ |
27 | 26 | async filter({ utils }) { |
28 | 27 | // Only apply if an eslint config exists |
29 | 28 | return ( |
30 | | - (await utils.existsWithAnyExt("eslint.config")) || (await utils.existsWithAnyExt(".eslintrc")) |
| 29 | + (await utils.existsWithAnyExt("eslint.config")) || |
| 30 | + (await utils.existsWithAnyExt(".eslintrc")) |
31 | 31 | ); |
32 | 32 | }, |
33 | 33 | async apply({ utils }) { |
@@ -67,14 +67,20 @@ export default defineAction({ |
67 | 67 | for (const name of ["lint", "lint:fix", "format"]) { |
68 | 68 | if (pkg.scripts[name]) { |
69 | 69 | // Replace eslint --fix with oxlint --fix |
70 | | - pkg.scripts[name] = pkg.scripts[name].replace(/eslint\s+--fix\b/g, "oxlint --fix"); |
| 70 | + pkg.scripts[name] = pkg.scripts[name].replace( |
| 71 | + /eslint\s+--fix\b/g, |
| 72 | + "oxlint --fix", |
| 73 | + ); |
71 | 74 | // Replace eslint with oxlint (for non --fix cases) |
72 | | - pkg.scripts[name] = pkg.scripts[name].replace(/eslint(?!\s+--fix)\b/g, "oxlint"); |
| 75 | + pkg.scripts[name] = pkg.scripts[name].replace( |
| 76 | + /eslint(?!\s+--fix)\b/g, |
| 77 | + "oxlint", |
| 78 | + ); |
73 | 79 | } |
74 | 80 | } |
75 | 81 | }); |
76 | 82 |
|
77 | 83 | // Run oxlint --fix to apply fixes |
78 | | - await runScript("oxlint --fix"); |
| 84 | + await utils.runScript("oxlint --fix"); |
79 | 85 | }, |
80 | 86 | }); |
0 commit comments