Skip to content

Commit 65bbb40

Browse files
authored
chore: migrate from eslint to oxlint (#1122)
## Summary Replaces ESLint with [oxlint](https://oxc.rs/docs/guide/usage/linter), pulling in the shared `@apify/oxlint-config` preset and `oxlint-tsgolint` for type-aware rules. Mirrors the migration already shipped in apify-storage-local-js, apify-shared-js, apify-client-js, and apify-core. Biome stays as the formatter — no formatting changes. ### What changed - Drop `@apify/eslint-config`, `eslint`, `eslint-config-prettier`, `eslint-plugin-react`, `eslint-plugin-react-hooks`, `globals`, `typescript-eslint` - Add `oxlint@1.62.0`, `oxlint-tsgolint@0.22.0`, `@apify/oxlint-config@^0.2.5` - Bump `@apify/tsconfig` to `^0.1.2` (drops removed `importsNotUsedAsValues` option that `oxlint-tsgolint` flags as invalid) - Replace `eslint.config.mjs` with `oxlint.config.ts`; drop unused `tsconfig.eslint.json` - `lint` / `lint:fix` (and `lint-staged`) now run `oxlint --type-aware` - Drop the dangling `references: [{ "path": ".." }]` from `test/tsconfig.json` — the root tsconfig isn't a `composite` project, and tsgolint rejects the malformed reference. The reference wasn't doing anything for tsc either. - Auto-fix surfaced one regex that should use `String#startsWith` (`utils.ts`). ### Things to note - `website/` (one `.jsx` file) is ignored, matching biome's behaviour. Not worth carrying React linting just for that. - The `no-restricted-syntax` rule that forbade direct `LoginCommand` calls in tests is gone — oxlint doesn't implement that rule yet. Convention now relies on review + the `safeLogin()` helper in `test/__setup__/hooks/useAuthSetup.ts`. Could be re-added as a custom oxlint plugin (like apify-core's `oxlint_plugins/local.mjs`) if desired. ### Lint output ``` $ pnpm lint Found 0 warnings and 0 errors. Finished in 466ms on 244 files with 117 rules using 14 threads. ``` ## Test plan - [x] `pnpm lint` — clean - [x] `pnpm format` — clean (still on biome + prettier for markdown) - [x] `pnpm build` — TypeScript + tsdown both succeed
1 parent c21fa27 commit 65bbb40

7 files changed

Lines changed: 374 additions & 1875 deletions

File tree

eslint.config.mjs

Lines changed: 0 additions & 116 deletions
This file was deleted.

oxlint.config.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { defineConfig } from '@apify/oxlint-config';
2+
3+
export default defineConfig({
4+
ignorePatterns: ['**/dist', 'node_modules', 'coverage', 'website', '**/*.d.ts', 'test/tmp/**/*'],
5+
rules: {
6+
'no-console': 'off',
7+
'no-param-reassign': 'off',
8+
'typescript/no-explicit-any': 'off',
9+
'typescript/consistent-type-definitions': ['error', 'interface'],
10+
'typescript/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
11+
'typescript/no-unused-vars': [
12+
'error',
13+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', ignoreRestSiblings: true },
14+
],
15+
'import/no-default-export': 'off',
16+
'typescript/consistent-return': 'off',
17+
'consistent-return': 'off',
18+
},
19+
overrides: [
20+
{
21+
files: ['test/**'],
22+
rules: {
23+
'no-console': 'off',
24+
'typescript/ban-ts-comment': 'off',
25+
'typescript/no-empty-function': 'off',
26+
'typescript/no-unused-vars': 'off',
27+
// Tests use the `try { await ... } catch (err) { expect(err)... }` pattern.
28+
// Migrating to `await expect(...).rejects.toX(...)` is out of scope for the
29+
// lint migration — follow-up to enable.
30+
'jest/no-conditional-expect': 'off',
31+
'vitest/no-conditional-expect': 'off',
32+
// A handful of helper-based tests have no direct `expect` (assertions live
33+
// in the helper). Same follow-up to clean up.
34+
'jest/expect-expect': 'off',
35+
'vitest/expect-expect': 'off',
36+
'jest/no-standalone-expect': 'off',
37+
'vitest/no-standalone-expect': 'off',
38+
},
39+
},
40+
],
41+
});

package.json

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"test:e2e:local": "vitest run --testNamePattern \"^(?=.*\\[e2e\\])(?!.*\\[api\\]).*$\" --exclude ./test/api",
1414
"test:api": "vitest run --testNamePattern \"^(?=.*\\[api\\])(?!.*\\[e2e\\]).*$\" --exclude ./test/e2e",
1515
"test:python": "vitest run --testNamePattern \"\\[python\\]\"",
16-
"lint": "eslint",
17-
"lint:fix": "eslint --fix",
16+
"lint": "oxlint --type-aware",
17+
"lint:fix": "oxlint --type-aware --fix",
1818
"format": "biome format . && prettier --check \"**/*.{md,yml,yaml}\"",
1919
"format:fix": "biome format --write . && prettier --write \"**/*.{md,yml,yaml}\"",
2020
"clean": "rimraf dist",
@@ -119,8 +119,8 @@
119119
"wrap-ansi": "^10.0.0"
120120
},
121121
"devDependencies": {
122-
"@apify/eslint-config": "^1.1.0",
123-
"@apify/tsconfig": "^0.1.1",
122+
"@apify/oxlint-config": "^0.2.5",
123+
"@apify/tsconfig": "^0.1.2",
124124
"@biomejs/biome": "^2.4.10",
125125
"@crawlee/types": "^3.16.0",
126126
"@types/adm-zip": "^0.5.8",
@@ -137,19 +137,15 @@
137137
"@types/which": "^3.0.4",
138138
"apify": "^3.7.0",
139139
"cross-env": "^10.1.0",
140-
"eslint": "^9.39.4",
141-
"eslint-config-prettier": "^10.1.8",
142-
"eslint-plugin-react": "^7.37.5",
143-
"eslint-plugin-react-hooks": "^7.0.1",
144-
"globals": "^16.2.0",
145140
"husky": "^9.1.7",
146141
"lint-staged": "^16.4.0",
147142
"mock-stdin": "^1.0.0",
143+
"oxlint": "1.62.0",
144+
"oxlint-tsgolint": "0.22.0",
148145
"prettier": "^3.8.1",
149146
"tsdown": "^0.21.9",
150147
"tsx": "^4.21.0",
151148
"typescript": "^6.0.2",
152-
"typescript-eslint": "^8.58.0",
153149
"vitest": "^4.1.2"
154150
},
155151
"volta": {
@@ -173,7 +169,7 @@
173169
},
174170
"lint-staged": {
175171
"*": "biome format --write --no-errors-on-unmatched",
176-
"*.{mjs,js,ts,mts,jsx,tsx}": "eslint --fix",
172+
"*.{mjs,js,ts,mts,jsx,tsx}": "oxlint --type-aware --fix",
177173
"*.md": "prettier --write"
178174
}
179175
}

0 commit comments

Comments
 (0)