ESlint + VSCode automatic formatting code (2019)

More Articles

Here Insert Picture Description
This paper made with Vue demonstration projects.
To ESlint the election, after downloading the dependency, open the project with VSCode When you create a project using the Vue CLI.
Plug ESLint, then File -> Preference -> Settings (if installed Chinese plug-in package should be the File -> Options -> User),
search eslint, click Edit in setting.json
Here Insert Picture Description
Add the following options to a profile

"eslint.autoFixOnSave": true,
"eslint.validate": [
    {
        "language": "vue",
        "autoFix": true
    },
    {
        "language": "html",
        "autoFix": true
    },
    {
        "language": "javascript",
        "autoFix": true
    },
    {
        "language": "typescript",
        "autoFix": true
    },
],

After configuring, VSCode will be based at your current Vue project .eslintrc.jsto verify and document formatting code rules.
PS: automatic formatting codes triggered automatically when you save the current test as well as the TS and JS files JS code vue no problem, html and
vue of the template is not valid.

Guess you like

Origin www.cnblogs.com/woai3c/p/11951694.html