eslint
eslint copied to clipboard
ESLint didn't detect change when saving file
- My packages version
"devDependencies": {
"@nuxtjs/eslint-config": "^5.0.0",
"@nuxtjs/eslint-module": "^3.0.1",
"@nuxtjs/google-fonts": "^1.2.0",
"@nuxtjs/style-resources": "^1.0.0",
"@nuxtjs/stylelint-module": "^4.0.0",
"babel-eslint": "^10.1.0",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"cross-env": "^7.0.2",
"easygettext": "^2.16.1",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.12.0",
"eslint-plugin-nuxt": "^2.0.0",
"eslint-plugin-prettier": "^3.1.4",
"find-config": "^1.0.0",
"husky": "^4.3.0",
"imagemin-lint-staged": "^0.4.0",
"lint-staged": "^10.4.0",
"nodemon": "^2.0.6",
"prettier": "^2.1.2",
"sass": "^1.29.0",
"sass-loader": "^10.1.0",
"stylelint": "^13.7.2",
"stylelint-config-css-modules": "^2.2.0",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-recess-order": "^2.2.0",
"stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.18.0",
"yarn-run-all": "^3.1.1"
},
- .eslintrc.js
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module',
},
extends: [
'@nuxtjs',
'plugin:prettier/recommended',
// https://github.com/vuejs/eslint-plugin-vue#bulb-rules
'plugin:vue/recommended',
'plugin:nuxt/recommended',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard',
// https://github.com/prettier/eslint-config-prettier
'prettier',
'prettier/standard',
'prettier/vue',
],
plugins: ['prettier'],
rules: {
'no-console': 'off',
// Only allow debugger in development
'no-debugger': process.env.PRE_COMMIT ? 'error' : 'off',
// Only allow `console.log` in development
// 'no-console': process.env.PRE_COMMIT ? ['error', { allow: ['warn', 'error'] }] : 'off',
'import/no-relative-parent-imports': 'error',
'import/order': 'error',
'vue/array-bracket-spacing': 'error',
'vue/arrow-spacing': 'error',
'vue/block-spacing': 'error',
'vue/brace-style': 'error',
'vue/camelcase': 'error',
'vue/comma-dangle': ['error', 'always-multiline'],
'vue/component-name-in-template-casing': 'error',
'vue/dot-location': ['error', 'property'],
'vue/eqeqeq': 'error',
'vue/key-spacing': 'error',
'vue/keyword-spacing': 'error',
'vue/no-boolean-default': ['error', 'default-false'],
'vue/no-deprecated-scope-attribute': 'error',
'vue/no-empty-pattern': 'error',
'vue/object-curly-spacing': ['error', 'always'],
'vue/padding-line-between-blocks': 'error',
'vue/space-infix-ops': 'error',
'vue/space-unary-ops': 'error',
'vue/v-on-function-call': 'error',
'vue/v-slot-style': [
'error',
{
atComponent: 'v-slot',
default: 'v-slot',
named: 'longform',
},
],
'vue/valid-v-slot': 'error',
'vue/require-default-prop': 'off',
},
}
- The eslint-module
cacheoptions is enable by default.
Problem
- When I made a change on my .vue file, the ESLint didn't detect the change to re-run. If I turned off the
cacheoption, it works as expected
Can someone take a look?
@prd-hop-duong were you able to find a workaround or a solution?
@rlam3 Not yet, I temporarily turned off cache for work.
Same here, had to disable the cache after going down the rabbit hole. Would you consider changing the default setting to false ?
It is easy to replicate with the basic create-nuxt-app if anyone is interested in digging into it.
Have seen this situation as well on Windows right now.
Hi @prd-hop-duong Fixed on v3.0.1 If the problem persists please reopen
Hi @ricardogobbosouza Where's the commit to fix this issue? I already on this version v3.0.1 a month ago.
Hi @prd-hop-duong
It was a fix on the eslint-webpack-plugin dependency
Try rm -rf node_modules yarn.lock && yarn
Hi @ricardogobbosouza It did not help, the issue still persists.
The nuxt-app had the same problem if I updated the dependencies to latest.

Spent two hours on this after an upgrade. Yes, the default seemed to change. Not seeing the fix in either the 3.0.1 or 3.0.2 commit.
I delete everything.
Then npm i with:
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@mdi/js": "^5.8.55",
"@nuxtjs/eslint-config": "^5.0.0",
"@nuxtjs/eslint-module": "^3.0.2",
"eslint": "7.16.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-nuxt": "^2.0.0",
"eslint-plugin-prettier": "^3.3.0",
"prettier": "^2.2.1",
"worker-loader": "^3.0.7"
}
I look at node_modules and see:
const options = {
context: this.options.srcDir,
eslintPath: 'eslint',
extensions: ['js', 'ts', 'vue'],
cache: true, // Please make this false!!!
lintDirtyModulesOnly: true,
...this.options.eslint,
...moduleOptions
}
Confirmed still an issue.
For anyone else suffering. Just specify this config with the module:
['@nuxtjs/eslint-module', { cache: false }],
This really impacts all sorts of things since no changes are detected. ESLint will complain about a problem. You'll fix it. Fix it again. Pull your hair out. Remove folders. Etc.
Noticed that the cache file appeared after upgrading. Glad it was eventually simple to fix.
@ricardogobbosouza, can you point us to the fix within eslint-webpack-plugin – I did not find anything mentioning the cache over at https://github.com/webpack-contrib/eslint-webpack-plugin/releases ...
Same problem on my end, did not find a way to fix by upgrading
I tried to disable the cache setting today, and it suddenly deletes my entire project.
So, before modifying the settings, save a backup might be a good idea.