Lint: port react and import rules from eslint to oxc (#6312)

* Enforce JSX file extensions for React components

- Update eslint config to enforce .jsx/.tsx extensions for files containing JSX
- Convert docs package JS files to JSX where they contain React code
- Fix unstable nested components in CrossoverGraph and NetWorthGraph
- Update oxlint configuration
- Update e2e fixtures

* Fix: Rename react-hooks/exhaustive-deps to react/exhaustive-deps

Co-authored-by: matiss <matiss@mja.lv>

* Enhance ESLint configuration and update import rules

* Refactor ESLint configuration to enhance import order rules and add eslint-plugin-import

* Fix ESLint directive comments in API files to use correct syntax

* Fix

* Fix ESLint directive comments and update import/extensions rule in configuration

* Refactor ESLint configuration to enforce JSX extension rules and improve code clarity

* Update ESLint configuration: disable 'import/no-unresolved' rule and remove obsolete .oxlintrc.json file

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
Matiss Janis Aboltins
2025-12-12 22:40:38 +00:00
committed by GitHub
parent ecb8a1a548
commit 32bc254040
20 changed files with 107 additions and 331 deletions

View File

@@ -2,12 +2,67 @@
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "import", "jsx-a11y"],
"rules": {
"jsx-a11y/no-autofocus": ["warn", { "ignoreNonDOM": true }],
// TODO fix all these and re-enable
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/prefer-tag-over-role": "off",
"jsx-a11y/tabindex-no-positive": "off",
// Keep these rules
"no-var": "warn",
// JSX A11y rules
"jsx-a11y/no-autofocus": ["warn", { "ignoreNonDOM": true }],
// Import rules
"import/first": "error",
"import/no-amd": "error",
"import/no-default-export": "warn",
"import/no-webpack-loader-syntax": "error",
"import/no-useless-path-segments": "warn",
"import/no-unresolved": "warn",
"import/no-unused-modules": "warn",
"import/no-duplicates": [
"warn",
{
"prefer-inline": true,
},
],
// React rules
"react/exhaustive-deps": [
"warn",
{
"additionalHooks": "(useQuery|useEffectAfterMount)",
},
],
"react/jsx-curly-brace-presence": "warn",
"react/jsx-filename-extension": [
"warn",
{
"extensions": [".jsx", ".tsx"],
"allow": "as-needed",
},
],
"react/jsx-no-comment-textnodes": "warn",
"react/jsx-no-duplicate-props": "warn",
"react/jsx-no-target-blank": "warn",
"react/jsx-no-undef": "error",
"react/jsx-no-useless-fragment": "warn",
"react/jsx-pascal-case": [
"warn",
{
"allowAllCaps": true,
"ignore": [],
},
],
"react/no-danger-with-children": "warn",
"react/no-direct-mutation-state": "warn",
"react/no-is-mounted": "warn",
"react/no-unstable-nested-components": "warn",
"react/require-render-return": "error",
"react/rules-of-hooks": "error",
"react/self-closing-comp": "warn",
"react/style-prop-object": "warn",
},
"overrides": [
{
@@ -59,8 +114,21 @@
"packages/desktop-client/src/hooks/useQuery.ts",
],
"rules": {
"react-hooks/exhaustive-deps": "off",
"react/exhaustive-deps": "off",
},
},
{
"files": [
"packages/docs/**/*", // TODO: fix these issues
"packages/api/migrations/*",
"packages/loot-core/migrations/*",
"packages/sync-server/src/app-gocardless/banks/*.js",
"*.config.{ts,mts,mjs}",
],
"rules": {
"import/no-default-export": "off",
}
}
]
}