first commit
This commit is contained in:
68
eslint.config.js
Normal file
68
eslint.config.js
Normal file
@@ -0,0 +1,68 @@
|
||||
import js from "@eslint/js";
|
||||
import globals from "globals";
|
||||
import reactHooks from "eslint-plugin-react-hooks";
|
||||
import reactRefresh from "eslint-plugin-react-refresh";
|
||||
import tseslint from "typescript-eslint";
|
||||
import { defineConfig, globalIgnores } from "eslint/config";
|
||||
import simpleImportSort from "eslint-plugin-simple-import-sort";
|
||||
import pluginRouter from "@tanstack/eslint-plugin-router";
|
||||
import pluginQuery from "@tanstack/eslint-plugin-query";
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(["dist"]),
|
||||
{
|
||||
files: ["**/*.{ts,tsx}"],
|
||||
extends: [
|
||||
js.configs.recommended,
|
||||
tseslint.configs.recommended,
|
||||
reactHooks.configs["recommended-latest"],
|
||||
reactRefresh.configs.vite,
|
||||
],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2020,
|
||||
globals: globals.browser,
|
||||
},
|
||||
plugins: {
|
||||
"simple-import-sort": simpleImportSort,
|
||||
"@tanstack/router": pluginRouter,
|
||||
"@tanstack/query": pluginQuery,
|
||||
},
|
||||
rules: {
|
||||
"@tanstack/router/create-route-property-order": "error",
|
||||
"@tanstack/query/no-rest-destructuring": "error",
|
||||
"@tanstack/query/stable-query-client": "error",
|
||||
"@tanstack/query/no-unstable-deps": "error",
|
||||
"@tanstack/query/infinite-query-property-order": "error",
|
||||
"@tanstack/query/no-void-query-fn": "error",
|
||||
"@tanstack/query/exhaustive-deps": "error",
|
||||
"simple-import-sort/imports": [
|
||||
"error",
|
||||
{
|
||||
groups: [
|
||||
// 1. React imports (exactly 'react')
|
||||
["^react$"],
|
||||
// 2. Other external packages and side-effect imports.
|
||||
// The negative lookahead (?!\.) ensures the specifier doesn't start with a dot.
|
||||
["^(\\u0000|(?!(react$))@?\\w)(?!\\.).*"],
|
||||
// 3. Hashed (absolute) imports, in a specific order:
|
||||
["^@/assets/"],
|
||||
["^@/components/ui/"],
|
||||
["^@/components/"],
|
||||
["^@/config/"],
|
||||
["^@/hooks/"],
|
||||
["^@/tests/"],
|
||||
["^@/lib/"],
|
||||
["^@/utils/"],
|
||||
["^@/services/"],
|
||||
// 4. Index imports.
|
||||
["^\\./index(\\.tsx?|$)"],
|
||||
// 5. Other relative imports that are NOT CSS files.
|
||||
["^(?!\\./.*\\.css$)\\./"],
|
||||
// 6. CSS imports – always at the very end (with a newline before them).
|
||||
["^\\./.*\\.css$"],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
Reference in New Issue
Block a user