README
eslint-plugin-dirs
Eslint Rules for ensuring directory names and file names to be coincident.
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
# or
yarn add -D eslint
Next, install eslint-plugin-dirs
:
npm install eslint-plugin-dirs --save-dev
#or
yarn add -D eslint-plugin-dirs
Usage
Add dirs
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"dirs"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"dirs/dirnames": 2,
"dirs/filenames": 2,
}
}
Rules
dirs/dirnames
Detect if every directory fragment in the file path is matched with the provided pattern.
{
"dirs/dirnames": [2, { "pattern": "^[a-zA-Z0-9_-]+