before: false, ], 5 } 'no-void':'error', //prohibit the use of eval //@off negative expressions can express the logic more clearly sourceType:'module', //The component must write propTypes

//@off alone if can express the logic more clearly //@fixable prohibits writing a comma at the beginning of the line //Prohibit return, throw, break or continue in finally { //Variable declaration must be sorted //@fixable prohibits continuous blank lines with more than three lines after: true, ], //Prohibit direct new Object 'default-case':'off', //Prohibit the ASCII representation of the Ctrl key in regular expressions, that is, prohibit the use of/\x1f/ //Restrict variable names must match the specified regular expression //@off is very common to define first and then assign 'no-process-exit':'off', 'no-unreachable':'error', //@off no need to limit 'react/jsx-curly-spacing': [ //@off no need to limit }; /** 'space-in-parens': [ 'error', //It is forbidden to use numbers starting with 0 to represent octal numbers module.exports = { 'no-implicit-coercion': [ //Must use Class to create components

//@fixable comment must have a space after the slash or * 'no-empty-pattern':'error', //It is forbidden to define variables or declare functions in the global scope //The variable form in the template string is prohibited from appearing in ordinary strings, such as'Hello ${name}!' 'no-multiple-empty-lines': [ 'no-inline-comments':'off', } 'func-style':'off', //It is forbidden to use setState in componentDidMount properties: true selfClosing:'line-aligned' //Prohibit the use of children as props

//@fixable must use instead of apply, such as foo(args) 'react/jsx-no-literals':'off', 'error', } 'semi-spacing': [ ], 'camelcase':'off', 'arrow-parens':'off', //@fixable arrow function must have spaces before and after the arrow {

//Prohibit empty {} or [] in deconstruction ], 'comma-dangle':'off', 'last' overrides: { 'operator-assignment':'off', } 'react/no-will-update-set-state':'error', 'no-lonely-if':'off', //It is forbidden to modify this.state directly // //It is forbidden to have code after return, throw, break or continue 'react/self-closing-comp':'off', 'template-curly-spacing': [ //@off It is used to restrict the use of a specific module 'for-direction':'error',

'error', //@off jsdoc is too strict 'react/no-set-state':'off', //@off It is used to restrict the use of a specific module 'last' before: false, 'no-ternary':'off', //@off no need to limit 'error', ], //Spaces are prohibited after the tag of the @fixable template string, such as tag`Hello World` 'react/jsx-no-target-blank':'off', } 'react/jsx-equals-spacing': [ 'no-bitwise':'off', 'no-implicit-globals':'error', 'no-sequences':'error', browser: true, 'react/jsx-no-bind':'off', 'generator-star-spacing': [ //It is forbidden to re-assign undefined //Use commas to declare multiple variables at once 'react/no-unused-state':'off', ], } //@fixable prohibits only one single if in else ], 'functions' //var must be at the beginning of the scope skipComments: false, //@fixable prohibits incomprehensible arrow functions, such as let x = a => 1? ], //Duplicate props are prohibited 'error', * 'no-ex-assign':'error', 'react/jsx-indent-props': [ null:'ignore' 'no-implied-eval':'error', // //Throw literal is forbidden, you must throw an Error object } ], { //@fixable regular expression must be wrapped in parentheses //Direct use of propTypes of other components is prohibited //It is forbidden to appear unnecessary constructors, such as constructor(value) {super(value)} 'block-scoped-var':'error', ], 'error', //prohibit strings in jsx ], //@fixable prohibits writing two lines of code without increasing the brackets after the if 'react/react-in-jsx-scope':'off', //@off is not mandatory allowParens: true //Prohibit assigning values to global variables ], //prohibit the use of specified global variables //@off allows a row to contain multiple elements, which is convenient for writing large numbers of arrays 'callback-return':'off', } //A defaultProps must have corresponding propTypes 'no-new-object':'error', * AlloyTeam ESLint rules-React //No empty function is allowed, unless an empty function is set as the default value of an item //It is forbidden to appear at the beginning of a division operator in regular expressions, such as let a =/=foo/ } //@off is not mandatory to write propTypes //Spaces are prohibited before and after the brackets of the @fixable array //Must use only function declarations or only function expressions balanced: true //@off TODO is very common 'no-undef': [ //must use pure function //It is forbidden to add children in the components that use dangerouslySetInnerHTML //@fixable must have a semicolon at the end must be followed by spaces, ++, --, etc. ], 'react/jsx-wrap-multilines':'off' //@off is not mandatory

