Project start vue error: Expected indentation of 4 spaces but found 6

Original link: https: //blog.csdn.net/yan263364/article/details/80499435

problem:

Beginning with a small project to practice hand with vue-cli project initialization, directly installed everything, as vue-router, ESLint, unit tests and so on, there were only knows what vue-router yes.
The question is, when vue page write code, command-line newspaper a lot wrong, almost all Expected indentation of 4 spaces but found 6 like this


The original solution:

Read the newspaper wrong, simply delete the extra space. However, this issue too much, just use the Tab key will have this wrong. At first I thought vue detection code is too strict, the Tab key on the editor of the original four spaces instead of two spaces, no this problem. Ah, the results are looking very uncomfortable, accustomed to the four spaces wrap.

 

result:

Would like to exchange for four spaces, I learned that when the initial project, the default installation ESLint (ESLint is a grammar rules and code style checking tool that can be used to ensure write grammatically correct, unified style code) reasons, closed ESLint method :
find the build file in the project folder vue -> webpack.base.conf.js -> module, modified as follows:

Module: { 
    rules: [ 
      // to comment out this line, close to eslint 
      // ... (config.dev.useEslint [createLintingRule ()]:? []), 
      { 
        the Test: /\.vue$/ , 
        Loader: 'VUE-Loader' , 
        Options: vueLoaderConfig 
      }, 
      { 
        Test: /\.js$/ , 
        Loader: 'Babel-Loader' , 
        the include: [Resolve ( 'the src'), Resolve ( 'Test'), Resolve ( 'the node_modules / WebPACK-dev-Server / Client' )] 
      }

 

Guess you like

Origin www.cnblogs.com/tyrd/p/11375336.html