eslint-plugin-jsort

Sort imports effortlessly.

Stats

StarsIssuesVersionUpdatedCreatedSize
eslint-plugin-jsort
211.1.35 months ago8 months agoMinified + gzip package size for eslint-plugin-jsort in KB

Readme

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

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.