eslint +prettier + editorconfig问题点整理

import/no-unresolved

image.png
eslint不认路径中带有webpack路径别名的问题

解决方式:

  1. 安装eslint-import-resolver-webpack
  2. eslintsettings中,加入如下配置,相当于把你在webpack声明的路径别名告诉eslint

     settings: {
         'import/resolver': [{
             webpack: {
                 config: {
                     resolve: {
                         alias: {
                             '@': path.resolve('src'),
                         },
                         extensions: ['.js', '.jsx'],
                     },
                 },
             },
         }],
     },

node模块触发import/no-extraneous-dependencies

image.png

解决方式:

  1. 安装eslint-import-resolver-webpack
  2. 然后在eslint配置中的settings加入如下配置
    image.png

你可能感兴趣的:(eslint +prettier + editorconfig问题点整理)