@@ -2,6 +2,7 @@ import { dirname } from 'path'
22import { fileURLToPath } from 'url'
33import { FlatCompat } from '@eslint/eslintrc'
44import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
5+ import unicorn from 'eslint-plugin-unicorn'
56
67const __filename = fileURLToPath ( import . meta. url )
78const __dirname = dirname ( __filename )
@@ -11,11 +12,40 @@ const compat = new FlatCompat({
1112} )
1213
1314const eslintConfig = [
14- ...compat . extends ( 'next/core-web-vitals' , 'next/typescript' , 'plugin:naming/recommended' ) ,
15+ ...compat . extends ( 'next/core-web-vitals' , 'next/typescript' ) ,
1516 {
1617 ignores : [ 'node_modules/**' , '.next/**' , 'out/**' , 'build/**' , 'next-env.d.ts' ] ,
1718 } ,
19+ {
20+ plugins : {
21+ unicorn,
22+ } ,
23+ rules : {
24+ 'unicorn/filename-case' : [
25+ 'error' ,
26+ {
27+ case : 'kebabCase' ,
28+ ignore : [
29+ // This rule applies to filenames, not directory names.
30+ // The original regexes `/^\[.*\]$/` and `/^\(.*\)$/` didn't work because
31+ // they don't account for file extensions (e.g., `.tsx`).
32+
33+ // This updated regex correctly matches dynamic segment files
34+ // like `[id].tsx` or `[...slug].tsx`.
35+ / ^ \[ .* \] \. .+ $ / ,
1836
37+ // This is for the uncommon case where a file is named like a route group,
38+ // e.g., `(marketing).tsx`.
39+ / ^ \( .* \) \. .+ $ / ,
40+
41+ // This correctly ignores files that start with an underscore,
42+ // such as `_app.tsx` or private utility files.
43+ / ^ _ / ,
44+ ] ,
45+ } ,
46+ ] ,
47+ } ,
48+ } ,
1949 eslintPluginPrettierRecommended ,
2050]
2151
0 commit comments