【问题标题】:Unable to resolve path to module 'firebase-admin/app' (ESLint)无法解析模块“firebase-admin/app”的路径(ESLint)
【发布时间】:2021-12-13 05:13:55
【问题描述】:

我正试图通过docs 连接到我的 Firebase 应用,但 ESLint 正在抱怨。我已经检查了related question,但那里提出的解决方案似乎对我不起作用。我有以下 .eslint.js 文件:

module.exports = {
  extends: [
    'airbnb-typescript/base',
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:typescript-sort-keys/recommended',
    'plugin:import/recommended',
    'prettier'
  ],
  parser       : '@typescript-eslint/parser',
  parserOptions: {
    ecmaFeatures: {
      modules: true
    },
    ecmaVersion: 6,
    project    : './tsconfig.json',
    sourceType : 'module'
  },
  plugins: ['@typescript-eslint', 'typescript-sort-keys', 'sort-keys-fix'],
  rules  : { ... }
}

【问题讨论】:

  • 从 firebase-admin 9 升级到版本 10 后对我来说同样的问题。我暂时禁用了此导入语句的规则:// eslint-disable-next-line import/no-unresolved

标签: typescript firebase eslint firebase-admin


【解决方案1】:

Firebase Admin v10 开始,它使用exports in package.json 来定义入口点。 eslint-plugin-importdoes not supportexports。在此之前,您必须完全禁用 import/no-unresolved 或每次违规。

// eslint-disable-next-line import/no-unresolved

【讨论】:

    猜你喜欢
    • 2021-11-10
    • 2022-12-19
    • 2022-01-15
    • 2020-06-07
    • 2021-06-05
    • 1970-01-01
    • 2020-05-06
    • 2023-01-24
    • 2017-05-26
    相关资源
    最近更新 更多