eslint
I took over an old VUE project, in which the code style was terrible, the level was uneven, and the code was moved casually, all kinds of problems. So use ESLint to consolidate the code
configuration
Install eslint
npm install --save-dev eslint
Copy the code
Configuration eslint
./node_modules/.bin/eslint --init
Copy the code
Eslint-plugin-vue is required to install the eslint-plugin-vue
npm install --save-dev eslint-plugin-vue
Copy the code
Install eslint – loader
Because you need to use it in WebPack, you need to install eslint-Loader and configure it in the WebPack configuration
npm install --save-dev eslint-loader
Copy the code
Configuration webpack
module: {
rules: [{test: /\.(js|vue)$/.loader: 'eslint-loader'.enforce: 'pre'.include: [ resolve('./src/pages/index/modules/newAddPage/')].// Specify the directory to check
options: { // The configuration item arguments here will be passed to esLint's CLIEngine
formatter: require('eslint-friendly-formatter') // Specify a format for error reporting}}}]Copy the code
Eslint Configuration file. Eslintrc.js Initialization status
module.exports = {
"env": {
"browser": true."es6": true
},
"extends": [
"eslint:recommended"."plugin:vue/essential"]."globals": {
"Atomics": "readonly"."SharedArrayBuffer": "readonly"."bus": "readonly"."SERVERURL": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018."sourceType": "module"
},
"plugins": [
"vue"]."rules": {}};Copy the code
.eslintrc.js configuration details
/** ** contains all ESLint rules * use babel-eslint as the parser ** @fixable means this configuration is supported --fix * @off means this configuration is turned off, and the reason for this is explained later */
module.exports = {
parser: 'babel-eslint'.parserOptions: {
ecmaVersion: 2017.sourceType: 'module'.ecmaFeatures: {
// @TODO Deprecated https://eslint.org/docs/user-guide/configuring#deprecated
experimentalObjectRestSpread: true.jsx: true.modules: true}},env: {
browser: true.node: true.commonjs: true.es6: true
},
// Take the current directory as the root directory and no longer look up.eslintrc.js
root: true.rules: {
//
//
// Possible error
// These rules relate to possible syntax or logic errors in JavaScript code
//
// disallow for loops with the wrong direction, such as for (I = 0; i < 10; i--)
'for-direction': 'error'.Getters must have a return value and do not return nothing, such as return;
'getter-return': [
'error',
{
allowImplicit: false}].// Forbid "await" in loops as it is impossible to send multiple asynchronous requests simultaneously
// @off is too strict, sometimes we need to write "await" in the loop
'no-await-in-loop': 'off'.// Disallow comparisons with negative zero
'no-compare-neg-zero': 'error'.// Disallow assignment statements in test expressions unless the assignment statement is enclosed in parentheses
'no-cond-assign': [
'error'.'except-parens'].// Disable console
// The use of @off console is common
'no-console': 'off'.// Disallows constants as test expressions in branch condition judgments, but allows constants as test expressions in loop condition judgments
'no-constant-condition': [
'error',
{
checkLoops: false}].// Disallow the ASCII representation of Ctrl keys in regular expressions, i.e. /\x1f/
// @off will almost never encounter this scenario
'no-control-regex': 'off'.// @fixable disables the debugger
'no-debugger': 'error'.// Disallow arguments with duplicate names in function arguments
'no-dupe-args': 'error'.Disallow duplicate key names in object literals
'no-dupe-keys': 'error'.// Disallow cases of repeated test expressions in switch statements
'no-duplicate-case': 'error'.// Disallow empty blocks and allow catch to be empty blocks
'no-empty': [
'error',
{
allowEmptyCatch: true}].// Disallow empty character sets in regular expressions []
'no-empty-character-class': 'error'.// Disallow reassignment of the first catch argument error
'no-ex-assign': 'error'.// @fixable disallows unnecessary Boolean conversions, such as!! Or a Boolean
'no-extra-boolean-cast': 'error'.// @fixable disallows extra parentheses in function expressions, such as let foo = (function () {return 1})
'no-extra-parens': [
'error'.'functions'].// @fixable disallows extra semicolons
'no-extra-semi': 'error'.// Disallows reassignment of a function declaration, as in:
// function foo() {}
// foo = bar
'no-func-assign': 'error'.// Disallow function declarations in if blocks
'no-inner-declarations': [
'error'.'both'].// Disallow invalid regular expressions in the RegExp constructor
'no-invalid-regexp': 'error'.// Disallow special whitespace (such as full-corner Spaces) except in strings, regular expressions, or template strings
'no-irregular-whitespace': [
'error',
{
skipStrings: true.skipComments: false.skipRegExps: true.skipTemplates: true}].// Disallow Math, JSON or Reflect as function calls directly
'no-obj-calls': 'error'.// Forbid hasOwnProperty, isPrototypeOf or propertyIsEnumerable
// @off hasOwnProperty
'no-prototype-builtins': 'off'.// @fixable disallows consecutive Spaces in regular expressions and must be replaced with /foo {3}bar/
'no-regex-spaces': 'error'.Disallow sequential commas in arrays, such as let foo = [,,]
'no-sparse-arrays': 'error'.// Disallow template string variables in normal strings, such as 'Hello ${name}! '
'no-template-curly-in-string': 'error'.// Disallow unintelligible multi-line expressions such as:
// let foo = bar
// [1, 2, 3].forEach(baz);
'no-unexpected-multiline': 'error'.// Disallow code after return, throw, break, or continue
'no-unreachable': 'error'.// Disallow return, throw, break, or continue in finally
'no-unsafe-finally': 'error'.// @fixable disallows exclamation marks on the left side of the in or instanceof operators, such as if (! key in object)
'no-unsafe-negation': 'error'.// isNaN(foo) must be used instead of foo === NaN
'use-isnan': 'error'.// Comments must conform to the JSDoc specification
// @off Jsdoc is too strict
'valid-jsdoc': 'off'.// Typeof expression comparison objects must be 'undefined', 'object', 'Boolean ', 'number', 'string', 'function' or 'symbol'.
'valid-typeof': 'error'.//
//
Best practices
// These rules help you avoid problems through some best practices
//
// a setter must have a getter, and a getter can have no setter
'accessor-pairs': [
'error',
{
setWithoutGet: true.getWithoutSet: false}].In addition to forEach, the callback must have a return value
'array-callback-return': 'error'.// Treat variables defined by var as block scopes and prohibit use outside of blocks
'block-scoped-var': 'error'.// A reference to this must exist in a non-static method of the class
// @off is too strict
'class-methods-use-this': 'off'./ / ban function cycle complexity more than 20, https://en.wikipedia.org/wiki/Cyclomatic_complexity
'complexity': [
'error',
{
max: 20}].// Disallows functions from returning different types of values on different branches
// @off is too strict
'consistent-return': 'off'.// @fixable if must be followed by {unless there is a single if line
'curly': [
'error'.'multi-line'.'consistent'].// Switch statements must have default
// @off is too strict
'default-case': 'off'.// @fixable chain calls must be placed at the beginning of the second line, not at the end of the first line
'dot-location': [
'error'.'property'].// @fixable disallows foo['bar'], must be written foo.bar
// @off Can be more uniform when writing a list of attributes
'dot-notation': 'off'.// @fixable must use === or! ==, do not use == or! =, except when compared with null
'eqeqeq': [
'error'.'always',
{
null: 'ignore'}].// For in must have hasOwnProperty inside
'guard-for-in': 'error'.// Disable alert
// @off alert
'no-alert': 'off'.// Disallow caller or callee
'no-caller': 'error'.// When a variable is defined in a switch case, curly braces must be used to turn the case into a code block
'no-case-declarations': 'error'.// Disallow the beginning of a divisor operator in a regular expression, such as let a = /=foo/
// @off With code highlighting, there is no ambiguity or difficulty in reading such code
'no-div-regex': 'off'.// @fixable disallows return in else, must terminate prematurely instead
Use return in @off else to make the code structure clearer
'no-else-return': 'off'.Empty functions are not allowed unless an empty function is set to the default value of an item
'no-empty-function': [
'error',
{
allow: [
'functions'.'arrowFunctions']}],// Disallow empty {} or [] in destructions
'no-empty-pattern': 'error'.// Disallow foo == null or foo! = null, must use foo === null or foo! == null
// @off foo == null Specifies that foo is not undefined and is not null
'no-eq-null': 'off'.// Disallow eval
'no-eval': 'error'.// Forbid modification of native objects
'no-extend-native': 'error'.// @fixable disallows unnecessary bind
'no-extra-bind': 'error'.// @fixable disables unnecessary labels
'no-extra-label': 'error'.// The switch case must have a break, return or throw
'no-fallthrough': 'error'.// @fixable does not omit 0 when representing decimals, such as.5
'no-floating-decimal': 'error'.// Disallow assignment to global variables
'no-global-assign': 'error'.// @fixable banned!! Operators such as ~ are difficult to understand
// Only allowed!!
'no-implicit-coercion': [
'error',
{
allow: [
'!!!!! ']}],// Prohibit defining variables or declaring functions in global scope
'no-implicit-globals': 'error'.// Disallow passing strings in setTimeout or setInterval, such as setTimeout('alert("Hi! ) ', 100);
'no-implied-eval': 'error'.// Disallow the use of this outside the class
// @off this can be used as an event callback to represent the current element, or a function can use this first, and then call when called later
'no-invalid-this': 'off'.// Disallow __iterator__
'no-iterator': 'error'.// Disable the use of label
'no-labels': 'error'.// Disallow unnecessary {} as code blocks
'no-lone-blocks': 'error'.// Disallow variables defined in body condition statements from functions inside loops, such as:
// for (var i = 0; i < 10; i++) {
// (function () { return i })();
// }
'no-loop-func': 'error'.// Disallow magic numbers
// @off is too strict
'no-magic-numbers': 'off'.// @fixable disallows consecutive Spaces, except before comments, or to align object attributes, variable definitions, import, etc
'no-multi-spaces': [
'error',
{
ignoreEOLComments: true.exceptions: {
Property: true.BinaryExpression: false.VariableDeclarator: true.ImportDeclaration: true}}].// Disallow wrapping strings with \
'no-multi-str': 'error'.// Disallows direct new of a class without assigning
'no-new': 'error'.// Disallow new Function, e.g. Let x = new Function("a", "b", "return a + b");
'no-new-func': 'error'.// Disallow using new to generate String, Number, or Boolean
'no-new-wrappers': 'error'.// Disallow the use of digits starting with 0 to represent octal numbers
'no-octal': 'error'.// Disallow the use of octal escapes
'no-octal-escape': 'error'.// Disallows reassignment of function arguments
'no-param-reassign': 'error'.// Disable __proto__
'no-proto': 'error'.// Disallow variable definitions
'no-redeclare': 'error'.// Disallow the use of the specified object properties
// @off It is used to restrict the use of a specific API
'no-restricted-properties': 'off'.// Disallow assignment in return statements
'no-return-assign': [
'error'.'always'].// Disallow "await" in return statements
'no-return-await': 'error'.// Disallow location.href = 'javascript:void(0)';
'no-script-url': 'error'.// Disallow assigning yourself to yourself
'no-self-assign': 'error'.// Prohibit comparing yourself to yourself
'no-self-compare': 'error'.// Disallow the comma operator
'no-sequences': 'error'.// Disallow throw literals, you must throw an Error object
'no-throw-literal': 'error'.// There must be changes to the loop condition variable within the loop
'no-unmodified-loop-condition': 'error'.// Disallow useless expressions
'no-unused-expressions': [
'error',
{
allowShortCircuit: true.allowTernary: true.allowTaggedTemplates: true}].// @fixable disables useless labels
'no-unused-labels': 'error'.// Disallow unnecessary call or apply
'no-useless-call': 'error'.// Disallow unnecessary string concatenation
'no-useless-concat': 'error'.// Disallow unnecessary escapes
// @off escapes can make code easier to understand
'no-useless-escape': 'off'.// @fixable disallows unnecessary returns
// @off There is no need to restrict return
'no-useless-return': 'off'.// Disallow void
'no-void': 'error'.// Disallow TODO and FIXME in comments
// @off TODO
'no-warning-comments': 'off'.// Disallow use of with
'no-with': 'error'.Error objects, not literals, must be passed in the Reject of a Promise
'prefer-promise-reject-errors': 'error'.// parseInt must be passed a second argument
'radix': 'error'.// Async functions must have await statements
It is common to write @off async function without await, as in the KOA example
'require-await': 'off'.// var must be first in scope
// @off var is not at the top of the list
'vars-on-top': 'off'.Function () {alert('Hello')})()
'wrap-iife': [
'error'.'inside',
{
functionPrototypeMethods: true}].// @fixable must use if (foo === 5) instead of if (5 === foo)
'yoda': [
'error'.'never',
{
onlyEquality: true}].//
//
// Strict mode
// These rules are related to the strict mode directive
//
// @fixable disallows 'strict';
'strict': [
'error'.'never'].//
//
/ / variable
// These rules relate to variable declarations
//
// Variables must be assigned at definition time
// @off it is common to define and then assign
'init-declarations': 'off'.// Disallow the catch argument name to duplicate the defined variable
// @off is too strict
'no-catch-shadow': 'off'.// Disable delete
'no-delete-var': 'error'.// Disallow label names to duplicate defined variables
'no-label-var': 'error'.// Disallow the use of specified global variables
// @off It is used to restrict the use of a specific variable name
'no-restricted-globals': 'off'.// Disallow variable names to duplicate those defined in the upper scope
// @off Most of the time, the function parameter and the pass parameter are the same name
'no-shadow': 'off'.// Disallow reserved words as variable names
'no-shadow-restricted-names': 'error'.// Disallow undefined variables
'no-undef': [
'error',
{
typeof: false}].// @fixable disallows assigning undefined to a variable
'no-undef-init': 'error'.// Disallow reassignment of undefined
'no-undefined': 'error'.// Defined variables must be used
'no-unused-vars': [
'error',
{
vars: 'all'.args: 'none'.caughtErrors: 'none'.ignoreRestSiblings: true}].// Variables must be defined before they are used
'no-use-before-define': [
'error',
{
functions: false.classes: false.variables: false}].//
//
/ / the Node. Js and CommonJS
// These rules relate to code running in Node.js or CommonJS used in browsers
//
// Callback must return immediately after
// @off Limitations
'callback-return': 'off'.// require must be in global scope
// @off conditional loading is common
'global-require': 'off'.// Error in callback must be handled
'handle-callback-err': 'error'.// Do not use Buffer directly
'no-buffer-constructor': 'error'.// Require of the same type must be placed together
// @off is too strict
'no-mixed-requires': 'off'.// disable new require('foo')
'no-new-require': 'error'.// Disallow string concatenation for __dirname or __filename
'no-path-concat': 'error'.// Disallow process.env.node_env
// @off
'no-process-env': 'off'.// Disallow process.exit(0)
// @off
'no-process-exit': 'off'.// Disable the use of the specified module
// @off It is used to restrict the use of a specific module
'no-restricted-modules': 'off'.// Disable node synchronization methods, such as fs.readfilesync
// @off
'no-sync': 'off'.//
//
// Style issues
// These rules are very subjective because of the code style
//
// @fixable configures the newline format before and after the brackets in the array
// @off The configuration item cannot be configured as desired
'array-bracket-newline': 'off'.// The @fixable array does not have Spaces before or after the parentheses
'array-bracket-spacing': [
'error'.'never'].// @fixable configures the newline format between array elements
// @off allows multiple elements in a single line, making it easy to write large arrays
'array-element-newline': 'off'.Function () {alert('Hello')} // @fixable code block
'block-spacing': [
'error'.'always'].// @fixable if and else must have the same curly brace style
// @off else blocks may need to be preceded by a line of comment
'brace-style': 'off'.// The variable name must be camelcase style
// @off Many apis or file names are not Camelcase
'camelcase': 'off'.// @fixable comments must begin with a capital letter
// @off No need to restrict
'capitalized-comments': 'off'.// The last attribute of the @fixable object must end with a comma
// @off No need to restrict
'comma-dangle': 'off'.// @fixable no Spaces before commas, Spaces must be followed by commas
'comma-spacing': [
'error',
{
'before': false.'after': true}].// @fixable disallows commas at the beginning of lines
'comma-style': [
'error'.'last'].When @fixable is used as a calculated attribute of an object, no Spaces are allowed at the beginning or end of the brackets
'computed-property-spacing': [
'error'.'never'].// Restrict the alias of this
// @off No need to restrict
'consistent-this': 'off'.The last line of the @fixable file must have an empty line
// @off No need to restrict
'eol-last': 'off'.// Disallow Spaces between the @fixable function name and the parentheses that execute it
'func-call-spacing': [
'error'.'never'].// When a function is assigned to a variable, the function name must be the same as the variable name
'func-name-matching': [
'error'.'always',
{
includeCommonJSModuleExports: false}].// Functions must have names
// @off No need to restrict
'func-names': 'off'.// You must use only function declarations or only function expressions
// @off No need to restrict
'func-style': 'off'.// Disallow the use of the specified identifier
// @off It is used to restrict the use of a specific identifier
'id-blacklist': 'off'.// Limit the length of the variable name
// @off There is no need to limit the length of the variable name
'id-length': 'off'.// The constraint variable name must match the specified regular expression
// @off There is no need to restrict variable names
'id-match': 'off'.// @fixable an indent must be replaced with four Spaces
'indent': [
'error'.4,
{
SwitchCase: 1.flatTernaryExpressions: true}].// @fixable JSX attributes must be quoted in double quotes
'jsx-quotes': [
'error'.'prefer-double'].// @fixable object literals do not have Spaces before colons, and must be followed by Spaces
'key-spacing': [
'error',
{
beforeColon: false.afterColon: true.mode: 'strict',}],// @fixable keyword must be preceded by Spaces
'keyword-spacing': [
'error',
{
before: true.after: true}].Single-line comments must be written on the previous line
// @off No need to restrict
'line-comment-position': 'off'.// @fixable limits the newline to LF or CRLF
// @off No need to restrict
'linebreak-style': 'off'.// @fixable comments must be preceded by empty lines
// @off No need to restrict
'lines-around-comment': 'off'.// Block nesting depth is prohibited to exceed 5 layers
'max-depth': [
'error'.5].// Limit the length of a line
// @off Now that the editor is smart enough, there is no need to limit the length of a line
'max-len': 'off'.// Limit the maximum number of lines in a file
// @off No need to restrict
'max-lines': 'off'.// callback function nesting is prohibited for more than 3 layers, please use async await instead
'max-nested-callbacks': [
'error'.3].// A function cannot have more than 7 arguments
'max-params': [
'error'.7].// Limit the number of statements in a function block
// @off No need to restrict
'max-statements': 'off'.// Limit the number of statements in a line
// @off No need to restrict
'max-statements-per-line': 'off'.// A ternary expression must have a newline
// @off Ternary expressions can be used arbitrarily
'multiline-ternary': 'off'.// Class names after new must begin with a capital letter
'new-cap': [
'error',
{
newIsCap: true.capIsNew: false.properties: true}].// classes after @fixable new must have braces
'new-parens': 'error'.// Chain calls must be wrapped
// @off No need to restrict
'newline-per-chained-call': 'off'.// Disable the Array constructor
'no-array-constructor': 'error'.// Forbid bitwise operations
// the @off bit operation is common
'no-bitwise': 'off'.// Disallow continue
// @off continue
'no-continue': 'off'.// Disallow inline comments after code
// @off Inline comments are commonly used
'no-inline-comments': 'off'.// @fixable disallows a single if in else
// @off if alone can express logic more clearly
'no-lonely-if': 'off'./ / a mixture of different operators, such as let foo = a && b < 0 | | c > 0 | | d + 1 = = = 0
// @off is too strict. It is up to the user to decide how to mix operators
'no-mixed-operators': 'off'.// Do not mix Spaces with indentation
'no-mixed-spaces-and-tabs': 'error'.// disallow consecutive assignments, such as a = b = c = 5
// @off No need to restrict
'no-multi-assign': 'off'.// @fixable disallows more than three consecutive blank lines
'no-multiple-empty-lines': [
'error',
{
max: 3.maxEOF: 1.maxBOF: 1}].// Disallow negative expressions in if, such as:
// if (a ! == b) {
// doSomething();
// } else {
// doSomethingElse();
// }
// @off negative expressions can make logic clearer
'no-negated-condition': 'off'.// Disallow nested ternary expressions such as a? b : c ? d : e
// @off No need to restrict
'no-nested-ternary': 'off'.// Disallow direct new Object
'no-new-object': 'error'.// Do not use ++ or --
// @off No need to restrict
'no-plusplus': 'off'.// Disallow specific syntax
// @off It is used to restrict the use of a specific syntax
'no-restricted-syntax': 'off'.// Disable tabs
'no-tabs': 'error'.// Forbid ternary expressions
// @off ternary expressions are commonly used
'no-ternary': 'off'.// @fixable disallows Spaces at the end of lines
'no-trailing-spaces': 'error'.// Disallow underlining of variable names
// @off underscores are common in variable names
'no-underscore-dangle': 'off'.// @fixable must be used! A for A? false : true
// @off
'no-unneeded-ternary': 'off'.// @fixable disallows Spaces before attributes, such as foo.bar ()
'no-whitespace-before-property': 'error'.// @fixable disallows two lines of code without parentheses after if
'nonblock-statement-body-position': [
'error'.'beside',
{
overrides: {
while: 'below'}}].// @fixable braces must start and end with line breaks
'object-curly-newline': [
'error',
{
multiline: true.consistent: true}].// When @fixable object literals are only one line long, Spaces must begin and end in braces
'object-curly-spacing': [
'error'.'always',
{
arraysInObjects: true.objectsInObjects: false}].// @fixable object literals must have only one property per line
// @off No need to restrict
'object-property-newline': 'off'.// Disallow variable declarations with commas
'one-var': [
'error'.'never'].// @fixable variable declarations must be one per line
'one-var-declaration-per-line': [
'error'.'always'].// @fixable must use x = x + y instead of x += y
// @off No need to restrict
'operator-assignment': 'off'.// @fixable when a line break is required, the operator must be placed at the end of the line, for example:
// let foo = 1 +
/ / 2
@off is sometimes easier to read at the beginning of the second line
'operator-linebreak': 'off'.// @fixable blocks must start and end with blank lines
// @off No need to restrict
'padded-blocks': 'off'.// @fixable restricts the rule of blank lines between statements, such as the need for blank lines after a variable is defined
// @off No need to restrict
'padding-line-between-statements': 'off'.// the key names of @fixable object literals are not quoted
// @off No need to restrict
'quote-props': 'off'.// @fixable must use single quotes. Double quotes are prohibited
'quotes': [
'error'.'single',
{
avoidEscape: true.allowTemplateLiterals: true}].// JsDoc style comments must be used
// @off is too strict
'require-jsdoc': 'off'.// @fixable must end with a semicolon
'semi': [
'error'.'always',
{
omitLastInOneLineBlock: true}].// @fixable If there are multiple statements on a line, do not have Spaces before semicolons, but must have Spaces after semicolons
'semi-spacing': [
'error',
{
before: false.after: true}].// @fixable semicolons must be written at the end of the line
'semi-style': [
'error'.'last'].// The key names of object literals must be sorted
// @off No need to restrict
'sort-keys': 'off'.// Variable declarations must be sorted
// @off No need to restrict
'sort-vars': 'off'.// @fixable if, function, etc. Braces must be preceded by Spaces, such as if (a) {
'space-before-blocks': [
'error'.'always'].// @fixable function must be preceded by Spaces
'space-before-function-paren': [
'error',
{
anonymous: 'ignore'.named: 'never'.asyncArrow: 'always'}].// @fixable does not allow Spaces at the beginning and end of the parentheses
'space-in-parens': [
'error'.'never'].// the @fixable operator must have Spaces around it, such as let sum = 1 + 2;
'space-infix-ops': 'error'.// @fixable new, typeof, etc. must be followed by Spaces, ++, -- etc.
// let foo = new Person();
// bar = bar++;
'space-unary-ops': [
'error',
{
words: true.nonwords: false}].// @fixable comments must have Spaces after slashes or *
'spaced-comment': [
'error'.'always',
{
block: {
exceptions: [
The '*'].balanced: true}}].// @fixable case Does not contain Spaces before colons, but must contain Spaces after colons
'switch-colon-spacing': [
'error',
{
after: true.before: false}].// The @fixable template disallows Spaces after a string tag, such as tag 'Hello World'
'template-tag-spacing': [
'error'.'never'].// @fixable prohibit BOM at the beginning of the file
'unicode-bom': [
'error'.'never'].// @fixable regular expressions must be wrapped in parentheses
// @off No need to restrict
'wrap-regex': 'off'.//
//
// ECMAScript 6
// These rules relate to ES6 (commonly known as ES2015)
//
// @fixable arrow function can omit the return, must omit, such as () => 0, do not write () => {return 0}
// the return value of the @off arrow function should allow flexibility
'arrow-body-style': 'off'.// @fixable arrow functions with only one argument must be parenthesized
// @off should allow flexible Settings
'arrow-parens': 'off'.// @fixable arrow Function arrows must be preceded by Spaces
'arrow-spacing': [
'error',
{
before: true.after: true}].// Constructor must have super
'constructor-super': 'error'.// @fixable Generator * must be preceded by a space
'generator-star-spacing': [
'error',
{
before: false.after: true}].// Disallows reassignment of defined classes
'no-class-assign': 'error'.// @fixable disallows obscure arrow functions such as let x = a => 1? 2:3
'no-confusing-arrow': [
'error',
{
allowParens: true}].// Disallows reassignment of constants defined with const
'no-const-assign': 'error'.// Disallow redefining classes
'no-dupe-class-members': 'error'.// Disallow duplicate import modules
'no-duplicate-imports': 'error'.// Do not use new to generate Symbol
'no-new-symbol': 'error'.// disallows the import of specified modules
// @off It is used to restrict the use of a specific module
'no-restricted-imports': 'off'.// Disallow this or super until super is called
'no-this-before-super': 'error'.// @fixable disallows unnecessary computed key names, such as let a = {['0']: 0};
'no-useless-computed-key': 'error'.// disallow unnecessary constructor, such as constructor(value) {super(value)}
'no-useless-constructor': 'error'.// @fixable disallows renaming of the same name when deconstructing, such as let {foo: foo} = bar;
'no-useless-rename': 'error'.// @fixable disables var
'no-var': 'error'.// @fixable must use a = {b} instead of a = {b: b}
// @off No need to enforce it
'object-shorthand': 'off'.// @fixable must use arrow functions as callbacks
// @off No need to enforce it
'prefer-arrow-callback': 'off'.// @fixable variables that cannot be modified after being declared must be declared const
// @off No need to enforce it
'prefer-const': 'off'.// Destruct must be used
// @off No need to enforce it
'prefer-destructuring': 'off'.// @fixable must use 0b11111011 instead of parseInt('111110111', 2)
// @off No need to enforce it
'prefer-numeric-literals': 'off'.// Must use... Args instead of arguments
// @off No need to enforce it
'prefer-rest-params': 'off'.// @fixable must use... Instead of apply, such as foo(... args)
// @off apply
'prefer-spread': 'off'.// @fixable must use template strings instead of string concatenation
// @off string concatenation is common
'prefer-template': 'off'.// Generator functions must have yield
'require-yield': 'error'.// @fixable ... Do not have Spaces after
'rest-spread-spacing': [
'error'.'never'].// @fixable import must be sorted by rules
// @off No need to enforce it
'sort-imports': 'off'.// We must pass in parameters to create Symbol
'symbol-description': 'error'.// @fixable ${name} does not start or end with Spaces
'template-curly-spacing': [
'error'.'never'].// @fixable yield* must be followed by a space
'yield-star-spacing': [
'error'.'after']}};Copy the code