1. Close eslint
This is just the way to close the Vue cli scaffold. In fact, it is very simple to build/webpack.base.conf.js
Just comment out the eslint rules in the configuration file.
module: {
rules: [
// {
// test: /\.(js|vue)$/,
// loader: 'eslint-loader',
// enforce: 'pre',
// include: [resolve('src'), resolve('test')],
// options: {
// formatter: require('eslint-friendly-formatter')
// }
// },
...
]
...
}
2. Modify the syntax detection of eslint. The file is the. eslintrc.js file in the root directory (the rules are written in rules)
Format:
rules: {
"Rule name": [Regular value, Rule configuration]
}
Regular values:
"off" or 0 / / close rule "warn" or 1 / / as a warning in open rules (does not affect exit code) "Error" or 2 / / treat the rule as an error (1 when the exit code is triggered)
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
//Set "script" (default) or "module" if your code is a module in 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 functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
"no-unused-vars": [2, {
// Allow declaration of unused variables
"vars": "local",
// Parameter not checked
"args": "none"
}],
// Closing statement force semicolon end
"semi": [0],
//No more than 100 empty lines
"no-multiple-empty-lines": [0, {"max": 100}],
//Turn off disable mixing tab s and spaces
"no-mixed-spaces-and-tabs": [0],
}
}
3. eslint rule configuration parameters
"no-alert": 0,//Prohibition of use alert confirm prompt
"no-array-constructor": 2,//Array constructor prohibited
"no-bitwise": 0,//Bitwise operators are prohibited
"no-caller": 1,//Prohibition of use arguments.caller or arguments.callee
"no-catch-shadow": 2,//prohibit catch Clause parameter has the same name as an external scope variable
"no-class-assign": 2,//Prohibit assigning to class
"no-cond-assign": 2,//Prohibit using assignment statements in conditional expressions
"no-console": 2,//Prohibition of use console
"no-const-assign": 2,//Prohibition of amendment const Declared variables
"no-constant-condition": 2,//Prohibit constant expressions in conditions if(true) if(1)
"no-continue": 0,//Prohibition of use continue
"no-control-regex": 2,//Prohibit using control characters in regular expressions
"no-debugger": 2,//Prohibition of use debugger
"no-delete-var": 2,//Not right var Declared variable usage delete Operator
"no-div-regex": 1,//Regular expressions that look like division cannot be used/=foo/
"no-dupe-keys": 2,//Duplicate keys are not allowed when creating object literals {a:1,a:1}
"no-dupe-args": 2,//Function arguments cannot be repeated
"no-duplicate-case": 2,//switchMediumcaseLabel cannot be repeated
"no-else-return": 2,//IfifThere arereturn,You can't follow meelseSentence
"no-empty": 2,//Content in block statement cannot be empty
"no-empty-character-class": 2,//In regular expressions[]Content cannot be empty
"no-empty-label": 2,//Do not use empty label
"no-eq-null": 2,//Prohibition against null Use==or!=operator
"no-eval": 1,//Prohibition of use eval
"no-ex-assign": 2,//Forbid catch Exception parameter assignment in statement
"no-extend-native": 2,//No extension native object
"no-extra-bind": 2,//Disable unnecessary function binding
"no-extra-boolean-cast": 2,//No unnecessary bool Transformation
"no-extra-parens": 2,//Do not allow unnecessary brackets
"no-extra-semi": 2,//No extra colons
"no-fallthrough": 1,//prohibit switch Pierce through
"no-floating-decimal": 2,//Do not omit0 .5 3.
"no-func-assign": 2,//Prohibit duplicate function declaration
"no-implicit-coercion": 1,//Disable implicit conversion
"no-implied-eval": 2,//Do not use implicit eval
"no-inline-comments": 0,//Prohibit in line remarks
"no-inner-declarations": [2, "functions"],//Prohibit the use of declarations (variables or functions) in block statements
"no-invalid-regexp": 2,//Suppress invalid regular expressions
"no-invalid-this": 2,//Prohibit invalid this,Can only be used in constructors, classes, object literals
"no-irregular-whitespace": 2,//Can't have irregular spaces
"no-iterator": 2,//Prohibition of use__iterator__ attribute
"no-label-var": 2,//labelName cannot be combined with var Declared variable names are the same
"no-labels": 2,//Prohibited label declaration
"no-lone-blocks": 2,//Suppress unnecessary nested blocks
"no-lonely-if": 2,//prohibitelseOnlyifSentence
"no-loop-func": 1,//Prohibit the use of functions in loops (if no reference to external variables does not form closures)
"no-mixed-requires": [0, false],//Declaration type cannot be mixed when declaring
"no-mixed-spaces-and-tabs": [2, false],//Prohibition of mixing tab And spaces
"linebreak-style": [0, "windows"],//Line changing style
"no-multi-spaces": 1,//Can't use extra space
"no-multi-str": 2,//String cannot be used\Line feed
"no-multiple-empty-lines": [1, {"max": 2}],//No more than empty lines2That's ok
"no-native-reassign": 2,//Cannot rewrite native object
"no-negated-in-lhs": 2,//in Left side of operator cannot have!
"no-nested-ternary": 0,//Do not use nested binomial operations
"no-new": 1,//No use new No assignment after constructing an instance
"no-new-func": 1,//Prohibition of use new Function
"no-new-object": 2,//Prohibition of use new Object()
"no-new-require": 2,//Prohibition of use new require
"no-new-wrappers": 2,//Prohibition of use new Create a wrapper instance, new String new Boolean new Number
"no-obj-calls": 2,//You cannot call built-in global objects, such asMath() JSON()
"no-octal": 2,//Octal numbers are not allowed
"no-octal-escape": 2,//Octal escape sequence prohibited
"no-param-reassign": 2,//Do not reassign parameters
"no-path-concat": 0,//nodeNot available in__dirname or__filename Make path splicing
"no-plusplus": 0,//Prohibition of use++,--
"no-process-env": 0,//Prohibition of use process.env
"no-process-exit": 0,//Prohibition of use process.exit()
"no-proto": 2,//Prohibition of use__proto__attribute
"no-redeclare": 2,//Do not declare variables repeatedly
"no-regex-spaces": 2,//Prohibit multiple spaces in regular expression literals /foo bar/
"no-restricted-modules": 0,//If the specified module is disabled, an error will be reported
"no-return-assign": 1,//return Cannot have assignment expression in statement
"no-script-url": 0,//Prohibition of usejavascript:void(0)
"no-self-compare": 2,//Can't compare themselves
"no-sequences": 0,//Comma operator prohibited
"no-shadow": 2,//A variable in an external scope cannot have the same name as a variable or parameter in the scope it contains
"no-shadow-restricted-names": 2,//The restriction identifier specified in strict mode cannot be used as the variable name when declaring
"no-spaced-func": 2,//Function name and()No space between
"no-sparse-arrays": 2,//Sparse arrays are prohibited, [1,,2]
"no-sync": 0,//nodejs Disable synchronization method
"no-ternary": 0,//Disallow the use of binocular operators
"no-trailing-spaces": 1,//No spaces after the end of a line
"no-this-before-super": 0,//In callsuper()Not available before this orsuper
"no-throw-literal": 2,//Do not throw literal errors throw "error";
"no-undef": 1,//Cannot have undefined variables
"no-undef-init": 2,//Variable initialization cannot be directly assigned as undefined
"no-undefined": 2,//Out of commission undefined
"no-unexpected-multiline": 2,//Avoid multiline expressions
"no-underscore-dangle": 1,//Identifier cannot be_Beginning or end
"no-unneeded-ternary": 2,//Prohibit unnecessary nesting var isYes = answer === 1 ? true : false;
"no-unreachable": 2,//Can't have code that can't be executed
"no-unused-expressions": 2,//Disable useless expressions
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],//Cannot have variables or parameters that are not used after declaration
"no-use-before-define": 2,//Cannot be used before it is defined
"no-useless-call": 2,//No unnecessary call and apply
"no-void": 2,//Prohibit void Operator
"no-var": 0,//Prohibit var,use let and const replace
"no-warning-comments": [1, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],//No warning remarks
"no-with": 2,//Prohibit 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,//=>Before/Rear brackets
"accessor-pairs": 0,//Use in objects getter/setter
"block-scoped-var": 0,//Used in block statements var
"brace-style": [1, "1tbs"],//Brace style
"callback-return": 1,//Avoid calling callbacks more than once
"camelcase": 2,//Mandatory hump naming
"comma-dangle": [2, "never"],//The end of an object literal measure cannot have a comma
"comma-spacing": 0,//Space before and after comma
"comma-style": [2, "last"],//Comma style, at the beginning or the end of a line
"complexity": [0, 11],//Cycle complexity
"computed-property-spacing": [0, "never"],//Whether to allow the calculated key name or not
"consistent-return": 0,//return Allow to omit after
"consistent-this": [2, "that"],//thisalias
"constructor-super": 0,//Non derived classes cannot callsuper,Derived class must callsuper
"curly": [2, "all"],//Must use if(){} Medium{}
"default-case": 2,//switchStatement must have default
"dot-location": 0,//The position of the object accessor, at the beginning or the end of the line when wrapping
"dot-notation": [0, { "allowKeywords": true }],//Avoid unnecessary square brackets
"eol-last": 0,//File ends with a single line break
"eqeqeq": 2,//Must use full class
"func-names": 0,//Function expression must have a name
"func-style": [0, "declaration"],//Function style, only function declaration can be used/Function expression
"generator-star-spacing": 0,//generator function *Space before and after
"guard-for-in": 0,//for inRecycling needsifSentence filtering
"handle-callback-err": 0,//nodejs Handling errors
"id-length": 0,//Variable name length
"indent": [2, 4],//Indent style
"init-declarations": 0,//Initial value must be assigned when declaring
"key-spacing": [0, { "beforeColon": false, "afterColon": true }],//Spaces before and after colons in object literals
"lines-around-comment": 0,//Before the trip/Post remark
"max-depth": [0, 4],//Nested block depth
"max-len": [0, 80, 4],//Maximum string length
"max-nested-callbacks": [0, 2],//Callback nesting depth
"max-params": [0, 3],//Function can only have at most3A parameter
"max-statements": [0, 10],//There are at most a few declarations in a function
"new-cap": 2,//Function name must be capitalized with new Method, the first line must be lowercase without new Mode call
"new-parens": 2,//newMust be parenthesized
"newline-after-var": 2,//Need a blank line after variable declaration
"object-curly-spacing": [0, "never"],//Allow unnecessary spaces in braces
"object-shorthand": 0,//Forced object literal abbreviation syntax
"one-var": 1,//declaration of continuity
"operator-assignment": [0, "always"],//Assignment Operators += -=What?
"operator-linebreak": [2, "after"],//Is the operator at the end of a line or at the beginning of a line when wrapping
"padded-blocks": 0,//Whether the first and last line of a block statement should be empty
"prefer-const": 0,//Be the first choice const
"prefer-spread": 0,//Preferred expansion operation
"prefer-reflect": 0,//Be the first choiceReflectMethod
"quotes": [1, "single"],//Quotation mark type `` "" ''
"quote-props":[2, "always"],//Whether attribute names in object literals force double quotes
"radix": 2,//parseInt Second parameter must be specified
"id-match": 0,//Naming detection
"require-yield": 0,//Generator functions must haveyield
"semi": [2, "always"],//Statement force semicolon end
"semi-spacing": [0, {"before": false, "after": true}],//Space before and after semicolon
"sort-vars": 0,//Sort on variable declaration
"space-after-keywords": [0, "always"],//Do you want to leave a space after the keyword
"space-before-blocks": [0, "always"],//Blocks that do not start with a new line{Do you want a space in front
"space-before-function-paren": [0, "always"],//Do you want spaces before parentheses when defining functions
"space-in-parens": [0, "never"],//Do you want spaces in parentheses
"space-infix-ops": 0,//Do you want spaces around infix operators
"space-return-throw-case": 2,//return throw caseDo you want a space after it
"space-unary-ops": [0, { "words": true, "nonwords": false }],//Before unary operator/Do you want to add space after
"spaced-comment": 0,//Should there be any spaces or something in the annotation style
"strict": 2,//Use strict mode
"use-isnan": 2,//Do not use when comparingNaN,Only use isNaN()
"valid-jsdoc": 0,//jsdocrule
"valid-typeof": 2,//Legal must be used typeof Value
"vars-on-top": 2,//varMust be on top of scope
"wrap-iife": [2, "inside"],//Bracket style for immediate function expression execution
"wrap-regex": 0,//Regular expression literals enclosed in parentheses
"yoda": [2, "never"]//Prohibited Yoda conditions