Get the App
SLTechnology News&Howtos  ›  Development  › 

How to cancel the strict mode in vue

Shulou Source: shulou.com Published: 2022-05-31 22:40:12 09月12日 Update

This article introduces the knowledge of "how to cancel the strict mode in vue". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

How to cancel the strict mode

If you encounter the following errors while working on a project:

Solution.

There will be a separate eslintrc.js file in the 1.vue cli4 project, and this js file contains the configuration items of the code specification. You can try to comment out'@ vue/standard', to turn off the Eslint syntax specification.

/ /'@ vue/standard'

Restart the project npm run serve.

two。 Find vue.config.js. If not, you can create a new one yourself and configure the following

LintOnSave: false,devServer: {overlay: {warning: false,errors: false}}

Restart the project npm run serve.

After this configuration is added, it can be said that eslint is completely closed and there will be no more errors.

3. There is another js configuration file setting.js in the project, which is lintOnSave: true

So the configuration in vue.config.js is invalid

4. Find setting.js and change it to lintOnSave: false

So you can also search the configuration property lintOnSave globally, find out where this sentence is, change it to false and turn off eslint detection completely. If you can't find lintOnSave, you can refer to step 2.

Cancel strict mode, remove format warning

We often encounter a lot of warnings when writing vue code, because we always write yes when we create the code, or hit enter, that is, the strict mode of eslint is installed by default.

When running tests, there will be a lot of warnings and errors, the page display will become very troublesome, if you get used to it, you can develop good code habits.

So how to remove these warnings, turn off strict mode, as long as in the webpack.base.conf.js under the build folder. (config.dev.useEslint? [createLintingRule ()]: []), comment out, and then restart the project.

Note: after commenting, you must remember to run a project again, otherwise you will still follow the original rules.

This is the end of the content of "how to cancel the strict Mode in vue". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Project mode configuration code file content time comments more knowledge practicality learning and then that is information overall situation approach dilemma actually Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Docker macOS Apple Redmi