dukeluo / eslint-plugin-check-file

ESLint rules for consistent filename and folder. Allows you to enforce a consistent naming pattern for the filename and folder.

Home Page:https://www.npmjs.com/package/eslint-plugin-check-file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Next.JS dynamic routes, slug, catch all and optional catch all support

mleimer opened this issue · comments

Feature request
Support Next.JS folder and file naming convention as a named rule.

Acceptance criteria
Folder and file names within a certain directory eg. pages are to be considered valid if at least one of the following conventions hold true:

  • kebab-case (regular pages-folders), eg. posts or web-posts
  • camelCase enclosed in [], eg. [postId]
  • or camelCase enclosed in [...], where this must be a leaf node, eg. [...slug]
  • or camelCase enclosed in [[...]], where this must be a leaf node, eg. [[...slug]]

Current workaround

  • Define own glob pattern.

Further documentation
https://nextjs.org/docs/routing/dynamic-routes

commented

Thank you for taking the time to send me a feature request for my check-file plugin. However, after careful consideration, I have decided that the requested feature is not within the scope of my plugin.

As you mentioned, the requested rule is specific to Next.js and not applicable to my plugin, which is designed to focus solely on folder and file checks without any connection to any particular framework. Therefore, the requested rule should be included in a Next.js specific ESLint plugin.

Nevertheless, if you have created your own pattern that addresses this requirement and would like to share it with others, I would be happy to add it to the plugin's readme so that other users can benefit from your contribution.

commented

@mleimer A new name convention was added in version 2.5.0, NEXT_JS_APP_ROUTER_CASE, which is useful for Next.js App Router projects. Click here to learn more.