Skip to content

Commit c272126

Browse files
committed
fix: correcting glob expression for screaming snake case
1 parent 5f63c4b commit c272126

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

lib/constants/naming-convention.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const KEBAB_CASE = '+([a-z])*([a-z0-9])*(-+([a-z0-9]))';
2727
/**
2828
* @example HELLO, HELLO_WORLD
2929
*/
30-
const SCREAMING_SNAKE_CASE = '+([A-Z])*(_+([A-Z0-9]))';
30+
const SCREAMING_SNAKE_CASE = '+([A-Z])*([A-Z0-9])*(_+([A-Z0-9]))';
3131

3232
/**
3333
* @example hello, helloworld

tests/lib/rules/filename-naming-convention.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,13 @@ ruleTester.run(
355355
{ '*.js': 'SCREAMING_SNAKE_CASE', '*.jsx': 'SCREAMING_SNAKE_CASE' },
356356
],
357357
},
358+
{
359+
code: "var foo = 'bar';",
360+
filename: 'src/utils/CALCULATE100_PRICE.js',
361+
options: [
362+
{ '*.js': 'SCREAMING_SNAKE_CASE', '*.jsx': 'SCREAMING_SNAKE_CASE' },
363+
],
364+
},
358365
],
359366

360367
invalid: [
@@ -433,6 +440,21 @@ ruleTester.run(
433440
},
434441
],
435442
},
443+
{
444+
code: "var foo = 'bar';",
445+
filename: 'src/utils/100CALCULATE_PRICE.js',
446+
options: [
447+
{ '*.js': 'SCREAMING_SNAKE_CASE', '*.jsx': 'SCREAMING_SNAKE_CASE' },
448+
],
449+
errors: [
450+
{
451+
message:
452+
'The filename "100CALCULATE_PRICE.js" does not match the "SCREAMING_SNAKE_CASE" style',
453+
column: 1,
454+
line: 1,
455+
},
456+
],
457+
},
436458
],
437459
}
438460
);

0 commit comments

Comments
 (0)