Skip to content

Next.js App Router (check-file/folder-naming-convention: NEXT_JS_APP_ROUTER_CASE) #65

@sladik-maksym

Description

@sladik-maksym

Describe the bug
When using the NEXT_JS_APP_ROUTER_CASE option in check-file/folder-naming-convention,
any folder inside src can be named like a Next.js App Router folder (e.g., [constants]),
and ESLint doesn’t throw an error.

This means the rule currently allows App Router–style naming ([id], (group), etc.) everywhere,
not only inside the app/ folder.

Expected behavior
NEXT_JS_APP_ROUTER_CASE should only be valid within specific routing folders (like src/app/**/),
while other folders in src should still be checked against KEBAB_CASE.

Example:
✅ src/app/api/auth/[...nextauth]/route.ts — allowed
❌ src/[constants]/index.ts — should trigger an error

Plugin configuration
'check-file/folder-naming-convention': [
'error',
{
'src/**/': 'NEXT_JS_APP_ROUTER_CASE',
},
]

Project structure

.
├── package-lock.json
├── package.json
└── src
    ├── app
    │   ├── api
    │   ├── login
    │   └── layout.tsx
    ├── utils
    ├── configs
    ├── styles
    ├── providers
    ├── store
    ├── services
    └── constants

Desktop (please complete the following information):
OS: macOS
ESLint version: 9.36.0
eslint-plugin-check-file version: 3.3.0

Additional context
The current NEXT_JS_APP_ROUTER_CASE matcher seems too permissive —
it validates all bracket or parenthesis folder names globally, not just in App Router context.
It would be useful to restrict its effect to a specific path pattern (e.g., src/app/**/).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions