Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.10.0

- name: Lint code
- name: Oxlint
run: pnpm run lint

- name: Typecheck
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Crawlee and by anyone routing Puppeteer or Playwright through an authenticated p

## Code style

- Lint rules live in [eslint.config.mjs](eslint.config.mjs), which extends [`@apify/eslint-config`](https://www.npmjs.com/package/@apify/eslint-config). Run `pnpm run lint:fix` to apply what is auto-fixable.
- Linting is [oxlint](https://oxc.rs) with type-aware rules. Rules live in [oxlint.config.ts](oxlint.config.ts), which extends [`@apify/oxlint-config`](https://www.npmjs.com/package/@apify/oxlint-config). Run `pnpm run lint:fix` to apply what is auto-fixable.
- There is no formatter. Indentation is 4 spaces from [.editorconfig](.editorconfig).
- `pnpm run type-check` type-checks `src` and `test` separately, using different tsconfigs. Run it before finishing.

Expand Down
2 changes: 1 addition & 1 deletion docs/agents/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- `"type": "module"` with `module` and `moduleResolution` set to `NodeNext`, plus `verbatimModuleSyntax`. Relative imports end in `.js`, type-only imports use `import type`, and Node builtins use the `node:` prefix.
- Files are `snake_case.ts`. Identifiers are `camelCase`, types and classes `PascalCase`, module-level constants `SCREAMING_SNAKE`.
- Named exports only. `import/no-default-export` is enforced, config files opt out inline.
- Named exports only. `import/no-default-export` is enforced, config files and tests are exempt.
- Throw `RequestError(message, statusCode, headers?)` from [`src/request_error.ts`](../../src/request_error.ts) for anything the client should see. Anything else becomes a 500 and a `requestFailed` event.
- There is no logger dependency. `Server.log(connectionId, message)` prints only when `verbose` is set. Other modules receive `server` in their opts and call `server.log(...)`. That is the only logging seam, do not add `console` calls elsewhere.
- `dist/` is built by `tsc`. `declarationMap` and `sourceMap` are off on purpose, and the empty `.npmignore` is intentional. Both carry a comment explaining why.
Expand Down
35 changes: 0 additions & 35 deletions eslint.config.mjs

This file was deleted.

41 changes: 41 additions & 0 deletions oxlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { defineConfig } from '@apify/oxlint-config';

export default defineConfig({
ignorePatterns: ['**/node_modules', '**/dist', 'coverage'],
categories: {
correctness: 'error',
},
rules: {
'no-param-reassign': 'off',
// The preset enables these as `typescript/*` and turns the base rule off. Oxlint treats both names
// as one rule, so the later `off` wins and they have to be enabled again here.
'no-shadow': 'error',
'no-useless-constructor': 'error',
'default-param-last': 'error',
'no-empty-function': 'error',
'consistent-return': 'error',
'dot-notation': 'error',
},
overrides: [
{
files: ['test/**'],
rules: {
'consistent-return': 'off',
'no-empty-function': 'off',
'jest/no-conditional-expect': 'off',
'vitest/no-conditional-expect': 'off',
'vitest/no-conditional-tests': 'off',
'vitest/expect-expect': 'off',
'vitest/valid-title': 'off',
},
},
{
// Plain JavaScript outside any tsconfig, as before the type-aware rules do not apply.
files: ['examples/**'],
rules: {
'typescript/no-floating-promises': 'off',
'no-empty-function': 'off',
},
},
],
});
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
"test:docker:bun:full": "pnpm run docker:build && pnpm run docker:run -- test:bun:all",
"test:docker:all": "bash scripts/test-docker-all.sh",
"type-check": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
"lint": "oxlint --type-aware",
"lint:fix": "oxlint --type-aware --fix"
},
"engines": {
"node": ">=20.11"
Expand All @@ -77,7 +77,7 @@
},
"packageManager": "pnpm@12.26.0",
"devDependencies": {
"@apify/eslint-config": "^2.0.6",
"@apify/oxlint-config": "^0.4.1",
"@apify/tsconfig": "^0.2.0",
"@types/basic-auth": "^1.1.8",
"@types/body-parser": "^2.2.0",
Expand All @@ -90,16 +90,16 @@
"basic-auth-parser": "^0.0.2",
"body-parser": "^2.4.0",
"cross-env": "^10.1.0",
"eslint": "^10.16.0",
"express": "^5.3.0",
"oxlint": "^1.96.0",
"oxlint-tsgolint": "^7.0.2009",
"portastic": "^1.0.1",
"proxy": "^4.1.0",
"puppeteer": "^26.0.0",
"rimraf": "^6.1.4",
"socksv5": "^0.0.6",
"tsx": "^4.23.15",
"typescript": "^6.0.3",
"typescript-eslint": "^8.74.0",
"underscore": "^1.13.8",
"undici": "^7.30.3",
"vitest": "^5.1.2",
Expand Down
Loading