Linting fails with infinite loop
gabaum10 opened this issue · comments
I was hoping the next few beta releases would resolve this, however beta.3 doesn't seem to do it. When I add the plugin to my eslint config, I'm getting a loop of the following error until it fails:
(node:18696) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 VElement listeners added. Use emitter.setMaxListeners() to increase limit
error Command failed with exit code 1.
the eslintrc.js file looks like this:
// https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
jquery: true
},
globals: {
google: true
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/recommended',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
],
// required to lint *.vue files
plugins: [
'vue',
'vuetify'
],
// add your custom rules here
rules: {
// vuetify helper
'vuetify/no-deprecated-classes': 'error',
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
"indent": 0,
'curly': ['error', 'all'],
// vue settings
'vue/no-v-html': 0,
'vue/require-default-prop': ['error'],
'vue/script-indent':[
"error",
2,
{
"baseIndent": 1,
"switchCase": 1,
}
],
'vue/html-indent':[
"error",
2
],
"vue/singleline-html-element-content-newline": ["error", {
"ignoreWhenNoAttributes": true,
"ignoreWhenEmpty": true
}],
"vue/component-name-in-template-casing": ["error", "kebab-case"],
"vue/html-closing-bracket-newline": ["error", {
"singleline": "never",
"multiline": "always"
}],
"vue/max-attributes-per-line": ["error", {
"singleline": 1,
"multiline": {
"max": 1,
"allowFirstLine": false
}
}],
"vue/attributes-order": ["error", {
"order": [
"DEFINITION",
"LIST_RENDERING",
"CONDITIONALS",
"RENDER_MODIFIERS",
"GLOBAL",
"UNIQUE",
"TWO_WAY_BINDING",
"OTHER_DIRECTIVES",
"OTHER_ATTR",
"EVENTS",
"CONTENT"
]
}],
"vue/no-multi-spaces": ["error", {
"ignoreProperties": false
}],
"vue/order-in-components": ["error", {
"order": [
"el",
"name",
"parent",
"functional",
["delimiters", "comments"],
["components", "directives", "filters"],
"extends",
"mixins",
"inheritAttrs",
"model",
["props", "propsData"],
"data",
"computed",
"watch",
"LIFECYCLE_HOOKS",
"methods",
["template", "render"],
"renderError"
]
}],
"vue/multiline-html-element-content-newline": ["error"],
"vue/html-closing-bracket-spacing": ["error"]
}
}
Are one of the other rules interfering with it?
I should mention, this is a massive project with hundreds of components and supporting JS files. Is there a legit memory leak somewhere in the plugin code?
Possible EventEmitter memory leak detected. 11 VElement listeners added
Is there a legit memory leak somewhere in the plugin code?
It's possible, but that message doesn't necessarily indicate it. It's used in the Vuetify monorepo with >800 components without a problem.
Can you try installing vue-eslint-parser@^6.0.4
and running TIMING=1 yarn lint
?
Oh yeah I'm assuming you're using the latest versions of eslint and eslint-plugin-vue too ofc.
@KaelWD alrigth so I upgraded that stuff and ran the TIMING=1 yarn lint
. No luck. It's still throwing the same error.
Here is the output:
.
.
.
(node:31367) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 VElement listeners added. Use emitter.setMaxListeners() to increase limit
(node:31367) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 VElement listeners added. Use emitter.setMaxListeners() to increase limit
Rule | Time (ms) | Relative
:----------------------------|----------:|--------:
import/no-duplicates | 2532.719 | 28.6%
vue/no-duplicate-attributes | 1753.095 | 19.8%
vue/script-indent | 740.195 | 8.4%
no-duplicate-case | 548.585 | 6.2%
no-unused-vars | 243.507 | 2.8%
keyword-spacing | 137.541 | 1.6%
no-extra-parens | 129.947 | 1.5%
key-spacing | 125.033 | 1.4%
no-unmodified-loop-condition | 103.327 | 1.2%
camelcase | 95.144 | 1.1%
error Command failed with exit code 1.
What's interesting is the lint rules actually do get checked and correctly error, way up in the terminal output. I output it to a file and I can see them all. However, when I try to run the command with the --fix command, the JS heap overflows.
Do I need to specify anything to use the local version of vue-eslint-parser
, or will the eslint-plugin-vue
automatically pick it up? (talk about a confusing set of plugins that is.) It looks like the eslint-plugin-vue
is dependent on the vue-eslint-parser
? Is that correct?
For the record, this is what I'm seeing when I try to run --fix
:
<--- Last few GCs --->
[1562:0x417ccc0] 28351 ms: Mark-sweep 1357.5 (1450.7) -> 1343.1 (1451.9) MB, 741.2 / 0.0 ms (average mu = 0.158, current mu = 0.070) allocation failure scavenge might not succeed
[1562:0x417ccc0] 29146 ms: Mark-sweep 1358.8 (1451.9) -> 1343.9 (1452.4) MB, 728.5 / 0.0 ms (average mu = 0.122, current mu = 0.083) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x35f672d5be1d]
Security context: 0x34084ec9e6e9 <JSObject>
1: split [0x34084ec906c9](this=0x34084ecc2889 <String[4]: init>,0x32904e186629 <String[1]: .>)
2: matches [0x22bb5a6fe9e1] [/home/gabaum10/Development/gws/veoci-client/node_modules/esquery/esquery.js:~50] [pc=0x35f672ddb46c](this=0x21ea7551ad81 <JSGlobal Object>,node=0x3dbe23dd8691 <Node map = 0x2902a03a8b1>,selector=0x3332d4962951 <Object map = 0x29...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x8dc510 node::Abort() [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
2: 0x8dc55c [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
3: 0xad9b5e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
4: 0xad9d94 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
5: 0xec7bf2 [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
6: 0xec7cf8 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
7: 0xed3dd2 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
8: 0xed4704 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
9: 0xed7371 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
10: 0xea03c8 v8::internal::Factory::AllocateRawWithAllocationSite(v8::internal::Handle<v8::internal::Map>, v8::internal::PretenureFlag, v8::internal::Handle<v8::internal::AllocationSite>) [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
11: 0xead4c5 v8::internal::Factory::NewJSArray(v8::internal::ElementsKind, v8::internal::PretenureFlag) [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
12: 0xead5d1 v8::internal::Factory::NewJSArrayWithElements(v8::internal::Handle<v8::internal::FixedArrayBase>, v8::internal::ElementsKind, int, v8::internal::PretenureFlag) [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
13: 0x1180e9c v8::internal::Runtime_StringSplit(int, v8::internal::Object**, v8::internal::Isolate*) [/home/gabaum10/.nvm/versions/node/v10.15.3/bin/node]
14: 0x35f672d5be1d
Aborted (core dumped)
error Command failed with exit code 134.
Looks potentially related to this? vuejs/eslint-plugin-vue#929
Question: what version of Node are you running?
I'm starting to suspect those warnings don't really have anything to do with the underlying problem. At least not directly. The key is I can't run --fix. The linting does indeed run. I verified in our CI environment where all the output is available. The warnings just look like noise.
Confirmed: Those are just noise. The OOM failure was because I needed to allot some more to the node runtime. I guess including the vuetify eslint plugin pushed it over the edge. Once I did that, the --fix
worked and it went along its merry way. I think your assessment is correct in the eslint-plugin-vue
is using the incorrect version of vue-eslint-parser
.
Ah righto that's a bit of a mess. I can run a memory profile and see if I'm doing something dumb to cause the OOM.
I think I'm experiencing this issue too, though my error message is slightly different:
yarn lint
yarn run v1.16.0
$ vue-cli-service lint
DONE No lint errors found!
(node:5960) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 VElement listeners added. Use emitter.setMaxListeners() to increase limit
(displayed x 12 times)
Done in 6.72s.
There's no error when eslint-plugin-vuetify
is disabled. I'll plan to wait for an update to eslint-plugin-vue
to see if that resolves it.
You can safely ignore that one, it doesn't affect anything.
as i tried to use this plugin i got it's impossible to upgrade from 1.5.x to 2.x, as a result of that im doing all the upgrade manually , coz i'm getting error after error even i left my project a weeks to resolve that problem , its much better to take these weeks to do it manually and save a time.
i have a similar problem.
If i delete 'vue/html-indent': ['error', 2] - the problem is being solved
Again, the MaxListenersExceededWarning can be safely ignored.