最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

无法为特定的导入库构建节点js项目

网站源码admin17浏览0评论

无法为特定的导入库构建节点js项目

无法为特定的导入库构建节点js项目

我正在vue.js项目中导入库。仅对于Library1,没有错误。当我运行要导入的库2的vue节点js项目构建时,它总是在下面一行失败,并停留在消息“为生产而构建”中。

Could not find implementations for the following rules specified in the configuration:
no-explicit-any
Try upgrading TSLint and/or ensuring that you have all necessary custom rules  installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.

是否有办法通过npm build使其忽略?

下面是我的.eslintrc.js

module.exports = {
      root: true,
      env: {
        node: true
      },
      'extends': [
        'plugin:vue/essential',
        'eslint:recommended',
        '@vue/typescript/recommended'
      ],
      parserOptions: {
        ecmaVersion: 2020,
        ecmaFeatures: {
          legacyDecorators: true,
        },
      },
      rules: {
        '@typescript-eslint/no-var-requires': 0,
        '@typescript-eslint/ban-ts-ignore': 'off',
        "@typescript-eslint/no-explicit-any": "off",
   }
  }

我需要更新我的tsconfig或tslint来停止在生产时进行检查。这仅发生在我正在使用的vue库投影中。

我使用npm链接和npm链接来链接和安装库。

回答如下:

最简单的解决方法是删除tslint。如您所愿。您只需要安装一些额外的eslint程序包

npm i -D @typescript-eslint/eslint-plugin;
npm i -D @typescript-eslint/parser;
npm i -D eslint;

以下是推荐的


module.exports = {
    env: {
        commonjs: true,
        es6: true,
        node: true,
    },
    extends: [
        "eslint:recommended",
        "plugin:@typescript-eslint/eslint-recommended",
        "plugin:@typescript-eslint/recommended",
        "plugin:@typescript-eslint/recommended-requiring-type-checking",
    ],
    globals: {
        Atomics: "readonly",
        SharedArrayBuffer: "readonly",
    },
    parser: "@typescript-eslint/parser",
    parserOptions: {
        project: "./tsconfig.json",
        ecmaVersion: 2019,
    },
    plugins: ["@typescript-eslint"],
    rules: {
.....
    }
}

注意:

在您的tsconfig.json添加包含部分。顾名思义,这包括源文件的路径。和排除相反


{
  "compilerOptions": {
....
  },
  "exclude": [
    "/node_modules/",
    "./config/"
  ],
  "include": [
    "./src/*.ts",
    "./src/**/*.ts",
    "./src/**/**/*.ts",
    "./src/**/**/**/*.ts"
  ]
}
发布评论

评论列表(0)

  1. 暂无评论