【问题标题】:Why does eslint fail on Github Actions but works locally?为什么 eslint 在 Github Actions 上失败但在本地工作?
【发布时间】:2020-04-20 04:22:41
【问题描述】:

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

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,它仍然通过

【问题讨论】:

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


    【解决方案1】:

    原来这是一个文件区分大小写问题。

    ../../styles/Colors 之前被我重命名为 ../../styles/colors(小写)

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-03
      • 2023-01-15
      • 2021-04-16
      • 1970-01-01
      • 2022-11-08
      • 2018-04-15
      • 2021-10-09
      • 1970-01-01
      相关资源
      最近更新 更多