Menu
file-path-patterns#
Check if file path follows regular expression.
Rule Options#
1{
2 rules: {
3 "sc-js/file-path-patterns": [
4 <enabled>,
5 {
6 "allowPatterns": <String>[], // Next standard. string that be able to hands over to RegExp
7 "allowPatterns": <RegExp>[], // Deprecated
8 },
9 ],
10 },
11}
allowPatterns#
Specify the string array that be able to hands over to RegExp
or regular expression array
for allows path
values:["index(?:.(?:stories|test))?.tsx?"]
or[/index(?:\.(?:stories|test))?\.tsx?/]
Example of invalid ❌ code when above option value:
1// Button.tsx
2import { useState } from "react"
Example of valid ⭕ code when above option value:
1// Button/index.tsx
2import { useState } from "react"
1// Button/index.stories.tsx
2import { Button } from "./"
1// Button/index.test.tsx
2import { Button } from "./"