Skip to content

Commit 033d72f

Browse files
committed
chore: migrate from eslint to oxlint
Replace @apify/eslint-config + ESLint with @apify/oxlint-config + oxlint (plus oxlint-tsgolint for type-aware rules), mirroring the migration already done in apify-storage-local-js and apify-core. - Drop eslint, typescript-eslint, globals, @apify/eslint-config - Add oxlint, oxlint-tsgolint, @apify/oxlint-config - Replace eslint.config.mjs and test/.eslintrc with oxlint.config.ts - Update lint / lint:fix scripts to use oxlint --type-aware - Update lint-staged to call oxlint --fix - Override module/moduleResolution to Node16 in tsconfig.json so oxlint-tsgolint can parse it (build tsconfig stays on commonjs/node for tsup compatibility) - Replace stale `eslint-disable import-x/*` with the rules removed or rewritten to oxlint's `import/*` and `typescript/*` plugin names - Auto-fix surfaced issues: switch built-in imports to `node:` protocol, drop dead Node 14 conditional in test/log.test.ts, fix `it('it works')` duplicate prefix - Allow intentional `\0` regex matches in BSON key escaping
1 parent d293765 commit 033d72f

17 files changed

Lines changed: 385 additions & 1834 deletions

File tree

eslint.config.mjs

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

oxlint.config.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { defineConfig } from '@apify/oxlint-config';
2+
3+
export default defineConfig({
4+
ignorePatterns: ['**/node_modules', '**/dist', 'coverage'],
5+
rules: {
6+
'typescript/no-explicit-any': 'off',
7+
'typescript/no-empty-object-type': 'off',
8+
'typescript/no-unsafe-declaration-merging': 'off',
9+
'import/extensions': 'off',
10+
'no-empty-function': 'off',
11+
'no-param-reassign': 'off',
12+
'no-use-before-define': 'off',
13+
'no-void': 'off',
14+
},
15+
overrides: [
16+
{
17+
files: ['*.config.ts', '*.config.mts', 'packages/*/tsup.config.ts'],
18+
rules: {
19+
'no-console': 'off',
20+
'import/no-default-export': 'off',
21+
},
22+
},
23+
{
24+
files: ['test/**'],
25+
rules: {
26+
'no-console': 'off',
27+
'no-useless-constructor': 'off',
28+
'typescript/ban-ts-comment': 'off',
29+
'jest/no-conditional-expect': 'off',
30+
'vitest/no-conditional-expect': 'off',
31+
'jest/expect-expect': 'off',
32+
'vitest/expect-expect': 'off',
33+
'jest/no-standalone-expect': 'off',
34+
'vitest/no-standalone-expect': 'off',
35+
},
36+
},
37+
{
38+
files: ['packages/json_schemas/scripts/**', 'packages/json_schemas/tools/**'],
39+
rules: {
40+
'no-console': 'off',
41+
},
42+
},
43+
],
44+
});

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"test": "vitest",
3232
"test-cov": "vitest --coverage",
3333
"release": "pnpm build && lerna version patch && lerna publish from-package --contents dist",
34-
"lint": "eslint packages/*/src test",
35-
"lint:fix": "eslint packages/*/src test --fix",
34+
"lint": "oxlint --type-aware",
35+
"lint:fix": "oxlint --type-aware --fix",
3636
"preinstall": "npx only-allow pnpm"
3737
},
3838
"commitlint": {
@@ -42,11 +42,11 @@
4242
},
4343
"lint-staged": {
4444
"*.ts": [
45-
"eslint packages/*/src/**/*.ts --fix"
45+
"oxlint --type-aware --fix"
4646
]
4747
},
4848
"devDependencies": {
49-
"@apify/eslint-config": "^2.0.3",
49+
"@apify/oxlint-config": "^0.2.5",
5050
"@commitlint/config-conventional": "^20.0.0",
5151
"@types/clone-deep": "^4.0.4",
5252
"@types/git-url-parse": "^16.0.0",
@@ -56,18 +56,17 @@
5656
"ajv": "^8.17.1",
5757
"clone-deep": "^4.0.1",
5858
"commitlint": "^20.0.0",
59-
"eslint": "^9.24.0",
60-
"globals": "^17.0.0",
6159
"husky": "^9.1.4",
6260
"lerna": "^9.0.6",
6361
"lint-staged": "^16.0.0",
6462
"nock": "^14.0.0",
63+
"oxlint": "1.62.0",
64+
"oxlint-tsgolint": "0.22.0",
6565
"rimraf": "^6.0.1",
6666
"strip-ansi": "^6.0.0",
6767
"ts-node": "^10.9.2",
6868
"tsup": "^8.3.0",
6969
"typescript": "^5.8.3",
70-
"typescript-eslint": "^8.29.0",
7170
"underscore": "^1.13.7",
7271
"vitest": "^4.1.4"
7372
},
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
import { createTsupConfig } from '../../scripts/tsup.config';
22

3-
// eslint-disable-next-line import-x/no-default-export
43
export default createTsupConfig({});

packages/json_schemas/tools/modificator/description-file-utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// eslint-disable-next-line import-x/no-extraneous-dependencies
21
import { load as cheerioLoad } from 'cheerio';
32

43
import * as addDescriptionRule from './rules/add-description-rule';

packages/json_schemas/tools/modificator/rules/add-description-rule.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import type { CheerioAPI, Node } from 'cheerio';
2-
// eslint-disable-next-line import-x/no-extraneous-dependencies
32
import * as cheerio from 'cheerio';
4-
// eslint-disable-next-line import-x/no-extraneous-dependencies
53
import showdown from 'showdown';
64

75
import type { AbstractRule, JsonObject, JsonValue, ObjectPropertyInfo } from '../types';

packages/log/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ export * from './logger_text';
1010
// Default export is an initialized instance of logger.
1111
const log = new Log();
1212

13-
// eslint-disable-next-line import-x/no-default-export
13+
// eslint-disable-next-line import/no-default-export
1414
export default log;

packages/utilities/src/hmac.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ let subtleCrypto = globalThis.crypto?.subtle;
4242
async function ensureSubtleCryptoExists() {
4343
if (!subtleCrypto) {
4444
try {
45-
// eslint-disable-next-line @typescript-eslint/no-require-imports -- Backward compatibility for Node.js versions < 19
45+
// eslint-disable-next-line typescript/no-require-imports -- Backward compatibility for Node.js versions < 19
4646
subtleCrypto = require('node:crypto')?.webcrypto?.subtle;
4747
if (subtleCrypto) return;
4848
} catch {

packages/utilities/src/utilities.client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,14 @@ export function escapePropertyName(name: string) {
236236
// it generates issues due to a bug in mongo bson-ext package https://jira.mongodb.org/browse/NODE-3375.
237237

238238
// pre-test to improve performance
239+
// eslint-disable-next-line no-control-regex -- intentionally matching the null character escaped by MongoDB BSON
239240
if (/(\.|^\$|^toBSON$|^_bsontype$|^toString$|\0)/.test(name)) {
240241
name = name.replace(/\./g, ESCAPE_DOT);
241242
name = name.replace(/^\$/, ESCAPE_DOLLAR);
242243
name = name.replace(/^toBSON$/, ESCAPE_TO_BSON);
243244
name = name.replace(/^toString$/, ESCAPE_TO_STRING);
244245
name = name.replace(/^_bsontype$/, ESCAPE_BSON_TYPE);
246+
// eslint-disable-next-line no-control-regex -- intentionally matching the null character escaped by MongoDB BSON
245247
name = name.replace(/\0/g, ESCAPE_NULL);
246248
}
247249

0 commit comments

Comments
 (0)