Vue project ESlint syntax error approach issues

 

First, create a configuration item named .prettierrc formatted file in the project root directory, the file format is json format.

semi: falae end of the line is true format semicolon, false without semicolon

singleQuote: true true to format a single quote based

{
  "semi": false,
  "singleQuote": true
}

 

 


 

Eslint disable a rule:

Open the file in the project directory .eslintrc.js

Add error in the rules of the object attributes, and is set to 0, to disable the item.

In general error of error: behind a brace, paste the contents of the parentheses down and place the reels.

Case:

Failed to compile.

./src/components/Login.vue
Module Error (from ./node_modules/.pnpm/registry.npm.taobao.org/eslint-loader/[email protected][email protected]/node_modules/eslint-loader/index.js):
error: Extra semicolon (semi) at src/components/Login.vue:54:51:

An example with this error: error in brackets behind this there is a semi semi copy it, open the project root directory .eslintrc.js file

module.exports = {
  root: true,
  env: {
    node: true
  },
  'extends': [
    'plugin:vue/essential',
    '@vue/standard'
  ],
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
  },
  parserOptions: {
    parser: 'babel-eslint'
  }
}

 Here rules, adding a line behind 'semi': 0

module.exports = {
  root: true,
  env: {
    node: true
  },
  'extends': [
    'plugin:vue/essential',
    '@vue/standard'
  ],
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'semi':0
  },
  parserOptions: {
    parser: 'babel-eslint'
  }
}

So that it can disable a eslint grammar test.

 

 

Guess you like

Origin www.cnblogs.com/liea/p/11794851.html