typescript - 为什么 eslint 在 Github Actions 上失败,但在本地工作?

标签 typescript react-native continuous-integration eslint github-actions

我有一个看起来像这样的工作流程

name: Node CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-18.04

    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-node@v1
      with:
        node-version: '12.x'
    - run: npm install
    - run: npm run lint

由于某种原因,lint 阶段失败并产生以下错误

> eslint . --ext .js,.jsx,.ts,.tsx


/home/runner/work/ABC/ABC/src/components/folder/Folder.tsx
##[error]  6:20  error  Missing file extension for "../../styles/Colors"        import/extensions
##[error]  6:20  error  Unable to resolve path to module '../../styles/Colors'  import/no-unresolved

/home/runner/work/ABC/ABC/src/components/todo/header/Heading.tsx
##[error]  4:20  error  Missing file extension for "../../../styles/Colors"        import/extensions
##[error]  4:20  error  Unable to resolve path to module '../../../styles/Colors'  import/no-unresolved


/home/runner/work/ABC/ABC/src/screens/TodoScreen.tsx
##[error]  3:20  error  Missing file extension for "../styles/Colors"        import/extensions
##[error]  3:20  error  Unable to resolve path to module '../styles/Colors'  import/no-unresolved

✖ 6 problems (6 errors, 0 warnings)

当我跑 npm run lint在本地,它成功通过。

我试过运行 npm ci然后 npm run lint它仍然通过

最佳答案

原来这是一个文件大小写敏感问题。
../../styles/Colors之前被我重命名为 ../../styles/colors (小写)

但是由于某种原因 git 没有接受这个。我必须使用 git mv 手动执行此操作

关于typescript - 为什么 eslint 在 Github Actions 上失败,但在本地工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59547481/

相关文章:

listview - 当 this.state 改变(但不是数据源)时如何强制重绘 ListView。

continuous-integration - 在 Hudson 或 Jenkins 中,如何恢复已删除的构建?

android - 我如何为每个拉取请求托管一个 Android APK 文件,以便 QA 可以在合并之前测试它们?

Angular 4 Ngx-datatable Filter not working object is null but accessed (even with if condition)

数组和对象类型的 typescript 联合

react-native - 运行 react-native run-ios 时出错。错误 : Cannot find module 'metro-config'

android - Firestore onSnapshot() 和 get() 导致 Android 应用程序崩溃

node.js - 加速 AngularJs 项目的 Travis-CI 依赖项安装

javascript - Knockout JS 绑定(bind)计算可观察值不起作用

javascript - Javascript 左侧的可选链接