├── .npmrc ├── .cz.json ├── .baserc.json ├── .devcontainer └── devcontainer.json ├── .husky └── commit-msg ├── .gitignore ├── .github ├── FUNDING.yml ├── DEPRECATED_DEPENDENCIES_ISSUE_TEMPLATE.md ├── labels.yml └── workflows │ ├── sync-labels.yml │ ├── sync-metadata.yml │ ├── deprecated-dependencies.yml │ └── build.yml ├── playwright.config.ts ├── .gitattributes ├── eslint.config.ts ├── .commitlintrc.json ├── babel.config.json ├── .editorconfig ├── src ├── index.ts ├── rules │ └── prefer-alias.ts └── index.spec.ts ├── tsconfig.json ├── .releaserc.json ├── .gitpod.Dockerfile ├── .vscode └── settings.json ├── .gitpod.yml ├── .renovaterc.json ├── LICENSE.md ├── package.json ├── README.md └── CHANGELOG.md /.npmrc: -------------------------------------------------------------------------------- 1 | node-linker=hoisted 2 | -------------------------------------------------------------------------------- /.cz.json: -------------------------------------------------------------------------------- 1 | { 2 | "path": "cz-conventional-changelog" 3 | } 4 | -------------------------------------------------------------------------------- /.baserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@dword-design/node", 3 | "testRunner": "playwright" 4 | } 5 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "postCreateCommand": "pnpm install --frozen-lockfile" 3 | } 4 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx commitlint --edit "$1" 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.env.json 3 | /.nyc_output 4 | /.test.env.json 5 | /coverage 6 | /dist 7 | /node_modules 8 | /test-results 9 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: 2 | - buymeacoffee.com/dword 3 | - paypal.me/SebastianLandwehr 4 | github: dword-design 5 | patreon: dworddesign 6 | -------------------------------------------------------------------------------- /playwright.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from '@playwright/test'; 2 | 3 | export default defineConfig({ 4 | fullyParallel: true, 5 | 6 | preserveOutput: 'failures-only', 7 | }); 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | *.glb filter=lfs diff=lfs merge=lfs -text 3 | *.jpg filter=lfs diff=lfs merge=lfs -text 4 | *.png filter=lfs diff=lfs merge=lfs -text 5 | *.vsix filter=lfs diff=lfs merge=lfs -text 6 | -------------------------------------------------------------------------------- /eslint.config.ts: -------------------------------------------------------------------------------- 1 | import config from '@dword-design/eslint-config'; 2 | import { defineConfig, globalIgnores } from 'eslint/config'; 3 | 4 | export default defineConfig([ 5 | globalIgnores(['eslint.config.ts']), 6 | config, 7 | ]); 8 | -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "@commitlint/config-conventional" 4 | ], 5 | "rules": { 6 | "body-max-line-length": [ 7 | 0 8 | ], 9 | "footer-max-line-length": [ 10 | 0 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | [ 4 | "babel-plugin-module-resolver", 5 | { 6 | "alias": { 7 | "@/src": "./dist" 8 | } 9 | } 10 | ], 11 | "babel-plugin-add-import-extension" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /.github/DEPRECATED_DEPENDENCIES_ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Deprecated dependencies 3 | labels: maintenance 4 | --- 5 | The following dependencies are deprecated: 6 | 7 | {% for dependency in env.DEPRECATED.split(',') %} 8 | - **{{ dependency }}** 9 | {% endfor %} 10 | 11 | Check out the [build]({{ env.RUN_URL }}) for details. 12 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import preferAlias from './rules/prefer-alias.js'; 2 | 3 | const plugin = { rules: { 'prefer-alias': preferAlias } }; 4 | 5 | export default { 6 | configs: { 7 | recommended: { 8 | plugins: { '@dword-design/import-alias': plugin }, 9 | rules: { '@dword-design/import-alias/prefer-alias': 'error' }, 10 | }, 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | - color: C2E0C6 2 | name: active 3 | - color: C2E0C6 4 | name: blocked 5 | - color: BFD4F2 6 | name: blocking 7 | - color: BFD4F2 8 | name: breaking 9 | - color: BFD4F2 10 | name: important 11 | - color: C2E0C6 12 | name: maintenance 13 | - color: EDEDED 14 | name: released 15 | - color: EDEDED 16 | name: semantic-release 17 | - color: C2E0C6 18 | name: waiting-for 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "esModuleInterop": true, 4 | "module": "ESNext", 5 | "moduleResolution": "bundler", 6 | "outDir": "dist", 7 | "paths": { 8 | "@/*": [ 9 | "./*" 10 | ] 11 | }, 12 | "skipLibCheck": true, 13 | "target": "ESNext" 14 | }, 15 | "exclude": [ 16 | "**/*.spec.ts" 17 | ], 18 | "include": [ 19 | "src" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /.github/workflows/sync-labels.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | build: 3 | runs-on: ubuntu-latest 4 | steps: 5 | - uses: actions/checkout@v4 6 | - env: 7 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 8 | uses: micnncim/action-label-syncer@v1 9 | name: sync-labels 10 | on: 11 | push: 12 | branches: 13 | - master 14 | paths: 15 | - .github/labels.yml 16 | - .github/workflows/sync-labels.yml 17 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "@semantic-release/commit-analyzer", 4 | "@semantic-release/release-notes-generator", 5 | "@semantic-release/changelog", 6 | "@semantic-release/npm", 7 | [ 8 | "@semantic-release/github", 9 | { 10 | "successComment": false 11 | } 12 | ], 13 | [ 14 | "@semantic-release/git", 15 | { 16 | "message": "chore: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" 17 | } 18 | ] 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /.github/workflows/sync-metadata.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | build: 3 | runs-on: ubuntu-latest 4 | steps: 5 | - uses: actions/checkout@v4 6 | - uses: jaid/action-sync-node-meta@v2.0.0 7 | with: 8 | approve: false 9 | commitMessage: "fix: write GitHub metadata to package.json [{changes}]" 10 | githubToken: ${{ secrets.GITHUB_TOKEN }} 11 | - uses: liskin/gh-workflow-keepalive@v1 12 | name: sync-metadata 13 | on: 14 | schedule: 15 | - cron: 0 5 * * * 16 | workflow_dispatch: {} 17 | -------------------------------------------------------------------------------- /.gitpod.Dockerfile: -------------------------------------------------------------------------------- 1 | # Need to add :latest, otherwise old versions (e.g. of node) are installed 2 | FROM gitpod/workspace-full-vnc:latest 3 | 4 | RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash 5 | RUN sudo apt-get install git-lfs 6 | RUN git lfs install 7 | 8 | # https://www.gitpod.io/docs/languages/javascript 9 | # https://github.com/gitpod-io/gitpod/issues/945 10 | RUN bash -c 'source $HOME/.nvm/nvm.sh && nvm install 20' 11 | RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix 12 | 13 | RUN yarn global add gitpod-env-per-project @babel/node @babel/core 14 | 15 | RUN sudo apt-get install -y graphviz 16 | 17 | RUN brew install gh 18 | 19 | # Puppeteer dependencies 20 | RUN sudo apt-get update && sudo apt-get install -y libgtk-3-0 libx11-xcb1 libnss3 libxss1 libasound2 libgbm1 libxshmfence1 21 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.tabSize": 2, 3 | "files.autoSave": "off", 4 | "files.exclude": { 5 | ".commitlintrc.json": true, 6 | ".cz.json": true, 7 | ".devcontainer": true, 8 | ".editorconfig": true, 9 | ".gitattributes": true, 10 | ".github": true, 11 | ".gitignore": true, 12 | ".gitpod.Dockerfile": true, 13 | ".gitpod.yml": true, 14 | ".husky": true, 15 | ".npmrc": true, 16 | ".nyc_output": true, 17 | ".releaserc.json": true, 18 | ".renovaterc.json": true, 19 | ".vscode": true, 20 | "CHANGELOG.md": true, 21 | "LICENSE.md": true, 22 | "babel.config.json": true, 23 | "coverage": true, 24 | "dist": true, 25 | "eslint.config.ts": true, 26 | "node_modules": true, 27 | "pnpm-lock.yaml": true 28 | }, 29 | "workbench.editor.enablePreview": false 30 | } 31 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: 2 | file: .gitpod.Dockerfile 3 | tasks: 4 | - before: |- 5 | echo "corepack enable" >> /home/gitpod/.bashrc 6 | echo "export COREPACK_ENABLE_DOWNLOAD_PROMPT=0" >> /home/gitpod/.bashrc 7 | gitpod-env-per-project >> /home/gitpod/.bashrc 8 | echo "export PUPPETEER_CACHE_DIR=/workspace/eslint-plugin-import-alias/node_modules/.cache/puppeteer" >> /home/gitpod/.bashrc 9 | echo "export PLAYWRIGHT_BROWSERS_PATH=0" >> /home/gitpod/.bashrc 10 | source /home/gitpod/.bashrc 11 | init: |- 12 | git config --global user.name "Sebastian Landwehr" 13 | git config diff.lfs.textconv cat 14 | git lfs pull 15 | pnpm install --frozen-lockfile 16 | vscode: 17 | extensions: 18 | - https://sebastianlandwehr.com/vscode-extensions/karlito40.fix-irregular-whitespace-0.1.1.vsix 19 | - https://sebastianlandwehr.com/vscode-extensions/adrianwilczynski.toggle-hidden-1.0.2.vsix 20 | - octref.vetur@0.33.1 21 | - Tobermory.es6-string-html 22 | - zjcompt.es6-string-javascript 23 | -------------------------------------------------------------------------------- /.renovaterc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | ":semanticCommits", 4 | ":semanticPrefixFix" 5 | ], 6 | "gitIgnoredAuthors": [ 7 | "actions@github.com" 8 | ], 9 | "github-actions": { 10 | "enabled": false 11 | }, 12 | "labels": [ 13 | "maintenance" 14 | ], 15 | "lockFileMaintenance": { 16 | "automerge": true, 17 | "enabled": true, 18 | "semanticCommitType": "chore" 19 | }, 20 | "rangeStrategy": "replace", 21 | "regexManagers": [ 22 | { 23 | "datasourceTemplate": "github-tags", 24 | "fileMatch": [ 25 | "\\.ts$" 26 | ], 27 | "matchStrings": [ 28 | "(^|[^\\w])gitHubAction`(?.*?)@v(?.*?)`" 29 | ], 30 | "versioningTemplate": "npm" 31 | }, 32 | { 33 | "datasourceTemplate": "node-version", 34 | "depNameTemplate": "node", 35 | "fileMatch": [ 36 | "\\.ts$" 37 | ], 38 | "matchStrings": [ 39 | "(^|[^\\w])nodejsVersion`(?.*?)`" 40 | ], 41 | "versioningTemplate": "node" 42 | } 43 | ], 44 | "semanticCommitScope": null 45 | } 46 | -------------------------------------------------------------------------------- /.github/workflows/deprecated-dependencies.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | run: 3 | runs-on: ubuntu-latest 4 | steps: 5 | - uses: actions/checkout@v4 6 | with: 7 | lfs: true 8 | - continue-on-error: true 9 | id: check-deprecated-js-deps 10 | uses: tinovyatkin/action-check-deprecated-js-deps@v1 11 | - env: 12 | DEPRECATED: ${{ steps.check-deprecated-js-deps.outputs.deprecated }} 13 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 14 | RUN_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} 15 | id: create-deprecation-issue 16 | if: ${{ steps.check-deprecated-js-deps.outputs.deprecated }} 17 | uses: JasonEtco/create-an-issue@v2 18 | with: 19 | filename: .github/DEPRECATED_DEPENDENCIES_ISSUE_TEMPLATE.md 20 | update_existing: true 21 | - if: ${{ !steps.check-deprecated-js-deps.outputs.deprecated && 22 | steps.create-deprecation-issue.outputs.number }} 23 | uses: peter-evans/close-issue@v3 24 | with: 25 | comment: Auto-closing the issue 26 | issue-number: ${{ steps.create-deprecation-issue.outputs.number }} 27 | - uses: liskin/gh-workflow-keepalive@v1 28 | name: deprecated-dependencies 29 | on: 30 | schedule: 31 | - cron: 0 5 * * MON 32 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | Unless stated otherwise all works are: 4 | 5 | Copyright © Sebastian Landwehr 6 | 7 | and licensed under: 8 | 9 | [MIT License](https://opensource.org/license/mit/) 10 | 11 | ## MIT License 12 | 13 | MIT License 14 | 15 | Copyright (c) 16 | 17 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 18 | associated documentation files (the "Software"), to deal in the Software without restriction, including 19 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 21 | following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all copies or substantial 24 | portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 27 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 28 | EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 29 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 30 | USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@dword-design/eslint-plugin-import-alias", 3 | "version": "6.0.3", 4 | "description": "An ESLint plugin that enforces the use of import aliases. Also supports autofixing.", 5 | "keywords": [ 6 | "alias", 7 | "aliases", 8 | "autofix", 9 | "babel", 10 | "babel-plugin-module-resolver", 11 | "enforce", 12 | "eslint", 13 | "fix", 14 | "import", 15 | "lint", 16 | "module", 17 | "module-resolver", 18 | "nuxt", 19 | "nuxtjs", 20 | "plugin", 21 | "prefer", 22 | "require", 23 | "replace", 24 | "rule" 25 | ], 26 | "repository": "dword-design/eslint-plugin-import-alias", 27 | "funding": "https://github.com/sponsors/dword-design", 28 | "license": "MIT", 29 | "author": "Sebastian Landwehr ", 30 | "type": "module", 31 | "exports": "./dist/index.js", 32 | "main": "dist/index.js", 33 | "files": [ 34 | "dist" 35 | ], 36 | "scripts": { 37 | "checkUnknownFiles": "base checkUnknownFiles", 38 | "commit": "base commit", 39 | "depcheck": "base depcheck", 40 | "dev": "base dev", 41 | "lint": "base lint", 42 | "prepare": "base prepare", 43 | "prepublishOnly": "base prepublishOnly", 44 | "test": "base test" 45 | }, 46 | "dependencies": { 47 | "@babel/core": "^7.27.4", 48 | "@dword-design/defu": "^1.0.0", 49 | "babel-plugin-module-resolver": "^5.0.2" 50 | }, 51 | "devDependencies": { 52 | "@dword-design/base": "^13.0.1", 53 | "@playwright/test": "^1.52.0", 54 | "depcheck-package-name": "^3.0.1", 55 | "endent": "npm:@dword-design/endent@^1.4.1", 56 | "eslint": "^9.28.0", 57 | "lodash-es": "^4.17.21", 58 | "output-files": "^2.0.32", 59 | "typescript-eslint": "^8.33.1" 60 | }, 61 | "packageManager": "pnpm@10.11.1+sha512.e519b9f7639869dc8d5c3c5dfef73b3f091094b0a006d7317353c72b124e80e1afd429732e28705ad6bfa1ee879c1fce46c128ccebd3192101f43dd67c667912", 62 | "engines": { 63 | "node": ">=18" 64 | }, 65 | "publishConfig": { 66 | "access": "public" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | concurrency: 2 | cancel-in-progress: true 3 | group: ${{ github.workflow }}-${{ github.ref }} 4 | jobs: 5 | release: 6 | needs: test 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v4 10 | with: 11 | lfs: true 12 | ref: ${{ github.event.pull_request.head.repo.full_name == github.repository && 13 | github.event.pull_request.head.ref || '' }} 14 | - uses: actions/setup-node@v4 15 | with: 16 | node-version: 20 17 | - run: corepack enable 18 | - run: git config --global user.email "actions@github.com" 19 | - run: git config --global user.name "GitHub Actions" 20 | - run: pnpm install --frozen-lockfile 21 | - run: pnpm checkUnknownFiles 22 | - run: pnpm lint 23 | - env: 24 | GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }} 25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 | name: Push changed files 27 | run: pnpm dw-ci push-changed-files 28 | - env: 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 31 | if: github.ref == 'refs/heads/master' 32 | name: Release 33 | run: pnpm semantic-release 34 | test: 35 | runs-on: ${{ matrix.os }} 36 | steps: 37 | - uses: actions/checkout@v4 38 | with: 39 | lfs: true 40 | - uses: actions/setup-node@v4 41 | with: 42 | check-latest: true 43 | node-version: ${{ matrix.node }} 44 | - run: corepack enable 45 | - run: pnpm install --frozen-lockfile 46 | - env: 47 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 48 | run: pnpm test 49 | - if: always() 50 | uses: actions/upload-artifact@v4 51 | with: 52 | if-no-files-found: ignore 53 | name: Images from tests 54 | path: test-results/*/** 55 | - if: matrix.os == 'ubuntu-latest' && matrix.node == 20 56 | uses: codecov/codecov-action@v3 57 | with: 58 | token: ${{ secrets.CODECOV_TOKEN }} 59 | strategy: 60 | matrix: 61 | include: 62 | - node: 18 63 | os: ubuntu-latest 64 | - node: 20 65 | os: ubuntu-latest 66 | - node: 20 67 | os: macos-latest 68 | - node: 20 69 | os: windows-latest 70 | name: build 71 | on: 72 | pull_request: {} 73 | push: 74 | branches: 75 | - master 76 | -------------------------------------------------------------------------------- /src/rules/prefer-alias.ts: -------------------------------------------------------------------------------- 1 | import pathLib from 'node:path'; 2 | 3 | import { loadOptions } from '@babel/core'; 4 | import defu from '@dword-design/defu'; 5 | import { resolvePath as defaultResolvePath } from 'babel-plugin-module-resolver'; 6 | 7 | interface BabelPlugin { 8 | key: string; 9 | options?: Record; 10 | } 11 | interface BabelConfig { 12 | plugins?: BabelPlugin[]; 13 | } 14 | const isParentImport = path => /^(\.\/)?\.\.\//.test(path); 15 | 16 | const findMatchingAlias = (sourcePath, currentFile, options) => { 17 | const resolvePath = options.resolvePath || defaultResolvePath; 18 | 19 | const absoluteSourcePath = pathLib.resolve( 20 | pathLib.dirname(currentFile), 21 | sourcePath, 22 | ); 23 | 24 | for (const aliasName of Object.keys(options.alias)) { 25 | const path = pathLib.resolve( 26 | pathLib.dirname(currentFile), 27 | resolvePath(`${aliasName}/`, currentFile, options), 28 | ); 29 | 30 | if (absoluteSourcePath.startsWith(path)) { 31 | return { name: aliasName, path }; 32 | } 33 | } 34 | }; 35 | 36 | export default { 37 | create: context => { 38 | const currentFile = context.getFilename(); 39 | const folder = pathLib.dirname(currentFile); 40 | // can't check a non-file 41 | if (currentFile === '') return {}; 42 | const optionsFromRule = context.options[0] ?? {}; 43 | 44 | const babelConfig = (loadOptions({ 45 | filename: currentFile, 46 | ...optionsFromRule.babelOptions, 47 | }) || {}) as BabelConfig; 48 | 49 | const optionsFromPlugin = 50 | babelConfig?.plugins?.find(_ => _.key === 'module-resolver')?.options ?? 51 | {}; 52 | 53 | const options = defu(optionsFromRule, optionsFromPlugin, { 54 | alias: [], 55 | cwd: context.cwd, 56 | }); 57 | 58 | if (options.alias.length === 0) { 59 | throw new Error( 60 | 'No alias configured. You have to define aliases by either passing them to the babel-plugin-module-resolver plugin in your Babel config, or directly to the prefer-alias rule.', 61 | ); 62 | } 63 | 64 | const resolvePath = options.resolvePath || defaultResolvePath; 65 | return { 66 | ImportDeclaration: node => { 67 | const sourcePath = node.source.value; 68 | 69 | const hasAlias = Object.keys(options.alias).some(alias => 70 | sourcePath.startsWith(`${alias}/`), 71 | ); 72 | 73 | // relative parent 74 | if (isParentImport(sourcePath)) { 75 | const matchingAlias = findMatchingAlias( 76 | sourcePath, 77 | currentFile, 78 | options, 79 | ); 80 | 81 | if (!matchingAlias) { 82 | return; 83 | } 84 | 85 | const absoluteImportPath = pathLib.resolve(folder, sourcePath); 86 | 87 | const rewrittenImport = `${matchingAlias.name}/${pathLib 88 | .relative(matchingAlias.path, absoluteImportPath) 89 | .replaceAll('\\', '/')}`; 90 | 91 | return context.report({ 92 | fix: fixer => 93 | fixer.replaceTextRange( 94 | [node.source.range[0] + 1, node.source.range[1] - 1], 95 | rewrittenImport, 96 | ), 97 | message: `Unexpected parent import '${sourcePath}'. Use '${rewrittenImport}' instead`, 98 | node, 99 | }); 100 | } 101 | 102 | const importWithoutAlias = resolvePath( 103 | sourcePath, 104 | currentFile, 105 | options, 106 | ); 107 | 108 | if ( 109 | !isParentImport(importWithoutAlias) && 110 | hasAlias && 111 | !options.aliasForSubpaths 112 | ) { 113 | return context.report({ 114 | fix: fixer => 115 | fixer.replaceTextRange( 116 | [node.source.range[0] + 1, node.source.range[1] - 1], 117 | importWithoutAlias, 118 | ), 119 | message: `Unexpected subpath import via alias '${sourcePath}'. Use '${importWithoutAlias}' instead`, 120 | node, 121 | }); 122 | } 123 | 124 | return; 125 | }, 126 | }; 127 | }, 128 | meta: { 129 | fixable: true, 130 | schema: [ 131 | { 132 | additionalProperties: false, 133 | properties: { 134 | alias: { type: 'object' }, 135 | aliasForSubpaths: { default: false, type: 'boolean' }, 136 | babelOptions: { type: 'object' }, 137 | }, 138 | type: 'object', 139 | }, 140 | ], 141 | type: 'suggestion', 142 | }, 143 | }; 144 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # @dword-design/eslint-plugin-import-alias 3 | 4 | 5 | 6 |

