Skip to content

How to put an alias using regexp #2

@wizevlad

Description

@wizevlad

The problem, I have this folder structure:

+ src
    - components
    - pages
    - state
    - utils

My jsconfig.json sets src as baseUrl:

{
  "compilerOptions": {
    "baseUrl": "src"
  }
}

So I import files using this notation:

import getFilename from 'utils/files/getFilename'

Using this plugin, I need to create an alias for all 4 subfolders and I want to say: "Every direct child inside src should be aliased".

Is that doable? Something like:

"settings": {
    "import/resolver": {
      "eslint-import-resolver-custom-alias": {
        "alias": {
          "*": "./src/*"
        },
        "extensions": [".js", ".jsx"]
      }
    }
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions