Skip to content

A local-first personal finance app

lint: move actual eslint rules to oxlint and some eslint (#6462)

Matiss Janis Aboltins1fe1bad2f896
diff --git a/.coderabbit.yaml b/.coderabbit.yaml
index 4f97b6737a..5c3cc4ca70 100644
--- a/.coderabbit.yaml
+++ b/.coderabbit.yaml
@@ -1,3 +1,5 @@
issue_enrichment:
auto_enrich:
enabled: false
+reviews:
+ review_status: false
diff --git a/.oxlintrc.json b/.oxlintrc.json
index 489261e876..7a552fe36d 100644
--- a/.oxlintrc.json
+++ b/.oxlintrc.json
@@ -1,6 +1,7 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "import", "jsx-a11y"],
+ "jsPlugins": ["./packages/eslint-plugin-actual/lib/index.js"],
"env": {
"browser": true,
"jest": true,
@@ -18,8 +19,12 @@
"jsx-a11y/prefer-tag-over-role": "off",
"jsx-a11y/tabindex-no-positive": "off",
- // Keep these rules
- "no-var": "warn",
+ // Actual rules
+ "actual/typography": "warn",
+ "actual/no-untranslated-strings": "error",
+ "actual/prefer-trans-over-t": "error",
+ "actual/prefer-if-statement": "warn",
+ "actual/prefer-logger-over-console": "error",
// JSX A11y rules
"jsx-a11y/no-autofocus": [
@@ -173,6 +178,7 @@
"eslint/no-invalid-regexp": "warn",
"eslint/no-iterator": "warn",
"eslint/no-label-var": "warn",
+ "eslint/no-var": "warn",
"eslint/no-labels": [
"warn",
{
@@ -198,6 +204,8 @@
"eslint/no-global-assign": "warn",
"eslint/no-lone-blocks": "warn",
"eslint/no-unused-labels": "warn",
+ "eslint/no-object-constructor": "warn",
+ "eslint/no-new-native-nonconstructor": "warn",
"eslint/no-redeclare": "warn",
"eslint/no-useless-computed-key": "warn",
"eslint/no-useless-concat": "warn",
@@ -383,6 +391,13 @@
"react/exhaustive-deps": "off"
}
},
+ {
+ "files": ["**/*.test.{js,ts,jsx,tsx}", "packages/docs/**/*"],
+ "rules": {
+ "actual/no-untranslated-strings": "off",
+ "actual/prefer-logger-over-console": "off"
+ }
+ },
{
"files": [
"packages/api/migrations/*",
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 959f409857..be3514dfbf 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -1,12 +1,9 @@
-import oxlint from 'eslint-plugin-oxlint';
import pluginPerfectionist from 'eslint-plugin-perfectionist';
import pluginTypescriptPaths from 'eslint-plugin-typescript-paths';
import { defineConfig } from 'eslint/config';
import globals from 'globals';
import pluginTypescript from 'typescript-eslint';
-import pluginActual from './packages/eslint-plugin-actual/lib/index.js';
-
export default defineConfig(
{
ignores: [
@@ -75,26 +72,9 @@ export default defineConfig(
pluginTypescript.configs.base,
{
plugins: {
- actual: pluginActual,
perfectionist: pluginPerfectionist,
},
rules: {
- 'actual/typography': 'warn',
- 'actual/no-untranslated-strings': 'error',
- 'actual/prefer-trans-over-t': 'error',
- },
- },
- {
- files: ['**/*.{js,ts,jsx,tsx,mjs,mts}'],
- rules: {
- // http://eslint.org/docs/rules/
- 'no-dupe-args': 'warn',
- 'no-new-object': 'warn',
- 'no-new-symbol': 'warn',
- 'no-octal': 'warn',
- 'no-octal-escape': 'warn',
- strict: ['warn', 'never'],
-
'no-restricted-properties': [
'error',
{
@@ -142,9 +122,6 @@ export default defineConfig(
},
],
- 'actual/prefer-if-statement': 'warn',
- 'actual/prefer-logger-over-console': 'error',
-
'object-shorthand': ['warn', 'properties'],
'no-restricted-syntax': [
@@ -163,7 +140,6 @@ export default defineConfig(
},
],
- // Rules disabled during TS migration
'prefer-const': 'warn',
},
},
@@ -180,29 +156,10 @@ export default defineConfig(
'typescript-paths/absolute-import': ['error', { enableAlias: false }],
},
},
- {
- files: [
- 'eslint.config.mjs',
- '**/*.test.js',
- '**/*.test.ts',
- '**/*.test.jsx',
- '**/*.test.tsx',
- '**/*.spec.js',
- ],
-
- rules: {
- 'actual/no-untranslated-strings': 'off',
- 'actual/prefer-logger-over-console': 'off',
- },
- },
{
files: ['packages/docs/**/*'],
rules: {
- 'actual/no-untranslated-strings': 'off',
'no-restricted-syntax': 'off',
},
},
- // Disable ESLint rules that are already covered by oxlint
- // This must be at the end to override previous rule configurations
- ...oxlint.configs['flat/recommended'],
);
diff --git a/package.json b/package.json
index bcf16c7ec4..2562b81c26 100644
--- a/package.json
+++ b/package.json
@@ -66,7 +66,6 @@
"cross-env": "^10.1.0",
"eslint": "^9.39.2",
"eslint-import-resolver-typescript": "^4.4.4",
- "eslint-plugin-oxlint": "^1.32.0",
"eslint-plugin-perfectionist": "^4.15.1",
"eslint-plugin-typescript-paths": "^0.0.33",
"globals": "^16.5.0",
diff --git a/upcoming-release-notes/6462.md b/upcoming-release-notes/6462.md
new file mode 100644
index 0000000000..2204982d9b
--- /dev/null
+++ b/upcoming-release-notes/6462.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [MatissJanis]
+---
+
+lint: move actual eslint rules to oxlint and some eslint
diff --git a/yarn.lock b/yarn.lock
index 915b32343e..ada980e657 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -10054,7 +10054,6 @@ __metadata:
cross-env: "npm:^10.1.0"
eslint: "npm:^9.39.2"
eslint-import-resolver-typescript: "npm:^4.4.4"
- eslint-plugin-oxlint: "npm:^1.32.0"
eslint-plugin-perfectionist: "npm:^4.15.1"
eslint-plugin-typescript-paths: "npm:^0.0.33"
globals: "npm:^16.5.0"
@@ -14710,15 +14709,6 @@ __metadata:
languageName: node
linkType: hard
-"eslint-plugin-oxlint@npm:^1.32.0":
- version: 1.32.0
- resolution: "eslint-plugin-oxlint@npm:1.32.0"
- dependencies:
- jsonc-parser: "npm:^3.3.1"
- checksum: 10/0c82c8fdb2201c71825f4e6c796801b72795fa567a3a9e927e36bf197ed55d2cd2a72373c726f56a49d5c6c1eb3a1dffe25ce0f2ea492e13bef6a6de73db07ff
- languageName: node
- linkType: hard
-
"eslint-plugin-perfectionist@npm:^4.15.1":
version: 4.15.1
resolution: "eslint-plugin-perfectionist@npm:4.15.1"
@@ -18341,7 +18331,7 @@ __metadata:
languageName: node
linkType: hard
-"jsonc-parser@npm:^3.2.0, jsonc-parser@npm:^3.3.1":
+"jsonc-parser@npm:^3.2.0":
version: 3.3.1
resolution: "jsonc-parser@npm:3.3.1"
checksum: 10/9b0dc391f20b47378f843ef1e877e73ec652a5bdc3c5fa1f36af0f119a55091d147a86c1ee86a232296f55c929bba174538c2bf0312610e0817a22de131cc3f4