7 | 8 | npm version 12 | Linux macOS Windows compatible 13 | Build status 17 | 18 | Coverage status 22 | 23 | Dependency status 24 | Renovate enabled
25 | Open in Gitpod 30 | 31 | Buy Me a Coffee 36 | 37 | PayPal 42 | 43 | Patreon 48 | 49 |

50 | 51 | 52 | 53 | An ESLint plugin that enforces the use of import aliases. Also supports autofixing. 54 | 55 | 56 | Aliases are a great thing to make imports more readable and you do not have to change import paths that often when a file path is changed. 57 | 58 | ```js 59 | import foo from '../../model/sub/foo'; 60 | import bar from '../other/bar'; 61 | ``` 62 | 63 | changes to 64 | 65 | ```js 66 | import foo from '@/model/sub/foo'; 67 | import bar from '@/sub/other/bar'; 68 | ``` 69 | 70 | Now what if you are in a bigger team or you have a lot of projects to update. Or you just want to make sure that everything is consistent. This is where a linter comes into the play. This rule allows you to detect inconsistent imports and even autofix them. This works by matching alias paths agains the imports and replacing the import paths with the first matching aliased path. 71 | 72 | 73 | ## Install 74 | 75 | ```bash 76 | # npm 77 | $ npm install @dword-design/eslint-plugin-import-alias 78 | 79 | # Yarn 80 | $ yarn add @dword-design/eslint-plugin-import-alias 81 | ``` 82 | 83 | 84 | ## Usage 85 | 86 | Add the plugin to your ESLint config: 87 | 88 | ```js 89 | import { defineConfig } from 'eslint/config'; 90 | import importAlias from '@dword-design/import-alias'; 91 | 92 | export default defineConfig([ 93 | importAlias.configs.recommended, 94 | ]); 95 | ``` 96 | 97 | Alright, now you have to tell the plugin which aliases to use. In the simplest case, you are already using [babel-plugin-module-resolver](https://www.npmjs.com/package/babel-plugin-module-resolver) for your aliases. Your babel config would look something like this: 98 | 99 | ```json 100 | { 101 | "plugins": { 102 | ["module-resolver", { 103 | "alias": { 104 | "@": ".", 105 | }, 106 | }] 107 | } 108 | } 109 | ``` 110 | 111 | In this case lucky you, you don't have to do anything else. The plugin should work out of the box. 112 | 113 | If you have a special project setup that does not have a babel config in the project path, you can still use the plugin by passing the aliases directly to the rule. In this case you define the rule additionally in the `rules` section: 114 | 115 | ```json 116 | "rules": { 117 | "@dword-design/import-alias/prefer-alias": [ 118 | "error", 119 | { 120 | "alias": { 121 | "@": "./src", 122 | "@components": "./src/components" 123 | } 124 | } 125 | ] 126 | } 127 | ``` 128 | 129 | By default, the plugin will convert parent paths to aliases (like `../model/foo`), but will keep subpath imports relative. You can change that to also convert subpaths to aliased imports by passing the `aliasForSubpaths` option to the rule like so: 130 | 131 | ```json 132 | "rules": { 133 | "@dword-design/import-alias/prefer-alias": ["error", { "aliasForSubpaths": true }] 134 | } 135 | ``` 136 | 137 | 138 | ## Contribute 139 | 140 | Are you missing something or want to contribute? Feel free to file an [issue](https://github.com/dword-design/eslint-plugin-import-alias/issues) or a [pull request](https://github.com/dword-design/eslint-plugin-import-alias/pulls)! ⚙️ 141 | 142 | ## Support 143 | 144 | Hey, I am Sebastian Landwehr, a freelance web developer, and I love developing web apps and open source packages. If you want to support me so that I can keep packages up to date and build more helpful tools, you can donate here: 145 | 146 |

