Turn off the maddening Eslint syntax detection configuration method _vue

Source: Internet
Author: User
Tags bitwise generator mixed vars

Just start the small partner is not a blank error line error errors. Do you feel that you are too limited to lose your freedom of mind. After the torture found a good article to remove the Eslint grammar detection restrictions, as a learning note excerpted from Segmentfault

I'm not opposed to these grammar tests, but like so many anti-personal intentions, it really has to be spit out, like the default Eslint rules created by VUE-CLI scaffolding:

No semicolon at the end of the code;

Multiple-line empty lines cannot exist in code

The TAB key is not available and must be replaced with two spaces

A variable declared but not used cannot exist in the code

The above rules personally believe that the real anti-human. Debugging the code is too difficult. Close Eslint

Here only said Vue-cli scaffolding closure method, in fact very simple, is the Build/webpack.base.conf.js configuration file Eslint rules comment out.

Module: {
    rules: [
      //{
      //   Test:/\. ( Js|vue) $/,
      //   loader: ' Eslint-loader ',//   enforce: ' pre ',//   include: [Resolve (' src '), Resolve (' test ')],
      //   options: {
      //     formatter:require (' eslint-friendly-formatter ')
      //   }
      // },
      
      ...
     ]
     ...
   }

If you want to keep the Eslint grammar test, then remove the rules that don't fit your habits.

The configuration file is in the project root, and the filename is named in. eslintrc.*.

Module.exports = {
  root:true,
  parser: ' Babel-eslint ',
  parseroptions: {
    //Set script (default) or ' module ' If your code is a module in the ECMAScript.
    sourcetype: ' Module '
  },
  env: {
    browser:true,
  },
  //https://github.com/feross/standard/ Blob/master/rules.md#javascript-standard-style
  extends: ' Standard ',
  //required to lint *.vue files
  Plugins: [
    ' HTML '
  ],
  //Add your custom rules here
  ' rules ': {
    //Allow paren-less arrow function S
    ' Arrow-parens ': 0,
    //Allow async-await
    ' generator-star-spacing ': 0,
    //Allow debugger Development
    ' No-debugger ': Process.env.NODE_ENV = = ' Production ' 2:0,
    ' no-unused-vars ': [2, { 
      // Allow declaration not to use variable
      "VARs": "local",////
      parameter does not check
      "args": "None" 
    }],
    //Close statement Force semicolon end
    "semi": [0],
    //blank line can be up to 100 lines
    "No-multiple-empty-lines": [0, {"Max":}],
    ///Turn off bar tab and Space
    No-mixed-spaces-and-tabs ": [0],
  }
}

Where the rules are configured

Configuration parameters

Rules: {
    "rule name": [Rule value, rule configuration]
}

Rule value:

"Off" or 0    //Close the rule turns off
"warn" or 1    //In the open rule as a warning (does not affect the exit code)
"error" or 2    //The rule as an error (exit code when triggering 1
Specific references

Https://eslint.org/docs/rules/no-unused-vars

List of common rules

The following list of rules comes from the network

