Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does eslint fail on Github Actions but works locally?

I have a workflow that looks like this

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

For some reason the lint stage fails and produces the following error

> 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)

When I run npm run lint locally, it successfully passes.

I've tried running npm ci and then npm run lint and it still passes

like image 655
Colin Cheung Avatar asked Dec 31 '19 18:12

Colin Cheung


1 Answers

Turns out this was a file case sensitivity issue.

../../styles/Colors was renamed earlier by me to ../../styles/colors (lowercase)

However for some reason git didn't pick this up. I had to do this manually with git mv

like image 200
Colin Cheung Avatar answered Nov 15 '22 07:11

Colin Cheung