Hi Max, It looks like you’re using TypeScript, which probably means you’re using typescript-eslint. Unfortunately, typescript-eslint requires evaluating all files every time ESLint is run so caching won’t have the desired effect.
On Wed, May 11, 2022 at 4:41 AM Max Kieltyka <[email protected]> wrote: > Hello Everyone, > > Normally one eslint run against our project takes 3 - 4 minutes, so we > thought about introducing caching. There I ran into problem. Our > environment are github actions. Eslint is run like this: > > eslint . --ext .js,.cjs,.jsx,.ts --cache --cache-location > ./.tmp/.eslintcache --cache-strategy content > > So we try to load a cache from .eslintcache and use content as cache > strategy, because git doesn't preserve file modification times. > > The cache is populated using just a default action from github, so we end > up with something like this: > > statics: > runs-on: ubuntu-latest > steps: > - uses: actions/checkout@v2 > - uses: actions/setup-node@v2 > - uses: actions/cache@v3 > with: > path: ./.tmp/.eslintcache > key: eslintcache-${{github.sha}} > restore-keys: | > eslintcache- > - run: npm ci > - run: npm run lint > > When running this immediately after a previous run, eslint takes only 2 - > 3 seconds for the whole project (compared to 3 - 4 minutes). > > But when waiting a day and then running it again, without file changes in > the branch, eslint takes around 40 seconds (on a cache hit). Still a lot > better than 3 - 4 minutes, but also a lot worse than 2 - 3 seconds. > > What is going on there? > > Best regards and thanks for any help or insight > Max > > -- > You received this message because you are subscribed to the Google Groups > "ESLint" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/eslint/d6b14b50-b003-492f-a49c-2d5aad172c49n%40googlegroups.com > <https://groups.google.com/d/msgid/eslint/d6b14b50-b003-492f-a49c-2d5aad172c49n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- ______________________________ Nicholas C. Zakas (@slicknet <https://twitter.com/slicknet>) Owner, Human Who Codes LLC humanwhocodes.com -- You received this message because you are subscribed to the Google Groups "ESLint" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/eslint/CAOkd9hm1e%2BA1obYrZFbyZpxFw_%3DepDUEJy2fzEwEe7T8SMzx3A%40mail.gmail.com.
