eslint-config-1pete

4.0.0 • Public • Published

eslint-config-1pete

npm version

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

  1. arrow-body-style
  2. class-methods-use-this
  3. implicit-arrow-linebreak
  4. no-await-in-loop
  5. no-restricted-syntax
  6. no-unused-vars
  7. no-use-before-define
  8. prefer-const
  9. 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

Package Sidebar

Install

npm i eslint-config-1pete

Weekly Downloads

0

Version

4.0.0

License

MIT

Unpacked Size

31.9 kB

Total Files

6

Last publish

Collaborators

  • 1pete