ESLint plugin for making your code easier to read
npm install eslint-plugin-collationESLint plugin for making your code easier to read, with autofix and TypeScript support
``sh`
npm install eslint eslint-plugin-collation @typescript-eslint/parser --save-dev
Add collation to the plugins and rules section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
`json`
{
"parser": "@typescript-eslint/parser",
"plugins": ["collation"],
"rules": {
"collation/group-exports": "warn",
"collation/no-default-export": "warn",
"collation/no-inline-export": "warn",
"collation/sort-dependency-list": "warn",
"collation/sort-exports": "warn"
}
}
> :warning: You will need to specify @typescript-eslint/parser in your .eslintrc` file even if you aren't using TypeScript.
| Rule | Description | Fixable |
| ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | -------- |
| collation/group-exports | Consolidates multiple export statements | :wrench: |
| collation/no-default-export | Enforces exports to be named | :wrench: |
| collation/no-inline-export | Enforces exports to appear at the end of the file | :wrench: |
| collation/prefer-import | Enforces imports from a preferred module over another, such as for tree-shaking purposes or wrapping a library. | :wrench: |
| collation/sort-dependency-list | Sorts React dependency lists | :wrench: |
| collation/sort-exports | Sorts specifiers in an export statement | :wrench: |
For documentation and examples for the available rules, see Rules