"No-alert": 0,//prohibit the use of alert confirm Prompt "No-array-constructor": 2,//prohibit the use of the array constructor "No-bitwise": 0,//prohibit the use of bitwise operator "No-caller" : 1,//prohibits the use of Arguments.caller or Arguments.callee "No-catch-shadow": 2,//prohibits catch clause arguments with the same name as an external scope variable "no-class-assign": 2,// Prohibit assigning "no-cond-assign" to classes: 2,//prohibit the use of assignment statements "no-console" in conditional expressions: 2,//prohibit the use of the console "No-const-assign": 2,//prohibit modifying const declared variables " No-constant-condition ': 2,//prohibit the use of constant expression if (true) if (1) "No-continue" in a condition: 0,//prohibit the use of continue "No-control-regex": 2,// Prohibit the use of control character "No-debugger" in regular Expressions: 2,//prohibit the use of debugger "No-delete-var": 2,//cannot use the delete operator "No-div-regex" on variables declared by Var: 1,// You cannot use a regular expression that looks like division/=foo/"No-dupe-keys": 2,//does not allow the key to repeat {a:1,a:1} "No-dupe-args" When the object literal is created: 2,//function parameters cannot be duplicated "no-duplicate-case ": The case label in 2,//switch cannot repeat" No-else-return ": 2,//If there is a return inside the IF statement, you cannot follow the Else statement" No-empty ": the contents of the 2,//block statement cannot be null.
No-empty-character-class ": 2,//[] content in regular expression cannot be empty" No-empty-label ": 2,//prohibit use of NULL label" No-eq-null ": 2,//prohibit null using = = or!= operator "No-eval": 1,//prohibit the use of eval "no-ex-assign": 2,//prohibit assigning "no-extend-native" to exception parameters in Catch statements: 2,//prohibit extended NATIve object "No-extra-bind": 2,//Prohibit unnecessary function binding "no-extra-boolean-cast": 2,//prohibit unnecessary bool conversion "No-extra-parens": 2,//Prohibit unnecessary brackets "
No-extra-semi ": 2,//prohibits redundant colons" no-fallthrough ": 1,//prohibits switch penetration through" no-floating-decimal ": 2,//prohibits omitting 0.5 3 in floating-point numbers. "No-func-assign": 2,//prohibit duplicate function declaration "No-implicit-coercion": 1,//prohibit implicit conversion of "no-implied-eval": 2,//prohibit use of implicit eval " No-inline-comments ": 0,//Prevent inline Memo" no-inner-declarations ": [2," functions "],//prohibit the use of declarations (variables or functions)" no-invalid-regexp "in block statements: 2,//disables invalid regular expression "No-invalid-this": 2,//prohibits invalid this, can only be used in constructors, classes, object literal "no-irregular-whitespace": 2,//cannot have irregular spaces " No-iterator ": 2,//prohibit the use of the __iterator__ property" No-label-var ": 2,//label name cannot be the same as the variable name of VAR declaration" No-labels ": 2,//prohibit label declaration" No-lone-blocks ": 2,//prohibits unnecessary nesting of" no-lonely-if ": 2,//prohibits only if statements within the Else statement" No-loop-func ": 1,// Prohibit the use of functions in loops (if no external variables are formed without closures) "no-mixed-requires": [0, false],//declaration cannot be mixed with declaring type ' no-mixed-spaces-and-tabs ': [2, false], Prohibit mixing tab and space "Linebreak-style": [0, "Windows"],//Wrapping Style "no-multi-spaces": 1,//cannot use extra space "No-multi-str": 2,//string cannot be replaced with \ linefeed No-multiple-empty-lines ": [1, {" MaX ": 2}],//no more than 2 lines" no-native-reassign ": 2,//cannot override native object" NO-NEGATED-IN-LHS ": the left side of the 2,//in operator cannot have! "No-nested-ternary": 0,//prohibits the use of nested three-mesh operations "no-new": 1,//prohibits the assignment of "No-new-func" after an instance is constructed with new: 1,//prohibit the use of the new Function " No-new-object ": 2,//prohibit the use of the new object ()" No-new-require ": 2,//prohibit the use of new require" no-new-wrappers ": 2,//prohibit the use of new to create wrapper instances, new String New Boolean new number "No-obj-calls": 2,//cannot invoke a built-in global object, such as math () JSON () "No-octal": 2,//prohibit the use of octal numbers "No-octal-escape" ": 2,//prohibits the use of the octal escape sequence" no-param-reassign ": 2,//disables the assignment of parameters to" No-path-concat ": 0,//node or __dirname cannot be used for path stitching" No-plusplus ": 0,//prohibit the use of ++,--" no-process-env ": 0,//prohibit the use of process.env" No-process-exit ": 0,//prohibit the use of process.exit ()" No-proto ": 2,//prohibit the use of the __proto__ property" No-redeclare ": 2,//prohibit duplicate declaration of variable" no-regex-spaces ": 2,//prohibit the use of multiple spaces in regular expression literals/foo bar/" No-restricted-modules ": 0,//if the specified module is disabled, use the error" No-return-assign ": 1,//return statement cannot have an assignment expression" No-script-url ": 0,// Prohibit the use of javascript:void (0) "No-self-compare": 2,//cannot compare itself "no-sequences": 0,//prohibit the use of the comma operator "No-shadow": 2,//variables in external scopes cannot be wrapped with it"No-shadow-restricted-names" with the same name as a variable or parameter in the containing scope: 2,//the restricted identifier specified in the strict mode cannot be used as the variable name at the time of declaration using "No-spaced-func": 2,//function call time function name and () There can be no space between "no-sparse-arrays": 2,//block sparse array, [1,,2] "No-sync": 0,//nodejs Prohibit synchronization method "No-ternary": 0,//prohibit the use of the three-mesh operator " No-trailing-spaces ": 1,//line ends with no space" no-this-before-super ": 0,//cannot use this or super" No-throw-literal "before calling Super (): 2,/
/prohibit throwing literal error throw "error"; "No-undef": 1,//cannot have undefined variable "no-undef-init": 2,//variable initialization cannot assign value directly to undefined "no-undefined": 2,//cannot use undefined " No-unexpected-multiline ": 2,//avoid Multiline expression" No-underscore-dangle ": 1,//identifier cannot begin or end with _" No-unneeded-ternary ": 2,//Prohibit unnecessary nesting var Isyes = Answer = = 1?
True:false; "No-unreachable": 2,//cannot have code "No-unused-expressions" that cannot be executed: 2,//prohibits unwanted expression "no-unused-vars": [2, {"VARs": "All", "args": " After-used "}],//cannot have a variable or parameter" No-use-before-define "that is not used after declaration: 2,//cannot use" No-useless-call "before definition: 2,//prohibit unnecessary call and apply No-void ": 2,//disables the void operator" No-var ": 0,//disables Var and uses let and const instead of" no-warning-comments ": [1, {" Terms ": [" Todo "," fixme "," xxx "], "Location": "Start"}],//can not have warning preparedNote "No-with": 2,//Disabled with "array-bracket-spacing": [2, "never"],//allow extra space in Non-empty array "Arrow-parens": 0,//arrow functions are enclosed in parentheses. Arrow-spacing ": 0,//=> Front/rear bracket" accessor-pairs ": 0,//use var in getter/setter" Block-scoped-var ": 0,//block statement in Object Brace-style ": [1," 1tbs "],//curly brace Style" Callback-return ": 1,//avoid multiple invocation of callback or something" CamelCase ": 2,//Forced Hump method named" Comma-dangle ": [2," Never "],//object literal item tail cannot have a comma" comma-spacing ":" Comma-style "before and after the 0,//comma: [2," last "],//comma style, line at the beginning or end of row" complexity ": [0, 11] ,//Cyclic complexity "computed-property-spacing": [0, "never"],//whether to allow the calculation of the key name of the "Consistent-return": 0,//return after the Allow omitted " Consistent-this ": [2," that "],//this alias" Constructor-super ": 0,//non-derived classes cannot call super, derived classes must call Super" Curly ": [2," All "],//must use {} "Default-case" in the If () {}: 2,//switch statement must finally have default "Dot-location": 0,//the position of the object accessor, the line at the beginning or the end of the line "dot-notation": [0, {" Allowkeywords ": True}],//avoid unnecessary square brackets" eol-last ": 0,//file ends with a single line break" Eqeqeq ": 2,//must use the congruent" func-names ": the 0,//function expression must have a name" Func-style ": [0," declaration "],//function style, which stipulates that only function declarations/function expressions" generator-star-spacing "can be used: 0,//Generator function * Before and after the space "guard-for-in": 0,//for in loop to filter "Handle-callback-err" with the IF statement: 0,//nodejs processing error "Id-length": 0,//variable name Length " Indent ": [2, 4],//indent style" init-declarations ": 0,//declaration must assign initial value" key-spacing ": [0, {" Beforecolon ": false," Aftercolon ": true}], Object literal is preceded by the space "lines-around-comment" of the colon: 0,//line front/Line fallback note "max-depth": [0, 4],//nesting block Depth "Max-len": [0, 80, 4],//string maximum length] Max-nested-callbacks ": [0, 2],//callback nesting Depth" max-params ": [0, 3],//function can only have 3 parameters" max-statements ": [0, 10],//function has a maximum of several declarations" New-cap ": 2,//function name first line uppercase must be called with new method, first line lowercase must invoke" New-parens "without NEW: 2,//new must be added with parentheses" Newline-after-var ": 2,// Whether the variable declaration requires an empty line of "object-curly-spacing": [0, "Never"],//in curly braces to allow unnecessary spaces "Object-shorthand": 0,//Force object literal abbreviation Syntax "One-var": 1,/ /Continuous Declaration "Operator-assignment": [0, "Always"],//assignment operator + = = what "Operator-linebreak": [2, after "],//line operator at end or beginning of line" Padded-blocks ": 0,//block statement the line at the end of the first line to empty row" Prefer-const ": 0,//Preferred Const" Prefer-spread ": 0,//preferred expand Operation" Prefer-reflect ": 0,// Preferred reflect method "quotes": [1, "single"],//Quote type ' "" "" "Quote-props": [2, "Always"],//object literalWhether the sex name forces double quotes "radix": 2,//parseint must specify the second argument "Id-match": 0,//named Detect "Require-yield": 0,//generator function must have yield "semi": [2, "always"], The statement forces the semicolon to end "semi-spacing": [0, {"Before": false, "after": true}],//semicolon before and after space "sort-vars": Sort when 0,//variable declaration Space-after-keywords ": [0," always "],//after the keyword to empty a grid of" space-before-blocks ": [0," always "],//not to start with a new line block {preceded by a space" Space-before-function-paren ": [0," always "],//function to define the parentheses before the white space" space-in-parens ": [0," never "],//parentheses inside to have no space" Space-infix-ops ": 0,//infix operator around to have a space" space-return-throw-case ": 2,//return throw case to be followed by the space" Space-unary-ops ": [0, {" Words ': true, ' nonwords ': false}],//before/after unary operators without spaces "spaced-comment": 0,//annotation style to have a space or something "strict": 2,//use Strict Mode " Use-isnan ": 2,//to use Nan when comparing, only isNaN ()" Valid-jsdoc ": 0,//jsdoc rule" valid-typeof ": 2,//must use the valid typeof value" Vars-on-top ": 2 ,//var must be placed at the top of the scope "Wrap-iife": [2, "inside"],//immediately executes the parenthesis style "Wrap-regex" of the function expression: 0,//Regular expression literals are wrapped in parentheses "Yoda": [2, never]]//
 Prohibition of conditions of fidelity




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.