Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 56 additions & 26 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import path from "node:path";
import { fileURLToPath } from "node:url";

import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import nextPlugin from "@next/eslint-plugin-next";
import importPlugin from "eslint-plugin-import";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import unusedImports from "eslint-plugin-unused-imports";
import globals from "globals";
import tseslint from "typescript-eslint";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

const config = [
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
{
ignores: [
"**/.next/**",
Expand All @@ -24,46 +19,81 @@ const config = [
"**/coverage/**",
],
},
...compat.extends("next/core-web-vitals"),
{
files: ["**/*.{js,mjs,cjs,jsx,ts,tsx}"],
plugins: {
"@next/next": nextPlugin,
"react": reactPlugin,
"react-hooks": reactHooksPlugin,
"simple-import-sort": simpleImportSort,
"import": importPlugin,
"unused-imports": unusedImports,
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.es2021,
},
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: "detect",
},
},
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
// React rules
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
...reactHooksPlugin.configs.recommended.rules,
// Next.js rules
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs["core-web-vitals"].rules,

// Import sorting
"simple-import-sort/imports": [
"error",
{
groups: [
["^node:"],
["^react", "^next"],
["^@?\\w"], // external packages (third-party libraries)
["^@?\\w"],
["^@/"],
["^\\.\\.(?!/?$)", "^\\.\\./?$"], // relative imports starting with ../
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"], // relative imports starting with ./
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
["^.+\\.s?css$"],
],
},
],
"simple-import-sort/exports": "error",

// additional import rules
// Import rules
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"import/no-unresolved": "off", // turn off as Next.js handles module resolution
"import/order": "off", // we use simple-import-sort instead
"import/no-unresolved": "off",
"import/order": "off",

// Remove unused imports automatically
// Unused imports
"unused-imports/no-unused-imports": "error",
// Optional: flag unused vars but allow underscore prefix to intentionally ignore
"unused-imports/no-unused-vars": [
"warn",
{ vars: "all", varsIgnorePattern: "^_", args: "after-used", argsIgnorePattern: "^_" },
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
},
},
];

export default config;
);
File renamed without changes.
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
"axios": "^1.12.2",
"boring-avatars": "^2.0.4",
"framer-motion": "^11.11.11",
"next": "latest",
"next": "16.0.1",
"next-auth": "^4.24.10",
"nodemailer": "^6.9.16",
"nookies": "^2.5.2",
"react": "latest",
"react-dom": "latest",
"react": "19.2.0",
"react-dom": "19.2.0",
"react-google-recaptcha": "^3.1.0",
"react-hook-form": "^7.53.1",
"react-icons": "^5.3.0",
Expand All @@ -39,20 +39,22 @@
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.36.0",
"@types/cookie": "^0.6.0",
"@types/node": "latest",
"@types/node": "^20",
"@types/nodemailer": "^6.4.16",
"@types/react": "latest",
"@types/react-dom": "latest",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/react-google-recaptcha": "^2.1.9",
"eslint": "latest",
"eslint-config-next": "latest",
"eslint": "^9",
"eslint-config-next": "16.0.1",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^4.1.4",
"globals": "^16.5.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"typescript": "latest"
"typescript": "^5",
"typescript-eslint": "^8.46.4"
},
"lint-staged": {
"src/**/*.{ts,tsx,js,jsx,md,mdx,css,yaml,yml}": [
Expand Down
Loading