Import vue from 'vue 'import app from '. /app. vue 'import router from '. /router 'new vue ({El: '# app', render: H => H (APP), router })
When the above Code is run with eslint verification (the code is in the src/Main. js file), an error is reported.
? Http://eslint.org/docs/rules/no-new do not use 'new' for side effects
Src/Main. JS: 8: 1
New vue ({
There are two ways to solve this problem:
Method 1: Define a variable XXX (which can be any value) to receive new vue
Let xxx = new vue ({El: '# app', render: H => H (APP), router}) vue. Use ({XXX })
Method 2: add a line of gaze above the new vue so that eslint does not check "no-new"
Import vue from 'vue 'import app from '. /app. vue 'import router from '. /router '/* eslint-Disable no-New */New vue ({El:' # app', render: H => H (APP), router })
Reference blogs and comments
Https://www.cnblogs.com/xzma/p/7727412.html
Two Methods for verifying do not use 'new' for side effects in vue project eslint