You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/filename-naming-convention.md
+8-2
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,8 @@ This rule aims to format the filename of the specified file. This rule uses the
8
8
9
9
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`.
10
10
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
+
11
13
| Formatting | Name |
12
14
| ----------- | ---------------------- |
13
15
| helloWorld |`CAMEL_CASE`|
@@ -17,8 +19,6 @@ There are six basic naming conventions built into this rule, including `CAMEL_CA
17
19
| HELLO_WORLD |`SCREAMING_SNAKE_CASE`|
18
20
| helloworld |`FLAT_CASE`|
19
21
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
-
22
22
If the rule had been set as follows:
23
23
24
24
```js
@@ -53,6 +53,12 @@ In addition to the built-in naming conventions, you can also set custom naming p
53
53
54
54
**Tip:** To selecte all your `js` files, your can use the glob expression `**/*.js`.
55
55
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
+
56
62
### Prefined Match Syntax
57
63
58
64
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.
Copy file name to clipboardExpand all lines: docs/rules/folder-naming-convention.md
+2-10
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ This rule aims to format the name of the specified folder. This rule uses the gl
8
8
9
9
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`.
10
10
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).
12
12
13
13
| Formatting | Name |
14
14
| ----------- | ---------------------- |
@@ -41,8 +41,6 @@ Examples of **correct** folder name for this rule:
41
41
src/components/displayLabel/displayLabel.js
42
42
```
43
43
44
-
## Custom patterns
45
-
46
44
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 `__`:
47
45
48
46
```js
@@ -53,11 +51,7 @@ In addition to the built-in naming conventions, you can also set custom naming p
53
51
54
52
**Tip:** To exclude `__tests__` folder in `src`, use the glob expression `src/**/!(__tests__)/` to get the target folders.
55
53
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`
61
55
62
56
The `NEXT_JS_APP_ROUTER_CASE` aims to support a wide range of named constructs in Next.js App Router projects.
Besides this, the custom pattern should support all other Next.js naming conventions.
85
79
86
-
You can read more about them [here](https://github.com/dukeluo/eslint-plugin-check-file/pull/27#issuecomment-1582551071).
87
-
88
80
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.
0 commit comments