Skip to content

With e[email protected], how do you use eslint’s cache?

After switching from eslint-loader, our initial watch builds have slowed down substantially due to the lack of caching. Is there a way to use eslint’s cache?

Answer

ESLint’s node api has cache and cacheLocation keys in it, and setting those like

const ESLintPlugin = require('eslint-webpack-plugin')
module.exports = {
  plugins: [
    new ESLintPlugin({
      cache: true,
      cacheLocation
    })
  ]
}

enables caching like eslint-webpack-loader‘s old caching behavior.