From 6d8d4deeefe0f2323ea949a6b0867c91ff14ae7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=85berg?= Date: Thu, 11 Dec 2025 19:34:02 +0100 Subject: [PATCH] Quick experiment with oxlint --- .oxlintrc.json | 66 ++++++++++++ package-lock.json | 251 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 10 +- 3 files changed, 324 insertions(+), 3 deletions(-) create mode 100644 .oxlintrc.json diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 00000000000..b5139cc1a57 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,66 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["typescript", "import"], + "categories": { + "correctness": "error" + }, + "rules": { + "curly": ["error", "all"], + "no-console": "error", + // Disabled: false positives on test variables assigned in beforeEach + "no-unassigned-vars": "allow", + // Disabled: ESLint uses allowTernary option which oxlint doesn't support + "no-unused-expressions": "allow", + // Disabled: use typescript/no-unused-vars for .ts files instead + "no-unused-vars": 0, + // Disabled: not enabled in ESLint config + "no-useless-rename": "allow", + // Disabled: not enabled in ESLint config + "no-useless-catch": "allow", + // Disabled: not enabled in ESLint config + "no-unnecessary-parameter-property-assignment": "allow", + // Disabled: BOM characters slip through ESLint + "no-irregular-whitespace": "allow", + // Disabled: matches ESLint config (rule is off) + "typescript/no-explicit-any": "allow", + // Disabled: oxlint doesn't support allowedNames option, ESLint allows "self" + "typescript/no-this-alias": "allow", + // Matches ESLint: don't check unused function arguments + "typescript/no-unused-vars": [ + "error", + { "args": "none", "caughtErrors": "none", "varsIgnorePattern": "^_" } + ], + // Requires --type-aware flag to work + "typescript/no-misused-promises": "error", + "no-restricted-imports": [ + "error", + { + "paths": [ + { + "name": "@bitwarden/commercial-sdk-internal", + "message": "Use @bitwarden/sdk-internal instead." + } + ] + } + ] + }, + "ignorePatterns": [ + "**/build/", + "**/dist/", + "**/coverage/", + ".angular/", + "storybook-static/", + "**/node_modules/", + "**/webpack.*.js", + "**/jest.config.js", + "**/config/*.js", + "apps/*/config.js", + "apps/desktop/desktop_native", + "apps/desktop/src/auth/scripts/*.js", + "scripts/**", + "jest.preset.js", + "tailwind.config.js", + "libs/components/tailwind.config.*.js", + "libs/nx-plugin/**" + ] +} diff --git a/package-lock.json b/package-lock.json index dc8694f77b6..839e6ad1133 100644 --- a/package-lock.json +++ b/package-lock.json @@ -157,6 +157,8 @@ "lint-staged": "16.0.0", "mini-css-extract-plugin": "2.9.4", "nx": "21.6.10", + "oxlint": "1.32.0", + "oxlint-tsgolint": "0.8.5", "path-browserify": "1.0.1", "postcss": "8.5.6", "postcss-loader": "8.2.0", @@ -12790,6 +12792,202 @@ "@octokit/openapi-types": "^27.0.0" } }, + "node_modules/@oxlint-tsgolint/darwin-arm64": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-arm64/-/darwin-arm64-0.8.5.tgz", + "integrity": "sha512-6Fmcrk33+PbA8fEeuz8AGD7G3KoGWTJfvCflQD8zgY8AYK8OIs7bh4WUfZiRLVJdZ0PLY6y85J2IbfXy5dTrjQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint-tsgolint/darwin-x64": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-x64/-/darwin-x64-0.8.5.tgz", + "integrity": "sha512-vaB8oNS1gkJYpGq09UfpF62kPew3Ia7WHYQeD9IIOnUHWW1LNyZdNHuB6h99Kn9irMLj/uhbl7HtDzP+Lk4BNg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint-tsgolint/linux-arm64": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-arm64/-/linux-arm64-0.8.5.tgz", + "integrity": "sha512-avfdBAcvqGacG78I919wMl4Cv3wT/to0u7CwyvFC/8vvIpPq983xmiPjMqFt1m/6ADtvRQfmSMK18C9l8uew7A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint-tsgolint/linux-x64": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-x64/-/linux-x64-0.8.5.tgz", + "integrity": "sha512-CvUc+0iCLBUKRiIzFIMhPJQpGI1JA29hiFWlLU/qBtf3V/IanxSbcgOm8zaO2/agg0yfS/oHrL/u8SR9xdcIvA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint-tsgolint/win32-arm64": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-arm64/-/win32-arm64-0.8.5.tgz", + "integrity": "sha512-2opjh8Vev+Z1dsi0lTYeGeI+Pbm6JgLT2U7l3+t8Ww3d/lhXgxUP9l+nX3ioCQd8auUy198MoWYice3OhjCX1w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint-tsgolint/win32-x64": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-x64/-/win32-x64-0.8.5.tgz", + "integrity": "sha512-HGsTFdQDbXJ6VP9smhQyv3Pi/Vybabad57vT/SH12xYBYaIt1A0YO9ioQN36iYOb+971G9lo+YZjifa3vwDilA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint/darwin-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/@oxlint/darwin-arm64/-/darwin-arm64-1.32.0.tgz", + "integrity": "sha512-yrqPmZYu5Qb+49h0P5EXVIq8VxYkDDM6ZQrWzlh16+UGFcD8HOXs4oF3g9RyfaoAbShLCXooSQsM/Ifwx8E/eQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint/darwin-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/@oxlint/darwin-x64/-/darwin-x64-1.32.0.tgz", + "integrity": "sha512-pQRZrJG/2nAKc3IuocFbaFFbTDlQsjz2WfivRsMn0hw65EEsSuM84WMFMiAfLpTGyTICeUtHZLHlrM5lzVr36A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint/linux-arm64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-arm64-gnu/-/linux-arm64-gnu-1.32.0.tgz", + "integrity": "sha512-tyomSmU2DzwcTmbaWFmStHgVfRmJDDvqcIvcw4fRB1YlL2Qg/XaM4NJ0m2bdTap38gxD5FSxSgCo0DkQ8GTolg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/linux-arm64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-arm64-musl/-/linux-arm64-musl-1.32.0.tgz", + "integrity": "sha512-0W46dRMaf71OGE4+Rd+GHfS1uF/UODl5Mef6871pMhN7opPGfTI2fKJxh9VzRhXeSYXW/Z1EuCq9yCfmIJq+5Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/linux-x64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-x64-gnu/-/linux-x64-gnu-1.32.0.tgz", + "integrity": "sha512-5+6myVCBOMvM62rDB9T3CARXUvIwhGqte6E+HoKRwYaqsxGUZ4bh3pItSgSFwHjLGPrvADS11qJUkk39eQQBzQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/linux-x64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-x64-musl/-/linux-x64-musl-1.32.0.tgz", + "integrity": "sha512-qwQlwYYgVIC6ScjpUwiKKNyVdUlJckrfwPVpIjC9mvglIQeIjKuuyaDxUZWIOc/rEzeCV/tW6tcbehLkfEzqsw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/win32-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/@oxlint/win32-arm64/-/win32-arm64-1.32.0.tgz", + "integrity": "sha512-7qYZF9CiXGtdv8Z/fBkgB5idD2Zokht67I5DKWH0fZS/2R232sDqW2JpWVkXltk0+9yFvmvJ0ouJgQRl9M3S2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint/win32-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/@oxlint/win32-x64/-/win32-x64-1.32.0.tgz", + "integrity": "sha512-XW1xqCj34MEGJlHteqasTZ/LmBrwYIgluhNW0aP+XWkn90+stKAq3W/40dvJKbMK9F7o09LPCuMVtUW7FIUuiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@parcel/watcher": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz", @@ -34108,6 +34306,59 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/oxlint": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.32.0.tgz", + "integrity": "sha512-HYDQCga7flsdyLMUIxTgSnEx5KBxpP9VINB8NgO+UjV80xBiTQXyVsvjtneMT3ZBLMbL0SlG/Dm03XQAsEshMA==", + "dev": true, + "license": "MIT", + "bin": { + "oxc_language_server": "bin/oxc_language_server", + "oxlint": "bin/oxlint" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxlint/darwin-arm64": "1.32.0", + "@oxlint/darwin-x64": "1.32.0", + "@oxlint/linux-arm64-gnu": "1.32.0", + "@oxlint/linux-arm64-musl": "1.32.0", + "@oxlint/linux-x64-gnu": "1.32.0", + "@oxlint/linux-x64-musl": "1.32.0", + "@oxlint/win32-arm64": "1.32.0", + "@oxlint/win32-x64": "1.32.0" + }, + "peerDependencies": { + "oxlint-tsgolint": ">=0.8.1" + }, + "peerDependenciesMeta": { + "oxlint-tsgolint": { + "optional": true + } + } + }, + "node_modules/oxlint-tsgolint": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/oxlint-tsgolint/-/oxlint-tsgolint-0.8.5.tgz", + "integrity": "sha512-QpUm0kMilACiEQEgPa/APIvCMmVZOtiSne7kK6iLCcJb/5DvQD5ggyrYXkQLbUiEZj6ouV4XSnpvG/BzuPRnYw==", + "dev": true, + "license": "MIT", + "bin": { + "tsgolint": "bin/tsgolint.js" + }, + "optionalDependencies": { + "@oxlint-tsgolint/darwin-arm64": "0.8.5", + "@oxlint-tsgolint/darwin-x64": "0.8.5", + "@oxlint-tsgolint/linux-arm64": "0.8.5", + "@oxlint-tsgolint/linux-x64": "0.8.5", + "@oxlint-tsgolint/win32-arm64": "0.8.5", + "@oxlint-tsgolint/win32-x64": "0.8.5" + } + }, "node_modules/p-cancelable": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", diff --git a/package.json b/package.json index cd1262ac373..4b0ae552961 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,10 @@ "homepage": "https://bitwarden.com", "scripts": { "prepare": "husky", - "lint": "eslint . --cache --cache-strategy content && prettier --check .", - "lint:fix": "eslint . --cache --cache-strategy content --fix", + "oxlint": "oxlint", + "oxlint:types": "oxlint --type-aware", + "lint": "oxlint && eslint . --cache --cache-strategy content && prettier --check .", + "lint:fix": "oxlint --fix && eslint . --cache --cache-strategy content --fix", "lint:clear": "rimraf .eslintcache", "prettier": "prettier --cache --write .", "test": "jest", @@ -119,6 +121,8 @@ "lint-staged": "16.0.0", "mini-css-extract-plugin": "2.9.4", "nx": "21.6.10", + "oxlint": "1.32.0", + "oxlint-tsgolint": "0.8.5", "path-browserify": "1.0.1", "postcss": "8.5.6", "postcss-loader": "8.2.0", @@ -157,8 +161,8 @@ "@angular/platform-browser": "20.3.15", "@angular/platform-browser-dynamic": "20.3.15", "@angular/router": "20.3.15", - "@bitwarden/sdk-internal": "0.2.0-main.409", "@bitwarden/commercial-sdk-internal": "0.2.0-main.409", + "@bitwarden/sdk-internal": "0.2.0-main.409", "@electron/fuses": "1.8.0", "@emotion/css": "11.13.5", "@koa/multer": "4.0.0",