Nate-Wilkins / eslint-plugin-jsort

Sort imports effortlessly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eslint-plugin-jsort

npm license status test coverage dependencies

ESLint plugin with rules to sort imports effortlessly.

$ npm install eslint-plugin-jsort

This rule sorts & formats import declaration with a lot of flexibility using eslint --fix.

JavaScript imports are frustrating and this tries to make them a bit easier to work with. Feel free to post any issues/suggestions you might have with the plugin on the issue tracker.

Capabilities

Supported Parsers

Installation

  1. Install ESLint:
$ npm i eslint --save-dev
  1. Install the plugin eslint-plugin-jsort:
$ npm install eslint-plugin-jsort --save-dev

Usage

  1. Add jsort to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
  "plugins": ["jsort"]
}
  1. Then configure the rules you want to use under the rules section.
{
  "rules": {
    "jsort/sort-imports": [
      "error",
      {
        /* `sort-imports` Additional Configuration */
      }
    ],
    "jsort/normalize-import-source": [
      "error",
      {
        /* `normalize-import-source` Additional Configuration */
      }
    ]
  }
}
  1. For "sort-imports Additional Configuration" see jsort/sort-imports docs.
  2. For "normalize-import-source Additional Configuration" see jsort/normalize-import-source docs

Available Rules

Other Alternatives

Other Resources

About

Sort imports effortlessly

License:Other


Languages

Language:JavaScript 93.9%Language:TypeScript 3.3%Language:Shell 2.8%