Skip to content

Commit 5f63c4b

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

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/constants/naming-convention.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const PASCAL_CASE = '*([A-Z]*([a-z0-9]))';
1717
/**
1818
* @example hello, hello_world
1919
*/
20-
const SNAKE_CASE = '+([a-z])*(_+([a-z0-9]))';
20+
const SNAKE_CASE = '+([a-z])*([a-z0-9])*(_+([a-z0-9]))';
2121

2222
/**
2323
* @example hello, hello-world

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ ruleTester.run(
185185
filename: 'src/utils/calculate_price.js',
186186
options: [{ '*.js': 'SNAKE_CASE', '*.jsx': 'SNAKE_CASE' }],
187187
},
188+
{
189+
code: "var foo = 'bar';",
190+
filename: 'src/utils/i18n_test.js',
191+
options: [{ '*.js': 'SNAKE_CASE', '*.jsx': 'SNAKE_CASE' }],
192+
},
188193
],
189194

190195
invalid: [
@@ -240,6 +245,19 @@ ruleTester.run(
240245
},
241246
],
242247
},
248+
{
249+
code: "var foo = 'bar';",
250+
filename: 'src/utils/18_test.js',
251+
options: [{ '*.js': 'SNAKE_CASE', '*.jsx': 'SNAKE_CASE' }],
252+
errors: [
253+
{
254+
message:
255+
'The filename "18_test.js" does not match the "SNAKE_CASE" style',
256+
column: 1,
257+
line: 1,
258+
},
259+
],
260+
},
243261
],
244262
}
245263
);

0 commit comments

Comments
 (0)