- eol-last
- key-spacing
- padding-line-between-statements
- comma-dangle
- max-len
- eol-last
- no-multiple-empty-lines
- no-this-before-super
- refer-destructuring
- prefer-object-spread
- jsx-quotes
- prefer-const
promise/prefer-await-to-then
- react/sort-comp
- react/jsx-one-expression-per-line
- react/jsx-closing-bracket-location
react/jsx-closing-tag-location
react/jsx-wrap-multilines
react/jsx-curly-spacing
...
Code Block |
---|
// using const. const a = 0; // it's never initialized. let a; console.log(a); |
promise/prefer-await-to-then
Examples of incorrect code for this rule:
Code Block |
---|
function example() {
return myPromise.then(doSomethingSync).then(doSomethingElseAsync)
}
function exampleTwo() {
return myPromise
.then(doSomethingSync)
.then(doSomethingElseAsync)
.catch(errors)
} |
Examples of correct code for this rule:
Code Block |
---|
async function example() {
let val = await myPromise()
val = doSomethingSync(val)
return doSomethingElseAsync(val)
}
async function exampleTwo() {
try {
let val = await myPromise()
val = doSomethingSync(val)
return await doSomethingElseAsync(val)
} catch (err) {
errors(err)
}
} |
react/sort-comp
Examples of incorrect code for this rule with ["error", { order: [ 'static-methods', 'lifecycle', 'render', 'everything-else' ], groups: <groups> }]
option:
...