Skip to content

Commit 7e1c74b

Browse files
committed
feat(filename): add support for ignoring files starting with a dollar sign
1 parent cb16ecf commit 7e1c74b

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

packages/plugins/eslint-plugin-react-naming-convention/src/rules/filename.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ src/components/example-component.tsx
7070
3. `kebab-case`: kebab-case
7171
4. `snake_case`: snake_case
7272
- `excepts`: An array of string or regex string to ignore specific file names. Default is:
73-
- `"$"`: Ignore `$` files (e.g., `$.tsx`).
7473
- `"index"`: Ignore `index` files (e.g., `index.tsx`).
7574
- `"/^_/"`: Ignore files starting with an underscore (e.g., `_app.tsx`, `_layout.tsx`).
75+
- `"/^\\$/"`: Ignore files starting with a dollar sign (e.g., `$.tsx`, `$id.tsx`).
7676
- `"/^[0-9]+$/"`: Ignore files with only numbers (e.g., `404.tsx`).
7777
- `"/^\[[^\]]+\]$/"`: Ignore files with square brackets (e.g., `[slug].tsx`).
7878

packages/plugins/eslint-plugin-react-naming-convention/src/rules/filename.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ ruleTester.run(RULE_NAME, rule, {
161161
filename: "$.tsx",
162162
options: [{ rule: "PascalCase" }],
163163
},
164+
{
165+
code,
166+
filename: "$id.tsx",
167+
options: [{ rule: "PascalCase" }],
168+
},
164169
{
165170
code,
166171
filename: "_app.tsx",

packages/plugins/eslint-plugin-react-naming-convention/src/rules/filename.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ type Options = readonly [
3333
const defaultOptions = [
3434
{
3535
excepts: [
36-
"$",
3736
"index",
3837
"/^_/",
38+
"/^\\$/",
3939
"/^[0-9]+$/",
4040
"/^\\[[^\\]]+\\]$/",
4141
],

0 commit comments

Comments
 (0)