diff --git a/eslint.config.mjs b/eslint.config.mjs index 52d9614..9763c9d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,6 +1,45 @@ import coreWebVitals from 'eslint-config-next/core-web-vitals' import nextTypescript from 'eslint-config-next/typescript' -const eslintConfig = [...coreWebVitals, ...nextTypescript] +/** @type {import('eslint').Linter.Config[]} */ +const eslintConfig = [ + ...coreWebVitals, + ...nextTypescript, + { + rules: { + // Enforce code style consistency + 'no-console': ['warn', { allow: ['warn', 'error'] }], + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], + 'no-var': 'error', + 'prefer-const': 'error', + eqeqeq: ['error', 'always', { null: 'ignore' }], + 'no-duplicate-imports': 'error', + 'no-multiple-empty-lines': ['warn', { max: 2, maxEOF: 1 }], + 'import/order': [ + 'warn', + { + groups: [ + 'builtin', + 'external', + 'internal', + 'parent', + 'sibling', + 'index', + ], + 'newlines-between': 'always', + alphabetize: { order: 'asc', caseInsensitive: true }, + }, + ], + }, + }, +] export default eslintConfig diff --git a/package.json b/package.json index a6e700b..46a90fe 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ }, "lint-staged": { "*.{ts,tsx}": [ + "eslint --fix --max-warnings 0", "bash -c \"tsc --noEmit\"" ] },