implemented initial eslintFixes

This commit is contained in:
PxlLoewe
2025-07-09 01:06:54 -07:00
parent f793f2623b
commit 98ed0cb5ca
20 changed files with 309 additions and 111 deletions

View File

@@ -1,49 +1,32 @@
import { defineConfig } from "eslint/config";
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import tseslint from "typescript-eslint";
import pluginReactHooks from "eslint-plugin-react-hooks";
import pluginReact from "eslint-plugin-react";
import globals from "globals";
import pluginNext from "@next/eslint-plugin-next";
import { config as baseConfig } from "./base.js";
/**
* A custom ESLint configuration for libraries that use Next.js.
*
* @type {import("eslint").Linter.Config}
* */
export const nextJsConfig = [
...baseConfig,
js.configs.recommended,
eslintConfigPrettier,
...tseslint.configs.recommended,
export default defineConfig([
{
...pluginReact.configs.flat.recommended,
languageOptions: {
...pluginReact.configs.flat.recommended.languageOptions,
globals: {
...globals.serviceworker,
},
},
ignores: ["node_modules/*", "dist/*", ".next/*", "out/*"],
},
{
files: ["**/*.{js,ts,jsx,tsx}"],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
plugins: {
"react-hooks": pluginReactHooks,
"@next/next": pluginNext,
},
rules: {
...pluginNext.configs.recommended.rules,
...pluginNext.configs["core-web-vitals"].rules,
},
},
{
plugins: {
"react-hooks": pluginReactHooks,
},
settings: { react: { version: "detect" } },
rules: {
...pluginReactHooks.configs.recommended.rules,
// React scope no longer necessary with new JSX transform.
...pluginNext.configs.recommended.rules,
"react/react-in-jsx-scope": "off",
},
},
];
...tseslint.config(js.configs.recommended, tseslint.configs.recommended, eslintConfigPrettier),
]);

View File

@@ -9,15 +9,18 @@
},
"devDependencies": {
"@eslint/js": "^9.17.0",
"@next/eslint-plugin-next": "^15.1.0",
"@next/eslint-plugin-next": "^15.3.3",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-turbo": "^2.3.0",
"globals": "^15.12.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.15.0"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^8.36.0"
}
}