147 | 148 | Buy Me a Coffee 153 |  If you want to send me a one time donation. The coffee is pretty good 😊.
154 | 155 | PayPal 160 |  Also for one time donations if you like PayPal.
161 | 162 | Patreon 167 |  Here you can support me regularly, which is great so I can steadily work on projects. 168 |

169 | 170 | Thanks a lot for your support! ❤️ 171 | 172 | ## License 173 | 174 | [MIT License](https://opensource.org/license/mit/) © [Sebastian Landwehr](https://sebastianlandwehr.com) 175 | 176 | -------------------------------------------------------------------------------- /src/index.spec.ts: -------------------------------------------------------------------------------- 1 | import P from 'node:path'; 2 | 3 | import defu from '@dword-design/defu'; 4 | import { expect, test } from '@playwright/test'; 5 | import packageName from 'depcheck-package-name'; 6 | import endent from 'endent'; 7 | import { ESLint } from 'eslint'; 8 | import { pick } from 'lodash-es'; 9 | import outputFiles from 'output-files'; 10 | import tseslint from 'typescript-eslint'; 11 | 12 | import self from '.'; 13 | 14 | const tests = { 15 | 'alias subpath': { 16 | code: "import '@/foo'", 17 | files: { 'foo.ts': '' }, 18 | messages: [ 19 | { 20 | message: 21 | "Unexpected subpath import via alias '@/foo'. Use './foo' instead", 22 | ruleId: '@dword-design/import-alias/prefer-alias', 23 | }, 24 | ], 25 | options: { alias: { '@': '.' } }, 26 | output: "import './foo'", 27 | }, 28 | aliasForSubpaths: { 29 | code: "import '@/foo'", 30 | files: { 'foo.ts': '' }, 31 | options: { alias: { '@': '.' }, aliasForSubpaths: true }, 32 | }, 33 | babelrc: { 34 | code: "import '../foo'", 35 | filename: P.join('sub', 'index.ts'), 36 | files: { 37 | '.babelrc.json': JSON.stringify({ 38 | plugins: [ 39 | [packageName`babel-plugin-module-resolver`, { alias: { '@': '.' } }], 40 | ], 41 | }), 42 | 'foo.ts': '', 43 | }, 44 | messages: [ 45 | { 46 | message: "Unexpected parent import '../foo'. Use '@/foo' instead", 47 | ruleId: '@dword-design/import-alias/prefer-alias', 48 | }, 49 | ], 50 | output: "import '@/foo'", 51 | }, 52 | 'custom alias': { 53 | code: "import '../foo'", 54 | filename: 'sub/index.ts', 55 | files: { 'foo.ts': '', 'package.json': JSON.stringify({}) }, 56 | messages: [ 57 | { 58 | message: "Unexpected parent import '../foo'. Use 'bar/foo' instead", 59 | ruleId: '@dword-design/import-alias/prefer-alias', 60 | }, 61 | ], 62 | options: { alias: { bar: '.' } }, 63 | output: "import 'bar/foo'", 64 | }, 65 | 'custom resolvePath': { 66 | code: "import '../foo'", 67 | filename: P.join('sub', 'sub', 'index.ts'), 68 | files: { 69 | '.babelrc.json': JSON.stringify({ extends: 'babel-config-foo' }), 70 | 'node_modules/babel-config-foo/index.js': endent` 71 | const P = require('path') 72 | const { resolvePath } = require('babel-plugin-module-resolver') 73 | 74 | module.exports = { 75 | plugins: [ 76 | [ 77 | '${packageName`babel-plugin-module-resolver`}', 78 | { 79 | alias: { '@': '.' }, 80 | resolvePath: (sourcePath, currentFile) => 81 | resolvePath( 82 | sourcePath, 83 | currentFile, 84 | { alias: { '@': '.' }, cwd: P.resolve(P.dirname(currentFile), '..') } 85 | ) 86 | }, 87 | ], 88 | ], 89 | } 90 | `, 91 | 'sub/foo.ts': '', 92 | }, 93 | messages: [ 94 | { 95 | message: "Unexpected parent import '../foo'. Use '@/foo' instead", 96 | ruleId: '@dword-design/import-alias/prefer-alias', 97 | }, 98 | ], 99 | output: "import '@/foo'", 100 | }, 101 | external: { code: "import 'foo'", options: { alias: { '@': '.' } } }, 102 | 'no aliases': { 103 | code: "import '../foo'", 104 | error: 105 | 'No alias configured. You have to define aliases by either passing them to the babel-plugin-module-resolver plugin in your Babel config, or directly to the prefer-alias rule.', 106 | filename: P.join('sub', 'index.ts'), 107 | files: { 'foo.ts': '', 'package.json': JSON.stringify({}) }, 108 | }, 109 | 'parent import but no matching alias': { 110 | code: "import '../../foo'", 111 | options: { alias: { '@': '.' } }, 112 | }, 113 | 'parent import with ..': { 114 | code: "import '../foo'", 115 | filename: P.join('sub', 'index.ts'), 116 | messages: [ 117 | { 118 | message: "Unexpected parent import '../foo'. Use '@/foo' instead", 119 | ruleId: '@dword-design/import-alias/prefer-alias', 120 | }, 121 | ], 122 | options: { alias: { '@': '.' } }, 123 | output: "import '@/foo'", 124 | }, 125 | 'parent import with alias': { 126 | code: "import '@/foo'", 127 | filename: P.join('sub', 'index.ts'), 128 | files: { 'foo.ts': '' }, 129 | options: { alias: { '@': '.' } }, 130 | }, 131 | 'parent in-between folder': { 132 | code: "import '../foo'", 133 | filename: P.join('sub', 'sub', 'index.ts'), 134 | messages: [ 135 | { 136 | message: "Unexpected parent import '../foo'. Use '@/sub/foo' instead", 137 | ruleId: '@dword-design/import-alias/prefer-alias', 138 | }, 139 | ], 140 | options: { alias: { '@': '.' } }, 141 | output: "import '@/sub/foo'", 142 | }, 143 | scoped: { 144 | code: "import '@foo/bar'", 145 | files: { 'foo.ts': '' }, 146 | options: { alias: { '@': '.' } }, 147 | }, 148 | }; 149 | 150 | for (const [name, testConfig] of Object.entries(tests)) { 151 | test(name, async ({}, testInfo) => { 152 | const cwd = testInfo.outputPath(); 153 | testConfig.error = testConfig.error ?? null; 154 | testConfig.files = testConfig.files ?? {}; 155 | testConfig.filename = testConfig.filename || 'index.ts'; 156 | testConfig.output = testConfig.output || testConfig.code; 157 | testConfig.messages = testConfig.messages ?? []; 158 | await outputFiles(cwd, testConfig.files); 159 | 160 | const lintingConfig = { 161 | baseConfig: [ 162 | ...tseslint.configs.recommended, 163 | self.configs.recommended, 164 | { 165 | rules: { 166 | '@dword-design/import-alias/prefer-alias': [ 167 | 'error', 168 | defu(testConfig.options, { babelOptions: { configFile: false } }), 169 | ], 170 | }, 171 | }, 172 | ], 173 | cwd, 174 | overrideConfigFile: true, 175 | }; 176 | 177 | const eslintToLint = new ESLint(lintingConfig); 178 | const eslintToFix = new ESLint({ ...lintingConfig, fix: true }); 179 | 180 | if (testConfig.error) { 181 | await expect( 182 | eslintToLint.lintText(testConfig.code, { 183 | filePath: testConfig.filename, 184 | }), 185 | ).rejects.toThrow(testConfig.error); 186 | } else { 187 | const lintResult = await eslintToLint.lintText(testConfig.code, { 188 | filePath: testConfig.filename, 189 | }); 190 | 191 | const lintedMessages = lintResult 192 | .flatMap(_ => _.messages) 193 | .map(_ => pick(_, ['ruleId', 'message'])); 194 | 195 | expect(lintedMessages).toEqual(testConfig.messages); 196 | 197 | const outputResult = await eslintToFix.lintText(testConfig.code, { 198 | filePath: testConfig.filename, 199 | }); 200 | 201 | const lintedOutput = outputResult.map(_ => _.output).join('\n'); 202 | expect(lintedOutput || testConfig.code).toEqual(testConfig.output); 203 | } 204 | }); 205 | } 206 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [6.0.3](https://github.com/dword-design/eslint-plugin-import-alias/compare/v6.0.2...v6.0.3) (2025-06-05) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * fix aliasForSubpaths naming ([62b3bcc](https://github.com/dword-design/eslint-plugin-import-alias/commit/62b3bcc7f5169e09762b579d4e239f4b637eb039)) 7 | 8 | ## [6.0.2](https://github.com/dword-design/eslint-plugin-import-alias/compare/v6.0.1...v6.0.2) (2025-06-05) 9 | 10 | 11 | ### Bug Fixes 12 | 13 | * fix ts issues ([262f0e7](https://github.com/dword-design/eslint-plugin-import-alias/commit/262f0e712352dacf3ab3a2a68c60ebd71582a6ea)) 14 | * update readme ([46e3b15](https://github.com/dword-design/eslint-plugin-import-alias/commit/46e3b1581f67b47f5b15bfd87f71e812f81bcee6)) 15 | 16 | ## [6.0.1](https://github.com/dword-design/eslint-plugin-import-alias/compare/v6.0.0...v6.0.1) (2025-06-05) 17 | 18 | 19 | ### Bug Fixes 20 | 21 | * fix ts issues ([24c3ebd](https://github.com/dword-design/eslint-plugin-import-alias/commit/24c3ebd2e700eb96157854867f09ad05c5826c58)) 22 | 23 | # [6.0.0](https://github.com/dword-design/eslint-plugin-import-alias/compare/v5.1.2...v6.0.0) (2025-06-05) 24 | 25 | 26 | ### Bug Fixes 27 | 28 | * lock file maintenance ([#198](https://github.com/dword-design/eslint-plugin-import-alias/issues/198)) ([a935433](https://github.com/dword-design/eslint-plugin-import-alias/commit/a935433dd42a5512049f36e994b5234464571da4)) 29 | 30 | 31 | ### BREAKING CHANGES 32 | 33 | * Moved to new ESLint flat config format 34 | 35 | ## [5.1.2](https://github.com/dword-design/eslint-plugin-import-alias/compare/v5.1.1...v5.1.2) (2025-04-13) 36 | 37 | 38 | ### Bug Fixes 39 | 40 | * lock file maintenance ([#193](https://github.com/dword-design/eslint-plugin-import-alias/issues/193)) ([f085932](https://github.com/dword-design/eslint-plugin-import-alias/commit/f08593212f4809dea08715beb4f3ee761c130fbc)) 41 | 42 | ## [5.1.1](https://github.com/dword-design/eslint-plugin-import-alias/compare/v5.1.0...v5.1.1) (2024-08-18) 43 | 44 | 45 | ### Bug Fixes 46 | 47 | * foo ([a0ac190](https://github.com/dword-design/eslint-plugin-import-alias/commit/a0ac190c715b50806fa9cc13cf6315fda312a89a)) 48 | 49 | # [5.1.0](https://github.com/dword-design/eslint-plugin-import-alias/compare/v5.0.2...v5.1.0) (2024-08-17) 50 | 51 | 52 | ### Features 53 | 54 | * allow to alias also subpaths ([4f697c9](https://github.com/dword-design/eslint-plugin-import-alias/commit/4f697c906dee608fb4364139e6cfc88c5aae6d1d)) 55 | 56 | ## [5.0.2](https://github.com/dword-design/eslint-plugin-import-alias/compare/v5.0.1...v5.0.2) (2024-08-17) 57 | 58 | 59 | ### Bug Fixes 60 | 61 | * trigger release ([66758d9](https://github.com/dword-design/eslint-plugin-import-alias/commit/66758d97f7ca01b29fcf8e565c78bd324c9257d6)) 62 | 63 | ## [5.0.1](https://github.com/dword-design/eslint-plugin-import-alias/compare/v5.0.0...v5.0.1) (2024-08-14) 64 | 65 | 66 | ### Bug Fixes 67 | 68 | * typo in rules section ([#151](https://github.com/dword-design/eslint-plugin-import-alias/issues/151)) ([39b077f](https://github.com/dword-design/eslint-plugin-import-alias/commit/39b077fb90f7ba8b78eced9d072874f47967bf8c)) 69 | 70 | # [5.0.0](https://github.com/dword-design/eslint-plugin-import-alias/compare/v4.0.9...v5.0.0) (2024-03-04) 71 | 72 | 73 | ### Bug Fixes 74 | 75 | * lock file maintenance ([#170](https://github.com/dword-design/eslint-plugin-import-alias/issues/170)) ([8d92063](https://github.com/dword-design/eslint-plugin-import-alias/commit/8d920633e047f5759d450db8ff051875fd686e6c)) 76 | 77 | 78 | ### BREAKING CHANGES 79 | 80 | * node.js >= 18 81 | 82 | ## [4.0.9](https://github.com/dword-design/eslint-plugin-import-alias/compare/v4.0.8...v4.0.9) (2023-11-04) 83 | 84 | 85 | ### Bug Fixes 86 | 87 | * document alias adjustment ([b142105](https://github.com/dword-design/eslint-plugin-import-alias/commit/b1421054974a8eb75d52f70ed9ca1240c549a39a)) 88 | * update dependency execa to v8 ([#131](https://github.com/dword-design/eslint-plugin-import-alias/issues/131)) ([06bff14](https://github.com/dword-design/eslint-plugin-import-alias/commit/06bff14a0a50435ce4a4581481bb36a10e017ea3)) 89 | 90 | ## [4.0.8](https://github.com/dword-design/eslint-plugin-import-alias/compare/v4.0.7...v4.0.8) (2023-06-24) 91 | 92 | 93 | ### Bug Fixes 94 | 95 | * lock file maintenance ([#102](https://github.com/dword-design/eslint-plugin-import-alias/issues/102)) ([a3652f8](https://github.com/dword-design/eslint-plugin-import-alias/commit/a3652f8e7bc2bf281482873725abdb217e58f83b)) 96 | 97 | ## [4.0.7](https://github.com/dword-design/eslint-plugin-import-alias/compare/v4.0.6...v4.0.7) (2023-06-08) 98 | 99 | 100 | ### Bug Fixes 101 | 102 | * update dependency @babel/core to v7.22.5 ([464b29f](https://github.com/dword-design/eslint-plugin-import-alias/commit/464b29f162a0551e6cfa9388c2c92f14ac4be675)) 103 | 104 | ## [4.0.6](https://github.com/dword-design/eslint-plugin-import-alias/compare/v4.0.5...v4.0.6) (2023-06-03) 105 | 106 | 107 | ### Bug Fixes 108 | 109 | * update dependency eslint to v8.42.0 ([4c799a5](https://github.com/dword-design/eslint-plugin-import-alias/commit/4c799a5a0564c4cb57c5c3a6159218d19cb4a362)) 110 | 111 | ## [4.0.5](https://github.com/dword-design/eslint-plugin-import-alias/compare/v4.0.4...v4.0.5) (2023-05-26) 112 | 113 | 114 | ### Bug Fixes 115 | 116 | * update dependency @babel/core to v7.22.1 ([dbaf776](https://github.com/dword-design/eslint-plugin-import-alias/commit/dbaf776b6d9fcc02e3c41a8df5ff6c7072ca7cf4)) 117 | 118 | ## [4.0.4](https://github.com/dword-design/eslint-plugin-import-alias/compare/v4.0.3...v4.0.4) (2023-05-20) 119 | 120 | 121 | ### Bug Fixes 122 | 123 | * update dependency eslint to v8.41.0 ([9bd5eba](https://github.com/dword-design/eslint-plugin-import-alias/commit/9bd5eba910202b2272b9167e9b0c78d2f70b952e)) 124 | 125 | ## [4.0.3](https://github.com/dword-design/eslint-plugin-import-alias/compare/v4.0.2...v4.0.3) (2023-05-06) 126 | 127 | 128 | ### Bug Fixes 129 | 130 | * update dependency eslint to v8.40.0 ([e0c1973](https://github.com/dword-design/eslint-plugin-import-alias/commit/e0c1973a54fd7f50d3e5072f468ce02b51d04eb6)) 131 | 132 | ## [4.0.2](https://github.com/dword-design/eslint-plugin-import-alias/compare/v4.0.1...v4.0.2) (2023-05-02) 133 | 134 | 135 | ### Bug Fixes 136 | 137 | * update dependency @babel/core to v7.21.8 ([5d5e231](https://github.com/dword-design/eslint-plugin-import-alias/commit/5d5e231bb462c68e0da0d171bfbd0895f3c9cf99)) 138 | 139 | ## [4.0.1](https://github.com/dword-design/eslint-plugin-import-alias/compare/v4.0.0...v4.0.1) (2023-04-22) 140 | 141 | 142 | ### Bug Fixes 143 | 144 | * update dependency eslint to v8.39.0 ([9631b31](https://github.com/dword-design/eslint-plugin-import-alias/commit/9631b313338be6c34a690bf3e167724a82799b64)) 145 | 146 | # [4.0.0](https://github.com/dword-design/eslint-plugin-import-alias/compare/v3.0.8...v4.0.0) (2023-04-17) 147 | 148 | 149 | ### Bug Fixes 150 | 151 | * update dependency babel-plugin-module-resolver to v5 ([#95](https://github.com/dword-design/eslint-plugin-import-alias/issues/95)) ([d3df2f3](https://github.com/dword-design/eslint-plugin-import-alias/commit/d3df2f324078a2644175214a0f005d195a6afdb0)) 152 | 153 | 154 | ### BREAKING CHANGES 155 | 156 | * require Node.js >= 16 157 | 158 | ## [3.0.8](https://github.com/dword-design/eslint-plugin-import-alias/compare/v3.0.7...v3.0.8) (2023-04-09) 159 | 160 | 161 | ### Bug Fixes 162 | 163 | * update dependency @dword-design/functions to v4.1.7 ([7e383cb](https://github.com/dword-design/eslint-plugin-import-alias/commit/7e383cbd8d124c801e5fabf4a594fc2824b2ec29)) 164 | 165 | ## [3.0.7](https://github.com/dword-design/eslint-plugin-import-alias/compare/v3.0.6...v3.0.7) (2023-04-09) 166 | 167 | 168 | ### Bug Fixes 169 | 170 | * update README.md ([#98](https://github.com/dword-design/eslint-plugin-import-alias/issues/98)) ([42358f6](https://github.com/dword-design/eslint-plugin-import-alias/commit/42358f6f6ee2007a2b85bae9b5111711d26a539b)) 171 | 172 | ## [3.0.6](https://github.com/dword-design/eslint-plugin-import-alias/compare/v3.0.5...v3.0.6) (2023-04-08) 173 | 174 | 175 | ### Bug Fixes 176 | 177 | * update dependency eslint to v8.38.0 ([72c2420](https://github.com/dword-design/eslint-plugin-import-alias/commit/72c2420d3b8268ad361e5a6c95fbf4139fb9e183)) 178 | 179 | ## [3.0.5](https://github.com/dword-design/eslint-plugin-import-alias/compare/v3.0.4...v3.0.5) (2023-03-31) 180 | 181 | 182 | ### Bug Fixes 183 | 184 | * update dependency @babel/core to v7.21.4 ([6381689](https://github.com/dword-design/eslint-plugin-import-alias/commit/6381689fdc3dabd5a4ab96a2cc69a3a0a39df1c3)) 185 | 186 | ## [3.0.4](https://github.com/dword-design/eslint-plugin-import-alias/compare/v3.0.3...v3.0.4) (2023-03-29) 187 | 188 | 189 | ### Bug Fixes 190 | 191 | * update dependency eslint to v8.37.0 ([ffa519a](https://github.com/dword-design/eslint-plugin-import-alias/commit/ffa519a6be40af5eef11fa3764fdaa47d73a4b6a)) 192 | 193 | ## [3.0.3](https://github.com/dword-design/eslint-plugin-import-alias/compare/v3.0.2...v3.0.3) (2023-03-16) 194 | 195 | 196 | ### Bug Fixes 197 | 198 | * update dependency eslint to v8.36.0 ([6c1d2a9](https://github.com/dword-design/eslint-plugin-import-alias/commit/6c1d2a98428ad336654232606a8093b632738128)) 199 | 200 | ## [3.0.2](https://github.com/dword-design/eslint-plugin-import-alias/compare/v3.0.1...v3.0.2) (2023-03-15) 201 | 202 | 203 | ### Bug Fixes 204 | 205 | * update dependency @babel/core to v7.21.3 ([c89c03c](https://github.com/dword-design/eslint-plugin-import-alias/commit/c89c03cd0734f60fa8768800644bccf71f1c79c2)) 206 | 207 | ## [3.0.1](https://github.com/dword-design/eslint-plugin-import-alias/compare/v3.0.0...v3.0.1) (2023-03-04) 208 | 209 | 210 | ### Bug Fixes 211 | 212 | * update dependency eslint to v8 ([#51](https://github.com/dword-design/eslint-plugin-import-alias/issues/51)) ([87887fc](https://github.com/dword-design/eslint-plugin-import-alias/commit/87887fcf8b01bc52d0ce0a459cfd4f10fb4ab28f)) 213 | 214 | # [3.0.0](https://github.com/dword-design/eslint-plugin-import-alias/compare/v2.0.7...v3.0.0) (2023-01-08) 215 | 216 | 217 | ### Bug Fixes 218 | 219 | * lock file maintenance ([#90](https://github.com/dword-design/eslint-plugin-import-alias/issues/90)) ([732421e](https://github.com/dword-design/eslint-plugin-import-alias/commit/732421e1c5dac0817d592c0f9d3228e86896131e)) 220 | 221 | 222 | ### BREAKING CHANGES 223 | 224 | * drop node 12 support, move to esm 225 | 226 | ## [2.0.7](https://github.com/dword-design/eslint-plugin-import-alias/compare/v2.0.6...v2.0.7) (2022-01-12) 227 | 228 | 229 | ### Bug Fixes 230 | 231 | * update config files ([de915fb](https://github.com/dword-design/eslint-plugin-import-alias/commit/de915fbbfecd342b1be9f0bdbd6c41a44a039925)) 232 | 233 | ## [2.0.6](https://github.com/dword-design/eslint-plugin-import-alias/compare/v2.0.5...v2.0.6) (2022-01-04) 234 | 235 | 236 | ### Bug Fixes 237 | 238 | * update config files ([9b630ce](https://github.com/dword-design/eslint-plugin-import-alias/commit/9b630ce95e578c481d7aa8baab35f8245b55517f)) 239 | 240 | ## [2.0.5](https://github.com/dword-design/eslint-plugin-import-alias/compare/v2.0.4...v2.0.5) (2021-07-20) 241 | 242 | 243 | ### Bug Fixes 244 | 245 | * update config files ([b0a736d](https://github.com/dword-design/eslint-plugin-import-alias/commit/b0a736d1726ecc198a3c2c9ec85fb4a974126e12)) 246 | 247 | ## [2.0.4](https://github.com/dword-design/eslint-plugin-import-alias/compare/v2.0.3...v2.0.4) (2021-07-06) 248 | 249 | 250 | ### Bug Fixes 251 | 252 | * update config files ([068e855](https://github.com/dword-design/eslint-plugin-import-alias/commit/068e8553e4657e6766a378c3257d67a84a902441)) 253 | 254 | ## [2.0.3](https://github.com/dword-design/eslint-plugin-import-alias/compare/v2.0.2...v2.0.3) (2021-06-14) 255 | 256 | 257 | ### Bug Fixes 258 | 259 | * update config files ([25705f6](https://github.com/dword-design/eslint-plugin-import-alias/commit/25705f63cfc0ec78b92c100111283e12476b99ea)) 260 | 261 | ## [2.0.2](https://github.com/dword-design/eslint-plugin-import-alias/compare/v2.0.1...v2.0.2) (2021-05-28) 262 | 263 | 264 | ### Bug Fixes 265 | 266 | * update config files ([41f9c53](https://github.com/dword-design/eslint-plugin-import-alias/commit/41f9c53e7426981a0e01dccadf8240d56adc0e0f)) 267 | 268 | ## [2.0.1](https://github.com/dword-design/eslint-plugin-import-alias/compare/v2.0.0...v2.0.1) (2021-05-04) 269 | 270 | 271 | ### Bug Fixes 272 | 273 | * update dependency output-files to v2 ([#30](https://github.com/dword-design/eslint-plugin-import-alias/issues/30)) ([d9d3981](https://github.com/dword-design/eslint-plugin-import-alias/commit/d9d39819625c2d9e9741aaad2ad39f2ed05eab57)) 274 | 275 | # [2.0.0](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.5.2...v2.0.0) (2021-05-04) 276 | 277 | 278 | ### Bug Fixes 279 | 280 | * update dependency @dword-design/base to v8 ([#27](https://github.com/dword-design/eslint-plugin-import-alias/issues/27)) ([494b47b](https://github.com/dword-design/eslint-plugin-import-alias/commit/494b47b49c4c1b24b3d00826deb9f1341127aa5a)) 281 | * update dependency @dword-design/functions to v4 ([#28](https://github.com/dword-design/eslint-plugin-import-alias/issues/28)) ([395af9c](https://github.com/dword-design/eslint-plugin-import-alias/commit/395af9c671fcb4946784ab42db1bac271866eff3)) 282 | * update dependency depcheck-package-name to v2 ([#29](https://github.com/dword-design/eslint-plugin-import-alias/issues/29)) ([f6de4ef](https://github.com/dword-design/eslint-plugin-import-alias/commit/f6de4ef4ec4a8d747a71e8411a0b3b82df7bd82d)) 283 | * update dependency with-local-tmp-dir to v4 ([#31](https://github.com/dword-design/eslint-plugin-import-alias/issues/31)) ([bb1e596](https://github.com/dword-design/eslint-plugin-import-alias/commit/bb1e596e20ba39149e21ab6fd7a1644e5aa962f7)) 284 | 285 | 286 | ### BREAKING CHANGES 287 | 288 | * require Node.js >= 12 289 | 290 | Co-authored-by: Renovate Bot 291 | Co-authored-by: Sebastian Landwehr 292 | Co-authored-by: GitHub Actions 293 | 294 | ## [1.5.2](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.5.1...v1.5.2) (2021-04-26) 295 | 296 | 297 | ### Bug Fixes 298 | 299 | * update dependency with-local-tmp-dir to v3 ([#24](https://github.com/dword-design/eslint-plugin-import-alias/issues/24)) ([ecfbd59](https://github.com/dword-design/eslint-plugin-import-alias/commit/ecfbd59db951fac5951f4e1fb68fd655775f63a6)) 300 | 301 | ## [1.5.1](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.5.0...v1.5.1) (2021-04-14) 302 | 303 | 304 | ### Bug Fixes 305 | 306 | * revert open source ([1c07f3f](https://github.com/dword-design/eslint-plugin-import-alias/commit/1c07f3f2ad0d7bdd7aac64c32ac9a1d65f14779a)) 307 | * update config files ([657a25c](https://github.com/dword-design/eslint-plugin-import-alias/commit/657a25c85f1280ef5e9c56f65c8282089ce75595)) 308 | * update readme ([bf8265b](https://github.com/dword-design/eslint-plugin-import-alias/commit/bf8265bbbcc0ba9c37a084f785c7e20df43dd8f9)) 309 | 310 | # [1.5.0](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.11...v1.5.0) (2021-04-14) 311 | 312 | 313 | ### Bug Fixes 314 | 315 | * add description and keywords ([b5632fd](https://github.com/dword-design/eslint-plugin-import-alias/commit/b5632fdc94f7d3bf23e15ddf23d2cdb6fd43d9e8)) 316 | * open-source it ([f47403b](https://github.com/dword-design/eslint-plugin-import-alias/commit/f47403beb73a7b09c886839e31a6861b1e9883ef)) 317 | * update files ([2ba82b7](https://github.com/dword-design/eslint-plugin-import-alias/commit/2ba82b708415fd15a565ca7c017be75648e13ce9)) 318 | 319 | 320 | ### Features 321 | 322 | * custom aliases ([#17](https://github.com/dword-design/eslint-plugin-import-alias/issues/17)) ([bffdc7e](https://github.com/dword-design/eslint-plugin-import-alias/commit/bffdc7eb5484cc6e427a4efc67b29b5c1e089439)) 323 | 324 | ## [1.4.11](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.10...v1.4.11) (2021-04-12) 325 | 326 | 327 | ### Bug Fixes 328 | 329 | * lock file maintenance ([#15](https://github.com/dword-design/eslint-plugin-import-alias/issues/15)) ([87b0462](https://github.com/dword-design/eslint-plugin-import-alias/commit/87b04622141537b44ccb421e25a762d898da6063)) 330 | 331 | ## [1.4.10](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.9...v1.4.10) (2021-03-31) 332 | 333 | 334 | ### Bug Fixes 335 | 336 | * lock file maintenance ([#13](https://github.com/dword-design/eslint-plugin-import-alias/issues/13)) ([2622c1a](https://github.com/dword-design/eslint-plugin-import-alias/commit/2622c1a45bcee66f6d5cbaa79f331feb6916bb66)) 337 | 338 | ## [1.4.9](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.8...v1.4.9) (2021-03-23) 339 | 340 | 341 | ### Bug Fixes 342 | 343 | * update dependency @dword-design/functions to v3 ([#12](https://github.com/dword-design/eslint-plugin-import-alias/issues/12)) ([d0c9f70](https://github.com/dword-design/eslint-plugin-import-alias/commit/d0c9f7073a85499854eed7f1fdb24bb70e02ca9d)) 344 | 345 | ## [1.4.8](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.7...v1.4.8) (2021-03-22) 346 | 347 | 348 | ### Bug Fixes 349 | 350 | * lock file maintenance ([#11](https://github.com/dword-design/eslint-plugin-import-alias/issues/11)) ([eb550b0](https://github.com/dword-design/eslint-plugin-import-alias/commit/eb550b02f870d501de3c3604457d9b7a8009fd1a)) 351 | 352 | ## [1.4.7](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.6...v1.4.7) (2021-03-17) 353 | 354 | 355 | ### Bug Fixes 356 | 357 | * lock file maintenance ([#10](https://github.com/dword-design/eslint-plugin-import-alias/issues/10)) ([c5b9859](https://github.com/dword-design/eslint-plugin-import-alias/commit/c5b9859c8e34bdddd238c5078c7175b1c2764a33)) 358 | 359 | ## [1.4.6](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.5...v1.4.6) (2021-02-17) 360 | 361 | 362 | ### Bug Fixes 363 | 364 | * upgrades ([40dcb20](https://github.com/dword-design/eslint-plugin-import-alias/commit/40dcb20742d0693b8bc323eb554d87f585126b44)) 365 | 366 | ## [1.4.5](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.4...v1.4.5) (2020-12-11) 367 | 368 | 369 | ### Bug Fixes 370 | 371 | * replace get-package-name with depcheck-package-name ([3002508](https://github.com/dword-design/eslint-plugin-import-alias/commit/3002508bbd8df3a7a78f99fc4fa519b669556f6b)) 372 | 373 | ## [1.4.4](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.3...v1.4.4) (2020-12-02) 374 | 375 | 376 | ### Bug Fixes 377 | 378 | * **config:** Update changed files ([2813bde](https://github.com/dword-design/eslint-plugin-import-alias/commit/2813bdedde114b09a1bc009d13fdfe2d57fd72af)) 379 | 380 | ## [1.4.3](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.2...v1.4.3) (2020-08-26) 381 | 382 | 383 | ### Bug Fixes 384 | 385 | * build files ([6b33c66](https://github.com/dword-design/eslint-plugin-import-alias/commit/6b33c66dd51d0367f573495d6f95cdef720f1dd9)) 386 | 387 | ## [1.4.2](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.1...v1.4.2) (2020-07-04) 388 | 389 | 390 | ### Bug Fixes 391 | 392 | * fixes after upgrades ([8fe0efb](https://github.com/dword-design/eslint-plugin-import-alias/commit/8fe0efb614f75fca7917ce36ba5f1b04ad23b251)) 393 | 394 | ## [1.4.1](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.4.0...v1.4.1) (2020-06-18) 395 | 396 | 397 | ### Bug Fixes 398 | 399 | * optimization ([afc79e6](https://github.com/dword-design/eslint-plugin-import-alias/commit/afc79e60d092d0522abc45efdfdc65ddefdc0b15)) 400 | 401 | # [1.4.0](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.3.0...v1.4.0) (2020-06-18) 402 | 403 | 404 | ### Features 405 | 406 | * add resolvePath support ([28eeb0c](https://github.com/dword-design/eslint-plugin-import-alias/commit/28eeb0ccc5517f3ee915bc814e454570eb6dfc64)) 407 | 408 | # [1.3.0](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.2.0...v1.3.0) (2020-06-18) 409 | 410 | 411 | ### Features 412 | 413 | * use babel plugin to resolve options ([4d7c247](https://github.com/dword-design/eslint-plugin-import-alias/commit/4d7c24728a96da68045096a3109c00737d62b11a)) 414 | 415 | # [1.2.0](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.1.3...v1.2.0) (2020-06-16) 416 | 417 | 418 | ### Features 419 | 420 | * add packagejson and babelrc support ([dab35ad](https://github.com/dword-design/eslint-plugin-import-alias/commit/dab35ad9a555f69a77ebf329e0ffd3ea64eac5a9)) 421 | 422 | ## [1.1.3](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.1.2...v1.1.3) (2020-06-15) 423 | 424 | 425 | ### Bug Fixes 426 | 427 | * subfolder fix ([fa390ef](https://github.com/dword-design/eslint-plugin-import-alias/commit/fa390ef8bd234806b4deeac210dde3e2760f6f50)) 428 | 429 | ## [1.1.2](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.1.1...v1.1.2) (2020-06-15) 430 | 431 | 432 | ### Bug Fixes 433 | 434 | * scoped import support ([d6db8fc](https://github.com/dword-design/eslint-plugin-import-alias/commit/d6db8fc8042e891c22b41fde5599ce47bca664b2)) 435 | 436 | ## [1.1.1](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.1.0...v1.1.1) (2020-06-15) 437 | 438 | 439 | ### Bug Fixes 440 | 441 | * fix name ([cd41c66](https://github.com/dword-design/eslint-plugin-import-alias/commit/cd41c66b05e01c638c79912bfed5e14d25375c8f)) 442 | 443 | # [1.1.0](https://github.com/dword-design/eslint-plugin-import-alias/compare/v1.0.0...v1.1.0) (2020-06-15) 444 | 445 | 446 | ### Bug Fixes 447 | 448 | * fi ([f13e15f](https://github.com/dword-design/eslint-plugin-import-alias/commit/f13e15fc489e7aaba12909245b884d997670d96d)) 449 | * fix for windows ([4458135](https://github.com/dword-design/eslint-plugin-import-alias/commit/44581350b85c8eed49903122564e3ede992a8c17)) 450 | 451 | 452 | ### Features 453 | 454 | * init ([5c756ac](https://github.com/dword-design/eslint-plugin-import-alias/commit/5c756acacbb534fc95d861069033268c1fae55e7)) 455 | 456 | # 1.0.0 (2020-06-15) 457 | 458 | 459 | ### Bug Fixes 460 | 461 | * **config:** Update changed files ([3a4efb6](https://github.com/dword-design/eslint-plugin-import-alias/commit/3a4efb6167ab523aeee58dff5a9ecafdec642e13)) 462 | 463 | 464 | ### Features 465 | 466 | * init ([e45df74](https://github.com/dword-design/eslint-plugin-import-alias/commit/e45df74c5eea6a8af3c69181d4f9d7789d1d7f09)) 467 | --------------------------------------------------------------------------------