Skip to content

Commit abc37d1

Browse files
committed
docs: update docs
1 parent 725778f commit abc37d1

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

docs/rules/filename-naming-convention.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ This rule aims to format the filename of the specified file. This rule uses the
88

99
There are six basic naming conventions built into this rule, including `CAMEL_CASE`, `PASCAL_CASE`, `SNAKE_CASE`, `KEBAB_CASE`, `SCREAMING_SNAKE_CASE` and `FLAT_CASE`.
1010

11+
And there is also a special naming convention for Next.js page router project, which is `NEXT_JS_PAGE_ROUTER_FILENAME_CASE`, you can use it to ensure the filename of the page router is consistent with the naming convention. You can read more about it under [`NEXT_JS_PAGE_ROUTER_FILENAME_CASE`](#NEXT_JS_PAGE_ROUTER_FILENAME_CASE).
12+
1113
| Formatting | Name |
1214
| ----------- | ---------------------- |
1315
| helloWorld | `CAMEL_CASE` |
@@ -17,8 +19,6 @@ There are six basic naming conventions built into this rule, including `CAMEL_CA
1719
| HELLO_WORLD | `SCREAMING_SNAKE_CASE` |
1820
| helloworld | `FLAT_CASE` |
1921

20-
And there is also a special naming convention for Next.js page router project, which is `NEXT_JS_PAGE_ROUTER_FILENAME_CASE`, you can use it to ensure the filename of the page router is consistent with the naming convention.
21-
2222
If the rule had been set as follows:
2323

2424
```js
@@ -53,6 +53,12 @@ In addition to the built-in naming conventions, you can also set custom naming p
5353

5454
**Tip:** To selecte all your `js` files, your can use the glob expression `**/*.js`.
5555

56+
### `NEXT_JS_PAGE_ROUTER_FILENAME_CASE`
57+
58+
The `NEXT_JS_PAGE_ROUTER_FILENAME_CASE` aims to support a wide range of filename naming convention in Next.js Page Router projects. If you would like to enforce a camelCase naming convention for your filename, but also support Next.js' Dynamic segments, Catch-all segments and Optional Catch-all Segments, this pattern is for you.
59+
60+
While `NEXT_JS_PAGE_ROUTER_FILENAME_CASE` covers many naming cases, it's possible that some cases may be missing. If you come across any missing cases, I encourage you to open an issue and provide the necessary details. Your feedback will help me improve and enhance the naming convention.
61+
5662
### Prefined Match Syntax
5763

5864
Prefined match syntax allow you to capture specific part of the target file pattern and use it in your naming convention pattern. This syntax is particularly useful when you want to make a file to be named the same as its parent folder.

docs/rules/folder-naming-convention.md

+2-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This rule aims to format the name of the specified folder. This rule uses the gl
88

99
There are six basic naming conventions built into this rule, including `CAMEL_CASE`, `PASCAL_CASE`, `SNAKE_CASE`, `KEBAB_CASE`, `SCREAMING_SNAKE_CASE` and `FLAT_CASE`.
1010

11-
Additionally, there is a naming convention called `NEXT_JS_APP_ROUTER_CASE` used to format folder names in Next.js projects that use the App Router. You can read more about it under [Built-in custom patterns](#built-in-custom-patterns).
11+
Additionally, there is a naming convention called `NEXT_JS_APP_ROUTER_CASE` used to format folder names in Next.js projects that use the App Router. You can read more about it under [`NEXT_JS_APP_ROUTER_CASE`](#NEXT_JS_APP_ROUTER_CASE).
1212

1313
| Formatting | Name |
1414
| ----------- | ---------------------- |
@@ -41,8 +41,6 @@ Examples of **correct** folder name for this rule:
4141
src/components/displayLabel/displayLabel.js
4242
```
4343

44-
## Custom patterns
45-
4644
In addition to the built-in naming conventions, you can also set custom naming patterns using glob match syntax. The following code shows an example of how to ensure that all the folders under the `components` folder are named begin with `__`:
4745

4846
```js
@@ -53,11 +51,7 @@ In addition to the built-in naming conventions, you can also set custom naming p
5351

5452
**Tip:** To exclude `__tests__` folder in `src`, use the glob expression `src/**/!(__tests__)/` to get the target folders.
5553

56-
## Built-in custom patterns
57-
58-
Some patterns are complex enough that they warrant their own definition within the lib.
59-
60-
### Next.js custom pattern
54+
### `NEXT_JS_APP_ROUTER_CASE`
6155

6256
The `NEXT_JS_APP_ROUTER_CASE` aims to support a wide range of named constructs in Next.js App Router projects.
6357

@@ -83,8 +77,6 @@ export const Page({ params: { pageId } }) { ... }
8377

8478
Besides this, the custom pattern should support all other Next.js naming conventions.
8579

86-
You can read more about them [here](https://github.com/dukeluo/eslint-plugin-check-file/pull/27#issuecomment-1582551071).
87-
8880
While `NEXT_JS_APP_ROUTER_CASE` covers many naming cases, it's possible that some cases may be missing. If you come across any missing cases, I encourage you to open an issue and provide the necessary details. Your feedback will help me improve and enhance the naming convention.
8981

9082
### Options

0 commit comments

Comments
 (0)