1.0.1 • Published 1 year ago

@lighttypes/eslint-config-import v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

eslint-config-import

This eslint configuration does the following:

  1. It extends the base configurations plugin:import/errors and plugin:import/warnings, which enforce best practices and conventions related to ES6 imports and exports.
  2. It uses the import plugin, which provides additional rules related to imports and exports.
  3. It sets the import/order rule, which enforces a specific ordering of import statements.
  4. The alphabetize option is set to order imports in ascending order.
  5. The groups option defines import groups and their order.
  6. The settings option sets up an import resolver alias, allowing the use of custom extensions .js, .jsx, .ts, and .tsx.

Installation

npm install --save-dev @lighttypes/eslint-config-import

Usage

In typescript project, you can apply rules from eslint-config-import.

.eslintrc.json:

{
  "extends": ["@lighttypes/eslint-config-import"]
}

Example

It is recommended to use eslint-config-base package together:

npm install --save-dev @lighttypes/eslint-config-base @lighttypes/eslint-config-import

.eslintrc.json:

{
  "root": true,
  "extends": [
    "@lighttypes/eslint-config-base",
    "@lighttypes/eslint-config-import"
  ],
  "ignorePatterns": ["coverage", "dist"],
  "settings": {
    "import/resolver": {
      "typescript": {
        "project": ["./tsconfig.json"]
      }
    }
  }
}