Limegrass / eslint-plugin-import-alias

MIT License
15 stars 4 forks source link

@limegrass/eslint-plugin-import-alias

Encourage use of defined aliases in TSConfig/JSConfig through ESLint.

Why

Requirements

Install

npm install --save-dev @limegrass/eslint-plugin-import-alias eslint

This plugin relies on an alias configuration in tsconfig.json, jsconfig.json, or a config with the same schema and a path given as aliasConfigPath in its rules settings. See the rules documentation for more detail.

Configuration

The following is the most basic configuration. Check the rules documentation for further configuration.

// .eslintrc
{
    "plugins": ["@limegrass/import-alias"],
    "rules": {
        "@limegrass/import-alias/import-alias": "error",
    },
}

The configuration above is also equivalent to

// .eslintrc
{
    "extends": [
        // ... - your other extends, such as `"eslint:recommended"`
        "plugin:@limegrass/import-alias/recommended",
    ],
}