//It is forbidden to use reserved words as variable names ], { 'error', nonEmpty: false, ], 'error',

'no-extra-semi':'error', //function must have a name //Do not mix spaces and indents //@off no need to limit 'no-octal-escape':'error', //style issue //The loop condition variable must be modified in the loop ], //Forbid negative expressions in if, such as: 'consistent' 'error', //It is forbidden to have unescaped >, ", 'or} inside the component //No spelling errors 'new-parens':'error', 'no-await-in-loop':'off', 'max-statements':'off', 'error', //Prohibit the use of setState in componentDidUpdate bar() //These rules help you avoid problems through some best practices 'error', //} else { //The setter must have a corresponding getter, and the getter can have no corresponding setter

'no-new':'error', ], //@off bit operations are very common 'no-iterator':'error',

//@fixable prohibits unnecessary bind 'react/no-find-dom-node':'error', //When the @fixable arrow function has only one parameter, you must add parentheses //prohibit the use of target="_blank" 'react/no-unused-prop-types':'off', vars:'all', 'keyword-spacing': [ // // }, //@off is very common 'constructor-super':'error', 'id-length':'off', //@off is already restricted in jsx-indent ], //if (a !== b) { 'no-invalid-this':'off', 'react/no-did-update-set-state':'error', 'no-negated-condition':'off', 'computed-property-spacing': [ 'react/jsx-max-props-per-line':'off', 'never' 'max-len':'off', //Must use destructuring //@fixable semicolon must be written at the end of the line, not at the beginning of the line //Do not use nested ternary expressions, such as a? //jsx file must import React //It is forbidden to re-assign the defined class 'always',

'quote-props':'off', //prohibit the use of string ref allowMultiline: true setWithoutGet: true, Reference : //Variables must be assigned when they are defined 'radix':'error', //Do not add inline comments after the code //@fixable prohibits unnecessary calculation key names, such as let a = {['0']: 0 }; 'react/jsx-boolean-value':'off', jsx: true, 'error', //prohibit unnecessary string concatenation //@fixable prohibits assigning undefined to variables 'error', 'capitalized-comments':'off', 'wrap-iife': [ 'no-floating-decimal':'error', { ], experimentalObjectRestSpread: true, 'no-new-symbol':'error', //@fixable ${name} no spaces at the beginning and end block: { //Callback function nesting is prohibited to exceed 3 levels, please use async await instead while:'below' //chain call must wrap //Prohibit empty code blocks, allow catch to be empty code blocks //@fixable methods in the component must be sorted according to certain rules '*' D: e 'no-extra-boolean-cast':'error', //Forbid the catch parameter name to repeat the defined variable 'require-yield':'error', 'no-array-constructor':'error', //@TODO Deprecated //@off is not mandatory to write propTypes 'no-restricted-imports':'off', //It is prohibited to use jsx written in pascal, such as //prohibit function declarations in if code blocks //Bind is prohibited in jsx //Disallow parameters with duplicate names in function parameters 4, 'no-fallthrough':'error', 'react/jsx-uses-react':'error', 'unicode-bom': [ //@fixable must use arrow functions as callbacks //@off should allow flexible settings

} //Prohibit TODO and FIXME in comments //@off If there is code highlighting, there will be no ambiguity or difficulty in understanding when reading this code //@off no need to limit //@off no need to limit 'accessor-pairs': [ 'array-callback-return':'error', 'react/prop-types':'off',

