An ESLint plugin for writing better exports. If you're a fan of ES modules (named exports to be specific), this plugin is for you.
You'll first need to install ESLint:
$ npm i -D eslint
$ yarn add -D eslint
Next, install eslint-plugin-better-exports
:
$ npm i -D eslint-plugin-better-exports
$ yarn add -D eslint-plugin-better-exports
Add better-exports
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"better-exports"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"better-exports/rule-name": 2
}
}
-
- Matches the name of the file exactly with what's being exported out of it. If the name of the file is
MyFile.tsx
, the component being exported out should also be namedMyFile
.
- Matches the name of the file exactly with what's being exported out of it. If the name of the file is
-
- Checks if there's only one thing being exported out of a file.