Skip to content

Commit cb187cb

Browse files
committed
fix(naming-convention/filename): update regex patterns in default options and enhance name filtering logic
1 parent 4c25203 commit cb187cb

File tree

1 file changed

+5
-5
lines changed
  • packages/plugins/eslint-plugin-react-naming-convention/src/rules

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ const defaultOptions = [
3434
{
3535
excepts: [
3636
"index",
37-
"/^_/",
38-
"/^\\$/",
39-
"/^[0-9]+$/",
40-
"/^\\[[^\\]]+\\]$/",
37+
String.raw`/^_/`,
38+
String.raw`/^\$/`,
39+
String.raw`/^[0-9]+$/`,
40+
String.raw`/^\[[^\]]+\]$/`,
4141
],
4242
rule: "PascalCase",
4343
},
@@ -102,7 +102,7 @@ export function create(context: RuleContext<MessageID, Options>): RuleListener {
102102

103103
function validate(name: string, casing: Case = rule, ignores = excepts) {
104104
if (ignores.some((pattern) => pattern.test(name))) return true;
105-
const filteredName = name.match(/[\w-]/gu)?.join("") ?? "";
105+
const filteredName = name.match(/[\w.-]/gu)?.join("") ?? "";
106106
if (filteredName.length === 0) return true;
107107
return match(casing)
108108
.with("PascalCase", () => RE.PASCAL_CASE.test(filteredName))

0 commit comments

Comments
 (0)