38 lines
1.5 KiB
JavaScript
38 lines
1.5 KiB
JavaScript
// Flat ESLint config (ESLint 10 / Next.js 16).
|
|
//
|
|
// `next lint` was removed in Next 16, so linting runs through the ESLint CLI
|
|
// directly: `npm run lint`. The eslint-config-next package (v16) ships a
|
|
// ready-made flat-config array that wires up the Next core-web-vitals rules,
|
|
// the TypeScript rules, react / react-hooks / jsx-a11y / import plugins and the
|
|
// TypeScript parser — so we just spread it and layer our project rules on top.
|
|
|
|
import next from 'eslint-config-next';
|
|
import prettier from 'eslint-config-prettier/flat';
|
|
|
|
/** @type {import('eslint').Linter.Config[]} */
|
|
const config = [
|
|
// Things ESLint should never look at.
|
|
{
|
|
ignores: ['.next/**', 'out/**', 'coverage/**', 'node_modules/**', 'next-env.d.ts'],
|
|
},
|
|
|
|
// Next.js + TypeScript + React + import/a11y rule sets.
|
|
...next,
|
|
|
|
// Turn off every stylistic rule that would fight Prettier. Keep this last
|
|
// among the rule-providing entries so it wins. Formatting is owned by
|
|
// Prettier (`npm run format`), never by ESLint.
|
|
prettier,
|
|
|
|
// Project-specific rule overrides go here, e.g.:
|
|
// { rules: { 'react/jsx-key': 'error' } }
|
|
//
|
|
// NOTE: `import/no-cycle` is intentionally NOT enabled. On this toolchain the
|
|
// eslint-plugin-import TypeScript resolver bundled by eslint-config-next 16
|
|
// throws "invalid interface loaded as resolver" for that rule, and it cannot
|
|
// follow the `@/*` path alias to trace cycles anyway. Re-add it once the
|
|
// import-resolver-typescript interface is compatible.
|
|
];
|
|
|
|
export default config;
|