0.1.1 • Published 7 months ago
eslint-plugin-require-sort-like v0.1.1
eslint-plugin-require-sort-like
Enforce sorted require
declarations within modules.
This plugin was initialized via generator-eslint
.
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-require-sort-like
:
npm install eslint-plugin-require-sort-like --save-dev
Usage
In your configuration file, import the plugin eslint-plugin-require-sort-like
and add require-sort-like
to the plugins
key:
import require-sort-like from "eslint-plugin-require-sort-like";
export default [
{
plugins: {
require-sort-like
}
}
];
Then configure the rules you want to use under the rules
key.
import require-sort-like from "eslint-plugin-require-sort-like";
export default [
{
plugins: {
require-sort-like
},
rules: {
"require-sort-like/duplicates": "error",
"require-sort-like/sort-declarations": "error",
"require-sort-like/sort-properties": ["error", {
"ignoreCase": false,
}]
}
}
];
Development
You can use ESLint Code Explorer to check AST.
Rules
🔧 Automatically fixable by the --fix
CLI option.
Name | Description | 🔧 |
---|---|---|
duplicates | Prevent multiple require declarations from the same package. | |
sort-declarations | Enforce sorted require declarations within modules. | 🔧 |
sort-properties | Sort require properties alphabetically. | 🔧 |