eslint-plugin-react-filenames
Enforce naming conventions in React projects.
Installation
Install ESLint either locally or globally.
$ npm install eslint
If you installed ESLint
globally, you have to install React plugin globally too. Otherwise, install it locally.
$ npm install eslint-plugin-react-filenames
Configuration
Add plugins
section and specify ESLint-plugin-React as a plugin.
{
"plugins": [
"react-filenames"
]
}
You can also specify some settings that will be shared across all the plugin rules.
{
"settings": {
"react": {
"createClass": "createClass", // Regex for Component Factory to use, default to "createClass"
"pragma": "React", // Pragma to use, default to "React"
"version": "15.0" // React version, default to the latest React stable release
}
}
}
With ESLint 2.x.x or 3.x.x:
{
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
}
}
Finally, enable all of the rules that you would like to use. Use our preset to get reasonable defaults quickly, and/or choose your own:
"rules": {
"react-filenames/filename-matches-component": "error"
}
List of supported rules
License
This is based on ESLint-plugin-React, so it's also licensed under the MIT License.