To run eslint on the src folder, we will need a new script in the package.json:
"eslint": "eslint --ext .js,.jsx,.vue src"
You should note some errors in the console:
Some of those issues can be fixed by ESLint by adding the --fix argument to the preceding eslint command:
"eslint": "eslint --ext .js,.jsx,.vue src --fix"
Run it again, and you should see only one error remaining:
ESLint tells us we shouldn't create new objects without keeping their reference in a variable. If we look at the corresponding code, we see that we indeed create a new instance of Vue in the main.js file:
new Vue({
el: '#app',
router,
store,
...App,
})
If you look at the ESLint error, you can see the code of the rule--no-new. You can open the https://eslint.org/ website and type it in the search field to get the rule definition. If it's a rule added by a plugin, it should have the name of the plugin followed by a slash, for example, vue/require-v-for-key.
This code is written as intended, since this is the standard way of declaring a Vue app. So, we need to disable this rule for this specific line of code by adding a special comment just before:
// eslint-disable-next-line no-new
new Vue({
...
})