chore: migrate lint to ESLint CLI with flat config
This commit is contained in:
60
eslint.config.mjs
Normal file
60
eslint.config.mjs
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
import { defineConfig } from "eslint/config";
|
||||||
|
import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
|
||||||
|
import nextTypescript from "eslint-config-next/typescript";
|
||||||
|
import unusedImports from "eslint-plugin-unused-imports";
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
...nextCoreWebVitals,
|
||||||
|
...nextTypescript,
|
||||||
|
{
|
||||||
|
plugins: {
|
||||||
|
"unused-imports": unusedImports,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
argsIgnorePattern: "^_",
|
||||||
|
varsIgnorePattern: "^_",
|
||||||
|
caughtErrorsIgnorePattern: "^_",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"no-console": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
allow: ["warn", "error"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"@next/next/no-html-link-for-pages": "off",
|
||||||
|
"react/no-unescaped-entities": "off",
|
||||||
|
"no-unreachable": "error",
|
||||||
|
"no-unused-expressions": "warn",
|
||||||
|
"no-unused-private-class-members": "warn",
|
||||||
|
"unused-imports/no-unused-imports": "warn",
|
||||||
|
"unused-imports/no-unused-vars": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
vars: "all",
|
||||||
|
varsIgnorePattern: "^_",
|
||||||
|
args: "after-used",
|
||||||
|
argsIgnorePattern: "^_",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"no-empty-function": "warn",
|
||||||
|
"no-empty": ["warn", { allowEmptyCatch: true }],
|
||||||
|
"@typescript-eslint/no-explicit-any": "warn",
|
||||||
|
"@typescript-eslint/no-empty-object-type": "warn",
|
||||||
|
"@typescript-eslint/no-require-imports": "warn",
|
||||||
|
"react-hooks/error-boundaries": "warn",
|
||||||
|
"react-hooks/set-state-in-effect": "warn",
|
||||||
|
"react-hooks/refs": "warn",
|
||||||
|
"react-hooks/purity": "warn",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["scripts/**/*.{js,mjs,cjs}"],
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/no-require-imports": "off",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"start:prod": "node scripts/init-db.mjs && pnpm start",
|
"start:prod": "node scripts/init-db.mjs && pnpm start",
|
||||||
"init-db": "node scripts/init-db.mjs",
|
"init-db": "node scripts/init-db.mjs",
|
||||||
"reset-admin-password": "node scripts/reset-admin-password.mjs",
|
"reset-admin-password": "node scripts/reset-admin-password.mjs",
|
||||||
"lint": "next lint",
|
"lint": "eslint .",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"icons": "node scripts/generate-icons.js",
|
"icons": "node scripts/generate-icons.js",
|
||||||
"postinstall": "prisma generate"
|
"postinstall": "prisma generate"
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export abstract class BaseApiService {
|
|||||||
headers,
|
headers,
|
||||||
...options,
|
...options,
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
// @ts-ignore - undici-specific options not in standard fetch types
|
// @ts-expect-error - undici-specific options not in standard fetch types
|
||||||
connectTimeout: timeoutMs,
|
connectTimeout: timeoutMs,
|
||||||
bodyTimeout: timeoutMs,
|
bodyTimeout: timeoutMs,
|
||||||
headersTimeout: timeoutMs,
|
headersTimeout: timeoutMs,
|
||||||
@@ -155,12 +155,11 @@ export abstract class BaseApiService {
|
|||||||
headers,
|
headers,
|
||||||
...options,
|
...options,
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
// @ts-ignore - undici-specific options
|
// @ts-expect-error - undici-specific options
|
||||||
connectTimeout: timeoutMs,
|
connectTimeout: timeoutMs,
|
||||||
bodyTimeout: timeoutMs,
|
bodyTimeout: timeoutMs,
|
||||||
headersTimeout: timeoutMs,
|
headersTimeout: timeoutMs,
|
||||||
// Force IPv4 si IPv6 pose problème
|
// Force IPv4 si IPv6 pose problème
|
||||||
// @ts-ignore
|
|
||||||
family: 4,
|
family: 4,
|
||||||
// Next.js cache with tags support
|
// Next.js cache with tags support
|
||||||
next: options.tags
|
next: options.tags
|
||||||
@@ -177,7 +176,7 @@ export abstract class BaseApiService {
|
|||||||
headers,
|
headers,
|
||||||
...options,
|
...options,
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
// @ts-ignore - undici-specific options
|
// @ts-expect-error - undici-specific options
|
||||||
connectTimeout: timeoutMs,
|
connectTimeout: timeoutMs,
|
||||||
bodyTimeout: timeoutMs,
|
bodyTimeout: timeoutMs,
|
||||||
headersTimeout: timeoutMs,
|
headersTimeout: timeoutMs,
|
||||||
|
|||||||
Reference in New Issue
Block a user