@lvjiaxuan/eslint-plugin v1.12.1
@lvjiaxuan/eslint-plugin
Usage
Installation:
npm i @lvjiaxuan/eslint-plugin -D
package.json Setting:
{
"eslintConfig": {
"extends": "plugin:@lvjiaxuan/recommended"
}
}
Rules
@lvjiaxuan/no-spaces-on-empty-line
const foo = 1
···// A few spaces which would be detected and removed by this rule.
const bar = 2
After soon, I found it as well as no-trailing-spaces. So I set it deprecated, f--king sad.
@lvjiaxuan/prefer-constraint-tuple-type
type Foo<BarArr = []> = [ ...BarArr ] // A rest element type must be an array type.(2574)
Maybe BarArr
is better to extend a constraint type even unknown.
type Foo<BarArr extends unknown[] = []> = [ ...BarArr ] // ok.
@lvjiaxuan/no-multi-empty-lines-in-pattern
options:
const options1 = { '@lvjiaxuan/no-multi-empty-lines-in-pattern': [ 'warn', { afterMaxLines: 0, beforeMaxLines: Infinity } ] } // default
const options2 = {
'@lvjiaxuan/no-multi-empty-lines-in-pattern': [
'warn',
{
ObjectExpression: { afterMaxLines: 0, beforeMaxLines: Infinity },
// ObjectPattern:
// ArrayExpression:
// ArrayPattern:
},
],
}
const options3 = {
'@lvjiaxuan/no-multi-empty-lines-in-pattern': [
'warn',
{ afterMaxLines: 0, beforeMaxLines: Infinity },
{
ObjectExpression: { afterMaxLines: 2, beforeMaxLines: 2 },
// ObjectPattern:
// ArrayExpression:
// ArrayPattern:
},
],
}
const obj = {
a: 1,
b: 2
// This line Would be fixed through removing.
// This line Would be fixed through removing.
}
const {
a,
b,
// This line Would be fixed through removing.
// This line Would be fixed through removing.
} = obj
const arr = [
1,
2,
// This line Would be fixed through removing.
// This line Would be fixed through removing.
]
const [
c,
d
// This line Would be fixed through removing.
// This line Would be fixed through removing.
] = arr
@lvjiaxuan/omit-arrow-curly
Reference
10 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago