Skip to content

feat(oxlint): replace eslint #1945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
143 changes: 143 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"categories": {
"correctness": "error",
"nursery": "off",
"pedantic": "error",
"perf": "error",
"restriction": "error",
"style": "error",
"suspicious": "error"
},
"plugins": [
"import",
"n",
"node",
"react-perf",
"react",
"security",
"tree_shaking",
"typescript",
"unicorn"
],
"overrides": [
{
"files": [
"**/__stories__/**/*.{ts,tsx}", "**/__tests__/**/*.{ts,tsx}",
"examples/**/*.{ts,tsx}",
"**/vendor/base64/index.js"
],
"rules": {
"react/jsx-key": "off",
"no-console": "off",
"no-alert": "off",
"eslint/vars-on-top": "off",
"eslint/no-var": "off"
}
},
{
"files": ["**/__tests__/**/*.{ts,tsx}", "setup.ts"],
"plugins": ["vitest"]
}
],
"rules": {
"@typescript/ban-types": "off",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/ban-tslint-comment": "error",
"@typescript-eslint/consistent-indexed-object-style": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/prefer-enum-initializers": "off",
"@typescript-eslint/prefer-function-type": "off",
"@typescript-eslint/prefer-literal-enum-member": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/no-empty-object-type":"off",
"@typescript-eslint/no-empty-interface":"off",
"@typescript-eslint/ban-types": "off",
"eslint/default-param-last": "off",
"eslint/max-classes-per-file": "off",
"eslint/max-lines": "off",
"eslint/max-params": "off",
"eslint/no-await-in-loop": "off",
"eslint/no-duplicate-imports": "off",
"eslint/no-empty-function": "off",
"eslint/no-magic-numbers": "off",
"eslint/no-ternary": "off",
"eslint/no-undefined": "off",
"eslint/sort-keys": "off",
"eslint/no-useless-escape":"off",
"eslint/no-unused-vars": [
"off",
{
"ignoreRestSiblings": true
}
],
"eslint/require-await": "off",
"eslint/sort-imports": [
"error",
{
"ignoreDeclarationSort": true,
"memberSyntaxSortOrder": ["single", "multiple", "all", "none"]
}
],
"eslint/yoda": "error",
"eslint/max-lines-per-function": "off",
"eslint/max-nested-callbacks": "off",
"eslint/max-depth": "off",
"eslint/init-declarations": "off",
"import/exports-last":"off",
"import/no-namespace": "off",
"import/max-dependencies": "off",
"import/namespace": "off",
"import/no-default-export": "off",
"import/no-duplicates": "off",
"import/unambiguous": "off",
"react-perf/jsx-no-jsx-as-prop": "off",
"react-perf/jsx-no-new-array-as-prop": "off",
"react-perf/jsx-no-new-function-as-prop": "off",
"react-perf/jsx-no-new-object-as-prop": "off",
"react/jsx-no-useless-fragment": "off",
"react/iframe-missing-sandbox": "error",
"react/jsx-no-target-blank": "off",
"react/react-in-jsx-scope": "off",
"unicorn/error-message": "off",
"unicorn/filename-case": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-await-expression-member": "off",
"unicorn/no-await-in-promise-methods": "off",
"unicorn/no-lonely-if": "off",
"unicorn/prefer-set-has": "off",
"unicorn/no-invalid-remove-event-listener": "off",
"unicorn/no-negated-condition": "off",
"unicorn/no-new-array": "off",
"unicorn/no-null": "off",
"unicorn/no-object-as-default-parameter": "off",
"unicorn/no-process-exit": "off",
"unicorn/no-single-promise-in-promise-methods": "off",
"unicorn/no-useless-promise-resolve-reject": "off",
"unicorn/no-useless-undefined": "off",
"unicorn/no-zero-fractions": "off",
"unicorn/number-literal-case": "off",
"unicorn/numeric-separators-style": "off",
"unicorn/prefer-add-event-listener": "off",
"unicorn/prefer-array-some": "off",
"unicorn/prefer-blob-reading-methods": "off",
"unicorn/prefer-code-point": "off",
"unicorn/prefer-dom-node-append": "off",
"unicorn/prefer-dom-node-remove": "off",
"unicorn/prefer-logical-operator-over-ternary": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-query-selector": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/prefer-string-slice": "off"
},
"settings": {
"jsx-a11y": {
"components": {
"polymorphicPropName": "as"
}
},
"react": {}
}
}
1 change: 1 addition & 0 deletions examples/serverless-function-minimal/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const buildErrorRes = (error?: unknown) => ({
statusCode: error instanceof Errors.ScalewayError ? error.status : 500,
})

// oxlint-disable-next-line @typescript-eslint/no-explicit-any
export const list = async (event: any, context: any, callback: any) => {
try {
return buildJsonRes(await api.listNamespaces().all())
Expand Down
26 changes: 19 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,23 @@
"build:profile": "cross-env PROFILE=true pnpm run build",
"commit": "npx git-cz -a",
"doc": "typedoc",
"format": "prettier --write '**/*.ts'",
"format": "biome check --linter-enabled=false --write .",
"format:check": "biome check --linter-enabled=false --verbose .",
"format:ci": "biome ci --linter-enabled=false .",
"lint": "eslint --cache .",
"oxc": "oxlint -c .oxlintrc.json",
"oxc:fix": "pnpm run oxc --fix",
"prepare": "husky",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:ui": "vitest --ui"
},
"lint-staged": {
"*.(j|t|mj)s?(x)": [
"pnpm run format",
"oxlint -c .oxlintrc.json --quiet --fix",
"eslint --cache --cache-strategy content --fix"
],
"*.ts": [
"prettier --write",
"eslint --fix ."
Expand All @@ -31,6 +40,9 @@
],
"*.json": [
"prettier --write"
],
"pnpm-lock.yaml, package.json, **/pnpm-lock.yaml, **/package.json": [
"pnpm exec manypkg check"
]
},
"config": {
Expand All @@ -46,7 +58,9 @@
"devDependencies": {
"@commitlint/cli": "19.7.1",
"@commitlint/config-conventional": "19.7.1",
"@manypkg/cli": "0.23.0",
"@scaleway/eslint-config-react": "4.0.9",
"@scaleway/random-name": "5.1.1",
"@typescript-eslint/eslint-plugin": "latest",
"@vitest/coverage-istanbul": "2.1.9",
"@vitest/coverage-v8": "2.1.9",
Expand All @@ -63,17 +77,15 @@
"jsdom": "25.0.1",
"lerna": "8.1.9",
"lint-staged": "15.4.3",
"oxlint": "0.16.3",
"prettier": "3.4.2",
"react": "^19.0.0",
"read-pkg": "9.0.1",
"tsc-alias": "^1.8.10",
"tsc-alias": "1.8.10",
"typedoc": "0.27.6",
"typescript": "5.7.3",
"vite": "5.4.12",
"vitest": "2.1.9"
},
"packageManager": "[email protected]",
"dependencies": {
"@scaleway/random-name": "5.1.1",
"react": "^19.0.0"
}
"packageManager": "[email protected]"
}
4 changes: 2 additions & 2 deletions packages/clients/src/scw/client-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const assertValidSettings = (obj: Readonly<Settings>): void => {

// HTTP Client.
if (typeof obj.httpClient !== typeof fetch) {
throw new Error(`Invalid HTTP Client`)
throw new Error('Invalid HTTP Client')
}

// Default Page Size.
Expand All @@ -141,6 +141,6 @@ export const assertValidSettings = (obj: Readonly<Settings>): void => {

// User Agent.
if (typeof obj.userAgent !== 'string') {
throw new Error(`Invalid User-Agent`)
throw new Error("Invalid User-Agent")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { isRecordOfStringArray } from '../types'
*
* @public
*/
export class InvalidRequestMapper {
static fromJSON(
export const InvalidRequestMapper = {
fromJSON: (
status: number,
obj: Readonly<JSONObject>,
): QuotasExceededError | InvalidArgumentsError | ScalewayError {
): QuotasExceededError | InvalidArgumentsError | ScalewayError => {
if (
typeof obj.message === 'string' &&
obj.message.toLowerCase().includes('quota exceeded for this resource')
Expand All @@ -30,19 +30,18 @@ export class InvalidRequestMapper {
const fields =
obj.fields && isRecordOfStringArray(obj.fields) ? obj.fields : {}
const fieldsMessages = Object.entries(fields)
if (fieldsMessages.length) {
if (fieldsMessages.length > 0) {
return new InvalidArgumentsError(
status,
obj,
fieldsMessages
.map(([argumentName, messages]) =>
.flatMap(([argumentName, messages]) =>
messages.map(helpMessage => ({
argumentName,
helpMessage,
reason: 'constraint',
})),
)
.flat(),
)
}

Expand Down
Loading
Loading