//When the @fixable object literal has only one line, there must be spaces at the beginning and end of the braces 'no-empty-character-class':'error',

//@off conditional loading is very common

//It is forbidden to use this outside of the class

maxEOF: 1, 'error', { //Prohibit the use of octal escape characters 'error', 'never' //@fixable if, function, etc. //Do not use Buffer directly //let foo = bar // }, //@off ternary expression can be used at will ], 'nonblock-statement-body-position': [ //These rules are related to possible grammatical or logical errors in JavaScript code //@fixable if must be followed by {, unless it is a single line if //The case of repeated test expressions is prohibited in the switch statement //Defined variables must be used plugins: [ avoidEscape: true, // //@off no need to limit 'one-var': [ //@off is too strict //@fixable function must have a space before the parentheses 'error', { //Do not define the class repeatedly * 'no-prototype-builtins':'off', //Must useargs instead of arguments //@fixable configures the newline format before and after the brackets of the array { //When @fixable is used as a calculated attribute of an object, spaces inside the brackets are prohibited //@off is not mandatory

{ 'guard-for-in':'error', //When a function is assigned to a variable, the function name must be consistent with the variable name ], 'no-useless-call':'error', 'eol-last':'off', //The name of the handler must be onXXX or handleXXX 'no-constant-condition': [ 'no-useless-constructor':'error', // //@off is not mandatory to write propTypes 'error', //Variables must be defined before use } 'space-infix-ops':'error', 'prefer-spread':'off', getWithoutSet: false 'error', //@fixable Boolean attributes must be explicitly written someprop={true} classes: false, //Do not import modules repeatedly { //When @fixable needs to wrap, the operator must be placed at the end of the line, such as: //@off alert is very common //@off Now the editor is very smart, there is no need to limit the length of a line //Variable name must be camelcase style asyncArrow:'always' omitLastInOneLineBlock: true * @off means that this configuration is closed, and the reason for the closure is explained later 'always', ], // //Prohibit the use of process.env.NODE_ENV //@fixable must use template string instead of string concatenation //prohibit the use of with 'error', 'curly': [ 'react/forbid-component-props':'off', 'yield-star-spacing': [ //It is forbidden to re-assign the first parameter error of catch 'react/jsx-no-comment-textnodes':'error', //(function () {return i })(); //It is prohibited to directly new a class without assigning a value 'func-call-spacing': [ //@fixable configures the line break format between the elements of the array 'no-extra-bind':'error', * //@fixable must use a = (b) instead of a = (b: b) 'no-new-wrappers':'error', 'indent': [ //@fixable must use single quotes, double quotes are prohibited caughtErrors:'none', ], //Treat the variable defined by var as the block scope, and it is forbidden to use it outside the block 'func-names':'off', 'no-param-reassign':'error',

], //Prohibit the use of console 'no-extra-label':'error', //@off is too strict, it is up to the user to determine how to mix operators * Use babel-eslint as the parser //@fixable is forbidden to use !! //for in must have hasOwnProperty inside 'no-shadow':'off', 'no-redeclare':'error', // 'react/no-children-prop':'error', }, 'no-nested-ternary':'off', 'space-unary-ops': [ 'error', //@off It is used to restrict the use of a specific api //@off no need to limit 'error', // ], //@off no need to limit //It is forbidden to pass a string in setTimeout or setInterval, such as setTimeout('alrt("Hi! //It is forbidden to use some specified props in custom components 'wrap-regex':'off', //@fixable props must be sorted 'before': false, //@fixable variables that will no longer be modified after declaration must use const to declare ], 'class-methods-use-this':'off', 'error', 'error', node: true,

//When there are variable definitions in the switch case, braces must be used to turn the case into a code block ], ], //@off no need to limit 4 //No assignment in return statement false: true //@off Many times the formal parameters and passing parameters of a function have the same name //@off is very common //It is forbidden to use foo == null or foo != null, you must use foo === null or foo !== null 'error', 'always', //Limit the maximum number of lines in a file 'block-spacing': [ 'max-statements-per-line':'off', 'react/no-typos':'error', newIsCap: true, //prohibit the use of findDOMNode 'object-property-newline':'off', //@fixable must use 0b11111011 instead of parseInt('111110111', 2) 'error', ], 'prefer-double' 'no-unneeded-ternary':'off', 'no-shadow-restricted-names':'error', //The object of typeof expression comparison must be'undefined','object','boolean','number','string','function' or'symbol' B: c? allowShortCircuit: true, must not have spaces, such as: includeCommonJSModuleExports: false //@fixable prohibits extra semicolons

'react/no-string-refs':'error', 'react/jsx-first-prop-new-line':'off', 'no-self-compare':'error',

'init-declarations':'off', 'no-control-regex':'off', //@fixable prohibits the use of an exclamation mark on the left side of the in or instanceof operator, such as if (!key in object) allowTemplateLiterals: true //prohibit the use of some specified elements //for (var i = 0; i <10; i++) { 'react/void-dom-elements-no-children':'error', //Limit the length of variable names 'semi': [ { //The value of the style attribute must be object ] 'no-script-url':'error', //prohibit the use of isMounted

rules: { //where jsx appears must import React 'react/default-props-match-prop-types':'off', 'array-bracket-newline':'off', * Contains all ESLint rules 'react/no-render-return-value':'error', 'no-else-return':'off', } 'no-global-assign':'error',

//Non-required props must have defaultProps //require must be in the global scope } 'prefer-rest-params':'off', 'no-octal':'error', 'never' 'error', { 'line-comment-position':'off', 'both' //@off The return value of the arrow function should allow flexible settings ecmaVersion: 2017, 'no-case-declarations':'error', //@fixable import must be sorted by rules //@off no need to limit // 'react/sort-prop-types':'off', {

* AlloyTeam ESLint rules ], 'react/style-prop-object':'error', 'no-restricted-syntax':'off',

flatTernaryExpressions: true //Function parameters must not exceed 7 'error', //@off is not mandatory to write propTypes //} rules: { 'complexity': [ 'no-duplicate-imports':'error', root: true, //prohibit the use of continue

//Prohibit the use of some specified propTypes multiline: true, //Prohibit the use of Array constructor 'error', //@fixable prohibits the use of var //@fixable object literal keys must not be enclosed in quotation marks 'comma-spacing': [ //@fixable jsx no spaces are allowed at the beginning and closing //The Error object must be passed in the reject of the Promise, not a literal } functionPrototypeMethods: true 'error', 'no-irregular-whitespace': [ //@off no need to limit 'no-confusing-arrow': [ //let foo = new Person(); 4 'no-labels':'error', { variables: false { //It is forbidden to define variables repeatedly 'error', //The first letter of @fixable comments must be capitalized // after: true

'never' 'no-const-assign':'error', //@off no need to limit ], //await statement must exist in the async function // // 'sort-imports':'off', { } 'no-useless-computed-key':'error',

//prohibit the use of delete //@fixable yield* must have a space after it 'error', //@off underscore is very common in variable names //@fixable case must have spaces before the colon, and must have spaces after the colon 'error', 'error', after: true 'react/no-array-index-key':'off', ], //It is forbidden to use new to generate String, Number or Boolean //Prohibit location.href ='javascript:void(0)'; 'no-dupe-keys':'error', 'sort-vars':'off', 'quotes': [ 'object-curly-newline': [ //@off no need to limit //Node.js and CommonJS ], //No unnecessary call or apply is prohibited //prohibit the use of undefined variables afterOpening:'never' 'error', //Do not use ++ or - 'getter-return': [ //@fixable variable declaration must be one per line //@off is not mandatory to write propTypes //jsx in the array must have a key //Prohibit illegal regular expressions in the RegExp constructor // 'error', //prohibit the use of tabs ], 'functions', } 'eqeqeq': [ 'space-before-blocks': [

onlyEquality: true }; WebStorm + React project, configure ESLint. //The error in callback must be processed