Skip to content

brandongregoryscott/eslint-plugin-collation

Repository files navigation


build status smoke test status code style: prettier TypeScript Commitizen friendly semantic-release: angular

ESLint plugin for making your code easier to read, with autofix and TypeScript support

Installation

npm install eslint eslint-plugin-collation @typescript-eslint/parser --save-dev

Usage

Add collation to the plugins and rules section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "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"
    }
}

⚠️ You will need to specify @typescript-eslint/parser in your .eslintrc file even if you aren't using TypeScript.

Rules

Rule Description Fixable
collation/group-exports Consolidates multiple export statements 🔧
collation/no-default-export Enforces exports to be named 🔧
collation/no-inline-export Enforces exports to appear at the end of the file 🔧
collation/prefer-import Enforces imports from a preferred module over another, such as for tree-shaking purposes or wrapping a library. 🔧
collation/sort-dependency-list Sorts React dependency lists 🔧
collation/sort-exports Sorts specifiers in an export statement 🔧

For documentation and examples for the available rules, see Rules