eslint wip

This commit is contained in:
timothycarambat
2025-10-02 13:48:39 -07:00
parent 8cdadd8cb3
commit 3d375662a8
4 changed files with 853 additions and 371 deletions

View File

@@ -1,91 +0,0 @@
import globals from "./server/node_modules/globals/index.js"
import eslintRecommended from "./server/node_modules/@eslint/js/src/index.js"
import eslintConfigPrettier from "./server/node_modules/eslint-config-prettier/index.js"
import prettier from "./server/node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js"
import react from "./server/node_modules/eslint-plugin-react/index.js"
import reactRefresh from "./server/node_modules/eslint-plugin-react-refresh/index.js"
import reactHooks from "./server/node_modules/eslint-plugin-react-hooks/index.js"
import ftFlow from "./server/node_modules/eslint-plugin-ft-flow/dist/index.js"
import hermesParser from "./server/node_modules/hermes-eslint/dist/index.js"
const reactRecommended = react.configs.recommended
const jsxRuntime = react.configs["jsx-runtime"]
export default [
eslintRecommended.configs.recommended,
eslintConfigPrettier,
{
ignores: ["**/*.test.js"],
languageOptions: {
parser: hermesParser,
parserOptions: {
ecmaFeatures: { jsx: true }
},
ecmaVersion: 2020,
sourceType: "module",
globals: {
...globals.browser,
...globals.es2020,
...globals.node
}
},
linterOptions: { reportUnusedDisableDirectives: true },
settings: { react: { version: "18.2" } },
plugins: {
ftFlow,
react,
"jsx-runtime": jsxRuntime,
"react-hooks": reactHooks,
prettier
},
rules: {
...reactRecommended.rules,
...reactHooks.configs.recommended.rules,
...ftFlow.recommended,
"no-unused-vars": "warn",
"no-undef": "warn",
"no-empty": "warn",
"no-extra-boolean-cast": "warn",
"no-prototype-builtins": "off",
"prettier/prettier": "warn"
}
},
{
files: ["frontend/src/**/*.js"],
plugins: {
ftFlow,
prettier
},
rules: {
"prettier/prettier": "warn"
}
},
{
files: [
"server/endpoints/**/*.js",
"server/models/**/*.js",
"server/swagger/**/*.js",
"server/utils/**/*.js",
"server/index.js"
],
rules: {
"no-undef": "warn"
}
},
{
files: ["frontend/src/**/*.jsx"],
plugins: {
ftFlow,
react,
"jsx-runtime": jsxRuntime,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
prettier
},
rules: {
...jsxRuntime.rules,
"react/prop-types": "off", // FIXME
"react-refresh/only-export-components": "warn"
}
}
]

21
frontend/eslint.config.js Normal file
View File

@@ -0,0 +1,21 @@
import js from "@eslint/js";
import globals from "globals";
import pluginReact from "eslint-plugin-react";
import { defineConfig, globalIgnores } from "eslint/config";
export default defineConfig([
globalIgnores([
"public/**",
]),
{
files: ["src/**/*.js"],
plugins: {
js,
},
extends: ["js/recommended"],
languageOptions: {
globals: globals.browser
},
},
pluginReact.configs.flat.recommended,
]);

View File

@@ -58,16 +58,17 @@
"autoprefixer": "^10.4.14",
"buffer": "^6.0.3",
"cross-env": "^7.0.3",
"eslint": "^8.50.0",
"eslint": "^9.36.0",
"@eslint/js": "^9.36.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-ft-flow": "^3.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"flow-bin": "^0.217.0",
"flow-remove-types": "^2.217.1",
"globals": "^13.21.0",
"globals": "^16.4.0",
"hermes-eslint": "^0.15.0",
"postcss": "^8.4.23",
"prettier": "^3.0.3",

File diff suppressed because it is too large Load Diff