eslint-config-1pete
Just another eslint config
This config is almost the same with airbnb's style guide, except some rules are overridden. This config also use config based from airbnb's repo's master branch, so it will be latest regardless what publishes to npm registry.
How to install
npm i -D eslint eslint-config-1pete
// or
yarn add --dev eslint eslint-config-1pete
Overridden rules
- arrow-body-style
- class-methods-use-this
- implicit-arrow-linebreak
- no-await-in-loop
- no-restricted-syntax
- no-unused-vars
- no-use-before-define
- prefer-const
- semi
arrow-body-style
this allows arrow function has normal return form
const idMap = array.map((item) => {
return item.id
})
class-methods-use-this
this allows class function without using this
class A {
run() {
doSomething()
}
}
implicit-arrow-linebreak
this allows both following patterns
const fn = () => 10
const fn2 = () => 10
no-await-in-loop
this allows using await in loop
for (const job of jobList) {
// run one job at a time
await job.execute()
}
no-restricted-syntax
this allows for-of statements, in case of high-order functions of array cannot be used to complete task
for (const job of jobList) {
// run one job at a time
await job.execute()
}
no-unused-vars
this allows unused arguments in function with name starts with _
app.use((error, req, res, _next) => {
if (error) res.end('error')
else res.end('ok')
})
no-use-before-define
this allows function hoisting
run()
function run() {
return true
}
prefer-const
this allows variables declared using let
keyword regardless whether they are reassigned after the initial assignment.
const a = 10
let b = 10
semi
this disallows semicolons as the end of statements (except to disambiguate statements)
const a = 10