johvin / eslint-import-resolver-alias

a simple Node behavior import resolution plugin for eslint-plugin-import, supporting module alias
MIT License
180 stars 10 forks source link

Alias Not Working with Serverless Framework Project #20

Open jhoffmcd opened 3 years ago

jhoffmcd commented 3 years ago

I am attempting to get a serverless framework project setup with es6 import/export support. I am able to get it to work with the serverless-webpack however there is an eslint-plugin-node rule that I can't seem to fix with this plugin.

error  "~/utils/logging" is not found  node/no-missing-import

This is my eslint configuration:

{
  "parser": "@babel/eslint-parser",
  "parserOptions": {
    "sourceType": "module"
  },
  "extends": [
    "eslint:recommended",
    "plugin:node/recommended",
    "plugin:jest/recommended",
    "prettier"
  ],
  "plugins": ["prettier"],
  "settings": {
    "import/resolver": {
      "alias": {
        "map": [["~", "./src"]],
        "extensions": [".js", ".json"]
      }
    }
  },
  "rules": {
    "prettier/prettier": "error",
    "node/no-unsupported-features/es-syntax": [
      "error",
      {
        "version": ">=12.10.0",
        "ignores": ["modules"]
      }
    ]
  }
}

For now, I will disable the rule but I wonder if this is expected to work when working with Node.js files.