Strict Check

match-names-of-file-and-export#

Match name of filename and export target.
Name that want to match is specified by capture of regular expression.

Rule Options#

1{
2  rules: {
3    "sc-js/match-names-of-file-and-export": [
4      <enabled>,
5      {
6        "captures": <String>[], // Next standard. string that be able to hands over to RegExp
7        "captures": <RegExp>[], // Deprecated
8      },
9    ],
10  },
11}

captures#

Specify the string array that be able to hands over to RegExp or regular expression array for allows path.

values:
["/components/(?:atoms|molecules|organisms|templates)/([^/]+)/index.tsx"]
or
[/\/components\/(?:atoms|molecules|organisms|templates)\/([^/]+)\/index\.tsx/]

Example of invalid ❌ code when above option value

1// /components/atoms/Button/index.tsx
2export const button = () => {}

Example of valid ⭕ code when above option value

1// /components/atoms/Button/index.tsx
2export const Button = () => {}

back to rules of eslint-plugin-sc-js

back to eslint-plugin-sc-js top