Skip to content

Commit eeb0bb4

Browse files
authored
chore: migrate from eslint to oxlint (#2493)
## 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-core, apify-client-js, apify-sdk-js, and actor-scraper. ### What changed - Drop `eslint`, `typescript-eslint`, `eslint-plugin-react`, `eslint-plugin-yml`, `globals`, `@apify/eslint-config` - Add `oxlint@1.62.0`, `oxlint-tsgolint@0.22.0`, `@apify/oxlint-config@^0.2.5` - Replace `eslint.config.mjs` with `oxlint.config.ts`; drop unused `tsconfig.eslint.json` - `lint:code` / `lint:code:fix` now run `oxlint --type-aware` - Drop the YAML-specific lint script (`openapi:lint:yaml`) and its CI step — Redocly + Spectral already validate the OpenAPI spec; oxlint doesn't lint YAML, and we don't want eslint hanging around just for style nits on YAML files - Bump `@apify/tsconfig` to `^0.1.2` and add `module: Node16` / `moduleResolution: Node16` so oxlint-tsgolint can parse the project - Disable `typescript/no-floating-promises` and `typescript/promise-function-async` repo-wide — the React event handlers in `apify-docs-theme/` intentionally fire-and-forget - Ignore `examples/` in oxlint (each example has its own tsconfig with its own bundler settings) ### Lint output \`\`\` $ pnpm lint:code Found 0 warnings and 0 errors. Finished in 312ms on 132 files with 113 rules using 14 threads. \`\`\` ## Test plan - [x] \`pnpm lint:code\` — clean - [x] \`pnpm openapi:lint\` — clean (Redocly + Spectral; YAML-style step dropped)
1 parent d8943ac commit eeb0bb4

7 files changed

Lines changed: 338 additions & 1150 deletions

File tree

.github/workflows/openapi-ci.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,10 @@ jobs:
3030
- uses: apify/workflows/pnpm-install@main
3131

3232
- name: Lint with Redocly
33-
run: pnpm openapi:lint:redocly -- --format=github-actions
33+
run: pnpm openapi:lint:redocly --format=github-actions
3434

3535
- name: Lint with Spectral
36-
run: pnpm openapi:lint:spectral -- --format=github-actions
37-
38-
- name: Lint YAML style
39-
run: pnpm openapi:lint:yaml
36+
run: pnpm openapi:lint:spectral --format=github-actions
4037

4138
build:
4239
name: Build bundled specification

eslint.config.mjs

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

oxlint.config.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { defineConfig } from '@apify/oxlint-config';
2+
3+
export default defineConfig({
4+
ignorePatterns: [
5+
'**/node_modules',
6+
'**/dist',
7+
'.docusaurus',
8+
'build',
9+
'sources/api',
10+
'apify-api',
11+
'patches',
12+
'examples',
13+
],
14+
rules: {
15+
'typescript/no-explicit-any': 'off',
16+
'no-param-reassign': 'off',
17+
'no-void': 'off',
18+
'no-console': 'off',
19+
'import/no-default-export': 'off',
20+
// Docs/theme React event handlers commonly call async functions without
21+
// awaiting; treating that as fire-and-forget is intentional here.
22+
'typescript/no-floating-promises': 'off',
23+
'typescript/promise-function-async': 'off',
24+
},
25+
overrides: [
26+
{
27+
files: ['*.config.ts', '*.config.mts', '*.config.mjs', '*.config.js'],
28+
rules: {
29+
'no-console': 'off',
30+
'import/no-default-export': 'off',
31+
},
32+
},
33+
],
34+
});

package.json

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@
2727
"openapi:build": "pnpm openapi:build:yaml && pnpm openapi:build:json",
2828
"openapi:build:yaml": "redocly bundle apify-api/openapi/openapi.yaml --skip-decorator=apify/legacy-doc-url-decorator --skip-decorator=apify/code-samples-decorator -o static/api/openapi.yaml",
2929
"openapi:build:json": "redocly bundle apify-api/openapi/openapi.yaml --skip-decorator=apify/legacy-doc-url-decorator --skip-decorator=apify/code-samples-decorator -o static/api/openapi.json",
30-
"openapi:lint": "pnpm openapi:lint:redocly && pnpm openapi:lint:spectral && pnpm openapi:lint:yaml",
30+
"openapi:lint": "pnpm openapi:lint:redocly && pnpm openapi:lint:spectral",
3131
"openapi:lint:redocly": "redocly lint apify-api/openapi/openapi.yaml",
3232
"openapi:lint:spectral": "spectral lint apify-api/openapi/openapi.yaml",
33-
"openapi:lint:yaml": "eslint 'apify-api/**/*.yaml'",
34-
"openapi:lint:yaml:fix": "eslint 'apify-api/**/*.yaml' --fix",
3533
"write-translations": "docusaurus write-translations",
3634
"version": "docusaurus version",
3735
"rename-version": "docusaurus rename-version",
@@ -41,33 +39,30 @@
4139
"lint:fix": "pnpm lint:md:fix && pnpm lint:code:fix",
4240
"lint:md": "markdownlint '**/*.md'",
4341
"lint:md:fix": "markdownlint '**/*.md' --fix",
44-
"lint:code": "eslint .",
45-
"lint:code:fix": "eslint . --fix",
42+
"lint:code": "oxlint --type-aware",
43+
"lint:code:fix": "oxlint --type-aware --fix",
4644
"test:academy": "bats --print-output-on-failure -r .",
4745
"test:llms-size": "node ./scripts/checkLlmsSize.mjs",
4846
"postinstall": "patch-package",
4947
"postbuild": "node ./scripts/joinLlmsFiles.mjs && node ./scripts/indentLlmsFile.mjs",
5048
"preinstall": "npx only-allow pnpm"
5149
},
5250
"devDependencies": {
53-
"@apify/eslint-config": "^1.0.0",
54-
"@apify/tsconfig": "^0.1.0",
51+
"@apify/oxlint-config": "^0.2.5",
52+
"@apify/tsconfig": "^0.1.2",
5553
"@stoplight/spectral-cli": "^6.15.0",
5654
"@types/react": "^19.0.0",
5755
"babel-plugin-styled-components": "^2.1.4",
5856
"bats": "^1.13.0",
5957
"cross-env": "^10.0.0",
60-
"eslint": "^9.32.0",
61-
"eslint-plugin-react": "^7.37.5",
62-
"eslint-plugin-yml": "^3.0.0",
63-
"globals": "^17.0.0",
6458
"markdownlint": "^0.40.0",
6559
"markdownlint-cli": "^0.48.0",
60+
"oxlint": "1.62.0",
61+
"oxlint-tsgolint": "0.22.0",
6662
"patch-package": "^8.0.0",
6763
"path-browserify": "^1.0.1",
6864
"rimraf": "^6.0.0",
69-
"typescript": "6.0.2",
70-
"typescript-eslint": "^8.38.0"
65+
"typescript": "6.0.2"
7166
},
7267
"dependencies": {
7368
"@apify/ui-icons": "^1.26.0",

0 commit comments

Comments
 (0)