mirror of
https://github.com/Mintplex-Labs/anything-llm
synced 2026-04-26 01:25:15 +02:00
* Install eslint-plugin-unsued-imports * Refactor eslint to a sane working config * enable jsx-no-target-blank | disable no-escaped-entities * disable react/display-name react-hooks/immutability and react-hooks/preserve-manual-memoization * chore: remove unused imports (#4925) remove unused imports * fix: resolve react-hooks ESLint errors (#4929) fix react-hooks linting errors * fix: add rel=noreferrer to target=_blank links (#4928) Fix no target blank errors * fix: resolve undefined variable errors in frontend (#4927) * delete unused file src/components/DataConnectorOption/index.jsx * fix undefined errors * chore: Remove unused variables in frontend (#4924) Remove unused variables --------- Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
81 lines
2.3 KiB
JavaScript
81 lines
2.3 KiB
JavaScript
import js from "@eslint/js"
|
|
import globals from "globals"
|
|
import pluginReact from "eslint-plugin-react"
|
|
import pluginReactHooks from "eslint-plugin-react-hooks"
|
|
import pluginPrettier from "eslint-plugin-prettier"
|
|
import configPrettier from "eslint-config-prettier"
|
|
import unusedImports from "eslint-plugin-unused-imports"
|
|
|
|
export default [
|
|
{
|
|
ignores: ["**/*.min.js", "src/media/**/*"]
|
|
},
|
|
|
|
// Base JS recommended rules
|
|
js.configs.recommended,
|
|
|
|
// Your React/JSX files
|
|
{
|
|
files: ["src/**/*.{js,jsx,mjs,cjs}"],
|
|
languageOptions: {
|
|
ecmaVersion: "latest",
|
|
sourceType: "module",
|
|
parserOptions: {
|
|
ecmaFeatures: { jsx: true }
|
|
},
|
|
globals: globals.browser
|
|
},
|
|
plugins: {
|
|
react: pluginReact,
|
|
"react-hooks": pluginReactHooks,
|
|
"unused-imports": unusedImports,
|
|
prettier: pluginPrettier
|
|
},
|
|
settings: {
|
|
react: { version: "detect" }
|
|
},
|
|
rules: {
|
|
// React recommended rules (inline, since we're not "extending" in flat config)
|
|
...pluginReact.configs.flat.recommended.rules,
|
|
|
|
// If you want hooks rules, add these (recommended)
|
|
...pluginReactHooks.configs.recommended.rules,
|
|
|
|
// Prettier: disable conflicting stylistic rules + optionally enforce formatting
|
|
...configPrettier.rules,
|
|
"prettier/prettier": "error",
|
|
|
|
// Your overrides
|
|
"react/react-in-jsx-scope": "off",
|
|
"react-hooks/exhaustive-deps": "off",
|
|
"react/prop-types": "off",
|
|
"react-hooks/set-state-in-effect": "off",
|
|
"react/jsx-no-target-blank": "error",
|
|
"react/no-unescaped-entities": "off",
|
|
"react/display-name": "off",
|
|
"react-hooks/immutability": "off",
|
|
"react-hooks/preserve-manual-memoization": "off",
|
|
"no-extra-boolean-cast": "off",
|
|
"no-prototype-builtins": "off",
|
|
"no-empty": "off",
|
|
"no-useless-escape": "off",
|
|
"no-undef": "error",
|
|
"no-unsafe-optional-chaining": "off",
|
|
"no-constant-binary-expression": "off",
|
|
|
|
// Unused cleanup
|
|
"no-unused-vars": "off",
|
|
"unused-imports/no-unused-imports": "error",
|
|
"unused-imports/no-unused-vars": [
|
|
"warn",
|
|
{
|
|
vars: "all",
|
|
varsIgnorePattern: "^_",
|
|
args: "after-used",
|
|
argsIgnorePattern: "^_"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|