[Vuejs]-Lint-staged generates new .eslintcache file on commit

5πŸ‘

βœ…

The .eslintcache file is created from ESLint’s --cache flag, which is included in the default linter command of lint-staged:

// package.json
{
  "lint-staged": {                        πŸ‘‡
    "*.{vue,js,jsx,cjs,mjs}": "eslint --cache --fix",
    "*.{js,css,md}": "prettier --write"
  }
}

You can either remove the --cache flag:

// package.json
{
  "lint-staged": {
    "*.{vue,js,jsx,cjs,mjs}": "eslint --fix",
    "*.{js,css,md}": "prettier --write"
  }
}

…or set the cache file location with the --cache-location flag (e.g., specify node_modules/.cache):

// package.json
{
  "lint-staged": {                                          πŸ‘‡
    "*.{vue,js,jsx,cjs,mjs}": "eslint --cache --fix --cache-location ./node_modules/.cache/.eslintcache",
    "*.{js,css,md}": "prettier --write"
  }
}
πŸ‘€tony19

Leave a comment