Gathering detailed insights and metrics for eslint-plugin-import-helpers
Gathering detailed insights and metrics for eslint-plugin-import-helpers
Gathering detailed insights and metrics for eslint-plugin-import-helpers
Gathering detailed insights and metrics for eslint-plugin-import-helpers
ESLint plugin to help enforce a configurable order for import statements
npm install eslint-plugin-import-helpers
v2 - ESLint v9 Support
Published on 23 Oct 2024
1.3.1 Patch to remove engines field
Published on 26 Oct 2022
Add support for a `type` group
Published on 14 Oct 2022
v1.2.1 - Support for large lists of imports
Published on 07 Jan 2022
v1.2 - ESLint 8 Support
Published on 19 Nov 2021
v1.1.0 - ESLint 7 support added
Published on 10 Jul 2020
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
293 Stars
59 Commits
17 Forks
5 Watching
8 Branches
6 Contributors
Updated on 28 Nov 2024
JavaScript (67.75%)
TypeScript (32.25%)
Cumulative downloads
Total Downloads
Last day
16.5%
21,462
Compared to previous day
Last week
19.6%
125,733
Compared to previous week
Last month
26.5%
457,183
Compared to previous month
Last year
27.6%
4,975,429
Compared to previous year
Originally forked/inspired by eslint-plugin-import and this fork
This package was created to supplement the rules provided by eslint-plugin-import. There are a lot of great rules in there, but we found it missing a few key use cases.
[!TIP] Use Prettier!
I recommend using @ianvs/prettier-plugin-sort-imports instead of this ESLint plugin for sorting imports. It works really well and I think Prettier is better suited for formatting-related rules.
order-imports
Enforce a configurable convention in module import order. See the order-imports
page for configuration details.
1// Given ESLint Config 2rules: { 3 'import-helpers/order-imports': [ 4 'warn', 5 { 6 newlinesBetween: 'always', // new line between groups 7 groups: [ 8 'module', 9 '/^@shared/', 10 ['parent', 'sibling', 'index'], 11 ], 12 alphabetize: { order: 'asc', ignoreCase: true }, 13 }, 14 ], 15} 16 17// will fix 18import SiblingComponent from './SiblingComponent'; 19import lodash from 'lodash'; 20import SharedComponent from '@shared/components/SharedComponent'; 21import React from 'react'; 22 23// into 24import lodash from 'lodash'; 25import React from 'react'; 26 27import SharedComponent from '@shared/components/SharedComponent'; 28 29import SiblingComponent from './SiblingComponent';
1npm install eslint-plugin-import-helpers -g
or if you manage ESLint as a dev dependency:
1# inside your project's working tree 2npm install eslint-plugin-import-helpers --save-dev
To add a rule, update your .eslintrc.(yml|json|js)
:
1{ 2 // .eslintrc.js 3 plugins: ['eslint-plugin-import-helpers'], 4 rules: { 5 'import-helpers/order-imports': [ 6 'warn', 7 { // example configuration 8 newlinesBetween: 'always', 9 groups: [ 10 'module', 11 '/^@shared/', 12 ['parent', 'sibling', 'index'], 13 ], 14 alphabetize: { order: 'asc', ignoreCase: true }, 15 }, 16 ], 17 } 18}
The 2.0 version supports ESLint v9. It may still work with older versions of ESLint but we no longer test against it. If you need ESLint v8 support, use 1.X.
To use this plugin with TypeScript, you must use the TypeScript parser for ESLint. See @typescript-eslint/parser for more details.
Please note that the import sorter does not currently work with type
imports.
Name | Version |
---|---|
node.js | 22.x |
First, npm install
Then, npm test
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
4 existing vulnerabilities detected
Details
Reason
2 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 2
Reason
Found 3/17 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More