chore: Replace Prettier with oxfmt and ESLint with oxlint (#119)

pnpm lint runs oxlint and pnpm format runs oxfmt: lint ~0.3s instead of ~20s, format check ~0.2s instead of ~11s, with far less memory. Configs come from the official migration tools (.oxlintrc.json from eslint.config.js, .oxfmtrc.json from the Prettier config); six new findings fixed or suppressed in 4 files. No code is reformatted.

Claude-Session: https://claude.ai/code/session_01VUYsdXA2nkF5v6zsC93dpn
Co-authored-by: jaw52 <[email protected]>
Цей коміт міститься в:
Jaw authored and GitHub committed 2026-10-28 14:19:38 +08:00
1 джерело a10e3c8898
коміт 8ff8f22940
11 files changed
+609 -1164

No files matched your search

+9
Переглянути файл
@@ -0,0 +1,9 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"printWidth": 120,
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"sortPackageJson": false,
"ignorePatterns": ["dist", "target", "src/bindings.ts", "pnpm-lock.yaml", "**/*.toml"]
}
+150
Переглянути файл
@@ -0,0 +1,150 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "react"],
"categories": {
"correctness": "off"
},
"env": {
"builtin": true
},
"ignorePatterns": [
"dist",
"target",
"src-tauri",
"crates",
"src/bindings.ts",
"fixtures",
"plugins",
"test-results",
"playwright-report",
".claude"
],
"rules": {
"constructor-super": "error",
"for-direction": "error",
"getter-return": "error",
"no-async-promise-executor": "error",
"no-case-declarations": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-binary-expression": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-dupe-class-members": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-empty-static-block": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-import-assign": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-new-native-nonconstructor": "error",
"no-nonoctal-decimal-escape": "error",
"no-obj-calls": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-setter-return": "error",
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
"no-unassigned-vars": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-labels": "error",
"no-unused-private-class-members": "error",
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"no-useless-backreference": "error",
"no-useless-catch": "error",
"no-useless-escape": "error",
"no-with": "error",
"preserve-caught-error": "error",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
"no-array-constructor": "error",
"no-unused-expressions": "error",
"react/rules-of-hooks": "error",
"react/exhaustive-deps": "warn",
"react/static-components": "error",
"react/use-memo": "error",
"react/preserve-manual-memoization": "error",
"react/incompatible-library": "warn",
"react/immutability": "error",
"react/globals": "error",
"react/refs": "error",
"react/set-state-in-effect": "error",
"react/error-boundaries": "error",
"react/purity": "error",
"react/set-state-in-render": "error",
"react/unsupported-syntax": "warn",
"typescript/ban-ts-comment": "error",
"typescript/no-duplicate-enum-values": "error",
"typescript/no-empty-object-type": "error",
"typescript/no-explicit-any": "error",
"typescript/no-extra-non-null-assertion": "error",
"typescript/no-misused-new": "error",
"typescript/no-namespace": "error",
"typescript/no-non-null-asserted-optional-chain": "error",
"typescript/no-require-imports": "error",
"typescript/no-this-alias": "error",
"typescript/no-unnecessary-type-constraint": "error",
"typescript/no-unsafe-declaration-merging": "error",
"typescript/no-unsafe-function-type": "error",
"typescript/no-wrapper-object-types": "error",
"typescript/prefer-as-const": "error",
"typescript/prefer-namespace-keyword": "error",
"typescript/triple-slash-reference": "error"
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
"rules": {
"constructor-super": "off",
"getter-return": "off",
"no-class-assign": "off",
"no-const-assign": "off",
"no-dupe-class-members": "off",
"no-dupe-keys": "off",
"no-func-assign": "off",
"no-import-assign": "off",
"no-new-native-nonconstructor": "off",
"no-obj-calls": "off",
"no-redeclare": "off",
"no-setter-return": "off",
"no-this-before-super": "off",
"no-unreachable": "off",
"no-unsafe-negation": "off",
"no-var": "error",
"no-with": "off",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error"
}
}
]
}
-4
Переглянути файл
@@ -1,4 +0,0 @@
dist
target
src/bindings.ts
pnpm-lock.yaml
-1
Переглянути файл
@@ -1 +0,0 @@
{ "printWidth": 120, "semi": true, "singleQuote": false, "trailingComma": "all" }
-30
Переглянути файл
@@ -1,30 +0,0 @@
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import reactHooks from "eslint-plugin-react-hooks";
export default tseslint.config(
{
ignores: [
"dist",
"target",
"src-tauri",
"crates",
"src/bindings.ts",
"fixtures",
"plugins",
"test-results",
"playwright-report",
// Agent worktrees: whole checkouts of the repo.
".claude",
],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
plugins: { "react-hooks": reactHooks },
rules: {
...reactHooks.configs.recommended.rules,
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
},
},
);
+4 -7
Переглянути файл
@@ -12,8 +12,8 @@
"tauri": "tauri",
"test": "vitest run",
"test:watch": "vitest",
"lint": "eslint .",
"format": "prettier --write .",
"lint": "oxlint",
"format": "oxfmt",
"typecheck": "tsrs --noEmit && tsrs -p tsconfig.node.json --noEmit && tsrs -p perf --noEmit && tsrs -p scripts --noEmit",
"gen:bindings": "cargo test -p openidea --test export_bindings",
"gen:theme-docs": "node scripts/theme/gen-docs.ts",
@@ -59,7 +59,6 @@
"zustand": "^5.0.15"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@playwright/test": "^1.64.1",
"@tauri-apps/cli": "^2",
"@testing-library/jest-dom": "^7.0.1",
@@ -70,13 +69,11 @@
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^6.0.2",
"eslint": "^10.13.0",
"eslint-plugin-react-hooks": "^7.1.1",
"jsdom": "^30.1.3",
"prettier": "^3.9.10",
"oxfmt": "^0.74.0",
"oxlint": "^1.89.0",
"tsrs": "^0.20.0-ts7.1.0-beta",
"typescript": "~6.0.3",
"typescript-eslint": "^8.71.2",
"vite": "^8.0.16",
"vitest": "^5.0.5"
}
Створено
+440 -1120
File diff suppressed because it is too large. Load diff
+1 -1
Переглянути файл
@@ -192,7 +192,7 @@ describe("Refactor This", () => {
it("cancels a superseded query and drops answers after the caret moved", async () => {
let release: (r: Result) => void = () => {};
query = (request) => new Promise((r) => (release = r)).then((x) => (void request, x as Result));
query = (_request) => new Promise((r) => (release = r)).then((x) => x as Result);
const v = editor();
const first = refactorThis(v, vi.fn());
await new Promise((r) => setTimeout(r, 0));
+2
Переглянути файл
@@ -164,10 +164,12 @@ export async function withFallback<T>(
value = await lsp();
} catch (e) {
if (isCancelled(e) || !when.has(lspFailure(e))) throw e;
// oxlint-disable-next-line react-hooks/rules-of-hooks -- a plain async helper, not a hook
const fb = await useFallback();
if (fb) return fb;
throw e;
}
// oxlint-disable-next-line react-hooks/rules-of-hooks -- a plain async helper, not a hook
if (when.has("empty") && isEmpty(value)) return (await useFallback()) ?? { value, source: "lsp" };
return { value, source: "lsp" };
})();
+1 -1
Переглянути файл
@@ -141,7 +141,7 @@ export function breakpointGutter(ctx: EditorDocContext): Extension {
// IDEA tints the whole line of an active breakpoint.
EditorView.decorations.from(f, (markers) => {
const lines: Array<ReturnType<Decoration["range"]>> = [];
for (let it = markers.iter(); it.value; it.next())
for (const it = markers.iter(); it.value; it.next())
if (!DISABLED_LOOKS.has(it.value.look)) lines.push(bpLine.range(it.from));
return Decoration.set(lines);
}),
+2
Переглянути файл
@@ -132,7 +132,9 @@ export const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(functi
}, 0);
};
const commands = useRef<FieldCommands>({});
// oxlint-disable-next-line react/refs -- latest-callback ref, read only from event handlers
commands.current.newLine = multiline ? insertNewLine : undefined;
// oxlint-disable-next-line react/refs
commands.current.history = onHistory;
const { onKeyDown, onFocus, onBlur, ...fieldProps } = rest;
const keyDown = (e: KeyboardEvent<HTMLInputElement>) => {