Skip to content
Merged
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
47 changes: 0 additions & 47 deletions eslint.config.mjs

This file was deleted.

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

export default defineConfig({
ignorePatterns: ['**/node_modules', '**/dist', 'coverage'],
rules: {
'typescript/no-explicit-any': 'off',
'no-param-reassign': 'off',
},
overrides: [
{
files: ['*.config.ts', '*.config.mts', 'packages/*/tsup.config.ts'],
rules: {
'no-console': 'off',
'import/no-default-export': 'off',
},
},
{
files: ['test/**'],
rules: {
'no-console': 'off',
'no-useless-constructor': 'off',
'typescript/ban-ts-comment': 'off',
'jest/no-conditional-expect': 'off',
'vitest/no-conditional-expect': 'off',
'jest/expect-expect': 'off',
'vitest/expect-expect': 'off',
'jest/no-standalone-expect': 'off',
'vitest/no-standalone-expect': 'off',
Comment on lines +23 to +28
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these rules seem reasonable - is there a reason why we are disabling these? I don't see their equivalents in the eslint setup.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be all right in here, this is mostly based on apify-core where those triggered a lot of warnings due to false positives. I'll see if I can enable them here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested each — turned them on one at a time and counted violations:

rule violations decision
typescript/no-explicit-any 148 keep off (opt-in case-by-case)
no-param-reassign 40 keep off
typescript/no-empty-object-type 4 enable + fix
typescript/no-unsafe-declaration-merging 1 enable + fix
import/extensions 0 enable (free)
no-empty-function n/a preset already has it 'off', drop redundant override
no-use-before-define 2 enable (preset config), fix
no-void 0 preset enables with allowAsStatement: true, drop our override

Pushed as a separate commit on top of this branch so you can see the diff. The fixes are mostly removing the empty-interface declaration-merging trick (no longer needed) and switching mutually-recursive listener arrows to function declarations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant mostly the jest/* and vitest/* rules, but it's cool we managed to shrink the main ruleset as well 👍

},
},
{
files: ['packages/json_schemas/scripts/**', 'packages/json_schemas/tools/**'],
rules: {
'no-console': 'off',
},
},
],
});
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"test": "vitest",
"test-cov": "vitest --coverage",
"release": "pnpm build && lerna version patch && lerna publish from-package --contents dist",
"lint": "eslint packages/*/src test",
"lint:fix": "eslint packages/*/src test --fix",
"lint": "oxlint --type-aware",
"lint:fix": "oxlint --type-aware --fix",
"preinstall": "npx only-allow pnpm"
},
"commitlint": {
Expand All @@ -42,11 +42,11 @@
},
"lint-staged": {
"*.ts": [
"eslint packages/*/src/**/*.ts --fix"
"oxlint --type-aware --fix --no-error-on-unmatched-pattern"
]
},
"devDependencies": {
"@apify/eslint-config": "^2.0.3",
"@apify/oxlint-config": "^0.2.5",
"@commitlint/config-conventional": "^20.0.0",
"@types/clone-deep": "^4.0.4",
"@types/git-url-parse": "^16.0.0",
Expand All @@ -56,18 +56,17 @@
"ajv": "^8.17.1",
"clone-deep": "^4.0.1",
"commitlint": "^20.0.0",
"eslint": "^9.24.0",
"globals": "^17.0.0",
"husky": "^9.1.4",
"lerna": "^9.0.6",
"lint-staged": "^16.0.0",
"nock": "^14.0.0",
"oxlint": "1.62.0",
"oxlint-tsgolint": "0.22.0",
"rimraf": "^6.0.1",
"strip-ansi": "^6.0.0",
"ts-node": "^10.9.2",
"tsup": "^8.3.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.29.0",
"underscore": "^1.13.7",
"vitest": "^4.1.4"
},
Expand Down
1 change: 0 additions & 1 deletion packages/actor-memory-expression/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { createTsupConfig } from '../../scripts/tsup.config';

// eslint-disable-next-line import-x/no-default-export
export default createTsupConfig({});
4 changes: 1 addition & 3 deletions packages/json_schemas/tools/bundler/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
type Primitive = string | number | boolean | null | undefined;

interface Arr extends Array<JsonSchemaValue> {}

export type JsonSchemaValue = Primitive | object | Arr;
export type JsonSchemaValue = Primitive | object | JsonSchemaValue[];

export interface JsonSchemaObject {
[member: string]: JsonSchemaValue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import-x/no-extraneous-dependencies
import { load as cheerioLoad } from 'cheerio';

import * as addDescriptionRule from './rules/add-description-rule';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { CheerioAPI, Node } from 'cheerio';
// eslint-disable-next-line import-x/no-extraneous-dependencies
import * as cheerio from 'cheerio';
// eslint-disable-next-line import-x/no-extraneous-dependencies
import showdown from 'showdown';

import type { AbstractRule, JsonObject, JsonValue, ObjectPropertyInfo } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { parseJsonPointer } from '../utils';

export const RULE_NAME = 'RemoveValue' as const;

export interface RemoveValueRule extends AbstractRule<typeof RULE_NAME> {}
export type RemoveValueRule = AbstractRule<typeof RULE_NAME>;

function removeValue(objectPropertyInfo: ObjectPropertyInfo, json: JsonObject) {
// Navigate to parent and delete the property
Expand Down
4 changes: 1 addition & 3 deletions packages/json_schemas/tools/modificator/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import type { ReplaceValueRule } from './rules/replace-value-rule';

type Primitive = string | number | boolean | null | undefined;

interface Arr extends Array<JsonValue> {}

export type JsonValue = Primitive | JsonObject | Arr;
export type JsonValue = Primitive | JsonObject | JsonValue[];

export interface JsonObject {
[member: string]: JsonValue;
Expand Down
2 changes: 1 addition & 1 deletion packages/log/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export * from './logger_text';
// Default export is an initialized instance of logger.
const log = new Log();

// eslint-disable-next-line import-x/no-default-export
// eslint-disable-next-line import/no-default-export
export default log;
3 changes: 0 additions & 3 deletions packages/utilities/src/exponential_backoff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ export class RetryableError extends Error {
}
}

// extend the error with added properties
export interface RetryableError extends Error {}

export async function retryWithExpBackoff<T>(
params: { func?: (...args: unknown[]) => T | Promise<T>, expBackoffMillis?: number, expBackoffMaxRepeats?: number } = {},
): Promise<T> {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/src/hmac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let subtleCrypto = globalThis.crypto?.subtle;
async function ensureSubtleCryptoExists() {
if (!subtleCrypto) {
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports -- Backward compatibility for Node.js versions < 19
// eslint-disable-next-line typescript/no-require-imports -- Backward compatibility for Node.js versions < 19
subtleCrypto = require('node:crypto')?.webcrypto?.subtle;
if (subtleCrypto) return;
} catch {
Expand Down
2 changes: 2 additions & 0 deletions packages/utilities/src/utilities.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,14 @@ export function escapePropertyName(name: string) {
// it generates issues due to a bug in mongo bson-ext package https://jira.mongodb.org/browse/NODE-3375.

// pre-test to improve performance
// eslint-disable-next-line no-control-regex -- intentionally matching the null character escaped by MongoDB BSON
if (/(\.|^\$|^toBSON$|^_bsontype$|^toString$|\0)/.test(name)) {
name = name.replace(/\./g, ESCAPE_DOT);
name = name.replace(/^\$/, ESCAPE_DOLLAR);
name = name.replace(/^toBSON$/, ESCAPE_TO_BSON);
name = name.replace(/^toString$/, ESCAPE_TO_STRING);
name = name.replace(/^_bsontype$/, ESCAPE_BSON_TYPE);
// eslint-disable-next-line no-control-regex -- intentionally matching the null character escaped by MongoDB BSON
name = name.replace(/\0/g, ESCAPE_NULL);
}

Expand Down
16 changes: 8 additions & 8 deletions packages/utilities/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,18 +413,18 @@ interface Server {
export function promisifyServerListen<T extends Server>(server: T) {
return async (port: number) => {
return new Promise<void>((resolve, reject) => {
const onError = (err: Error) => {
function removeListeners() {
server.removeListener('error', onError);
server.removeListener('listening', onListening);
}
function onError(err: Error) {
removeListeners();
reject(err);
};
const onListening = () => {
}
function onListening() {
removeListeners();
resolve();
};
const removeListeners = () => {
server.removeListener('error', onError);
server.removeListener('listening', onListening);
};
}

server.on('error', onError);
server.on('listening', onListening);
Expand Down
Loading
Loading