1.3.1 • Published 2 years ago

eslint-plugin-import-helpers v1.3.1

Weekly downloads
33,140
License
MIT
Repository
github
Last release
2 years ago

eslint-plugin-import-helpers

Originally forked/inspired by eslint-plugin-import and this fork

npm version

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.

Rules

order-imports

Enforce a configurable convention in module import order. See the order-imports page for configuration details.

// Given ESLint Config
rules: {
  'import-helpers/order-imports': [
      'warn',
      {
          newlinesBetween: 'always', // new line between groups
          groups: [
              'module',
              '/^@shared/',
              ['parent', 'sibling', 'index'],
          ],
          alphabetize: { order: 'asc', ignoreCase: true },
      },
  ],
}

// will fix
import SiblingComponent from './SiblingComponent';
import lodash from 'lodash';
import SharedComponent from '@shared/components/SharedComponent';
import React from 'react';

// into
import lodash from 'lodash';
import React from 'react';

import SharedComponent from '@shared/components/SharedComponent';

import SiblingComponent from './SiblingComponent';

Installation

npm install eslint-plugin-import-helpers -g

or if you manage ESLint as a dev dependency:

# inside your project's working tree
npm install eslint-plugin-import-helpers --save-dev

To add a rule, update your .eslintrc.(yml|json|js):

{
    // .eslintrc.js
    plugins: ['eslint-plugin-import-helpers'],
    rules: {
        'import-helpers/order-imports': [
            'warn',
            { // example configuration
                newlinesBetween: 'always',
                groups: [
                    'module',
                    '/^@shared/',
                    ['parent', 'sibling', 'index'],
                ],
                alphabetize: { order: 'asc', ignoreCase: true },
            },
        ],
    }
}

TypeScript

To use this plugin with TypeScript, you must use the TypeScript parser for ESLint. See @typescript-eslint/parser for more details.

Working with This Repo

Dependencies

NameVersion
node.js16.x

Running Tests

First, npm install Then, npm test

@anjun-brasil/eslint-config@she11sh0cked/eslint-config@ednan-dias/eslint-config@oliveiraswell/eslint-config-oliveiraswell-js@oliveiraswell/eslint-config-dasa-health-jseslint-config-sanches-test@hitechline/eslint-config-node@hitechline/eslint-config-web@jean9696/eslint-config-customform-manager-react@kopplin/eslint-confignextjs-best-eslint-config@seedcompany/eslint-plugin@infinitebrahmanuniverse/nolb-eslint-plugin-i@kayooliveira/eslint-config@kayooliveira/eslint-plugin@everything-registry/sub-chunk-1612igighouseholder-matrixeslint-config-gabeslint-config-phseslint-config-lesadaeslint-config-loeslint-config-johnanoneslint-config-getting-bettereslint-config-lacussofteslint-config-julienqueffeleceslint-config-lukemoraleseslint-config-dirosakieslint-config-eaeslint-config-easyrenteslint-config-asksuiteeslint-config-b3codedeslint-config-alvstecheslint-config-terralabeslint-config-zendeslint-config-van-gogheslint-config-waltiu-reacteslint-plugin-be-kitform-handler-reactdreactfrontend.configsfixrnmediaeslint-config-startupjseslint-config-whiteroomoryx-eslint-config@igorjacauna/eslint-config-basicmobile-photo-sliderqueue-driver@alxui/eslint-config@alquipo/eslint-config@anjun-express/eslint-config@april9/eslint-config-custom@agustinhopneto/eslint-config@agsolutions/eslint-config@alexmadeira/eslint-config@alexlafroscia/eslint-configreactjs-zero@acciosolutions/ts-config@avantpro/eslint-config@d1d2-apps/eslint-config@dasa-health/eslint-config-dasa-health-js@diogop_96/eslint-config@dirosaki/eslint@dirosaki/lint-config@ctrlmais/eslint-config@devxperience/eslint-config@devesharp/eslint-config-typescript@cookiex/eslint-config@dgvalerio/eslint-configcra-dlv-sb-ts-template-retestcra-dlv-sb-ts-template-samplecra-dlv-sb-ts-template-testcra-template-bemobile.techcra-template-marciorasf-ts@celsodias12/eslint-config-helpers@clark/eslint-config-node-order-imports@clark/eslint-plugin-import-helpers-with-package@codeboxlab_/eslint-config@block-zero/eslint-config@brainylab/eslint-config@brainylab/eslint-config-base@brainylab/eslint-config-next@brainylab/eslint-config-react-native@bigdayco/eslint-configsiv-init-depscheckbox-transition-react-native@douglasdemoura/eslint-config@corabank/eslint-config@lipex360-ui/eslint-config@kroo-tech/eslint-config@pemonter/eslint-config@pretty-eslint/eslint-config@nextime-ui/eslint-config@nexhome/standard@nervejs/eslint-plugin@psdhub/eslint@prunus/eslint-config@ejcm/eslint-config@eduardomuchak/eslint-config
1.3.1

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

1.0.0-0

5 years ago

1.0.0-beta

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago