1.0.2 • Published 3 years ago

@mkvlrn/eslint v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@mkvlrn/eslint

autodeploy

what

Mainly extends AirBnb's excellent guide, disabling a few rules in order to accommodate the projects I usually create.

It also bundles ALL dependencies (that should be peerDependencies) but since an ESLint flat config is still so far away, everything is installed as devDependencies.

install

# eslint and typescript are peerDependencies
# typescript only needed for TS projects
# npm can be replaced by yarn or pnpm
npm add eslint typescript @mkvlrn/eslint -D

extending

Four possible configurations js/ts (and an extra for jest only) can be extended in your eslint configuration, like this:

// .eslintrc.js
// this extends the typescript config for react projects
module.exports {
  extends: "@mkvlrn/eslint/ts"
  ...
}

Configs are:

  • react typescript: @mkvlrn/eslint/ts-react
  • node typescript (no react): @mkvlrn/eslint/ts
  • react javascript: @mkvlrn/eslint/js-react
  • node javascript (no react): @mkvlrn/eslint/js
  • jest (any project using jest): @mkvlrn/eslint/jest

disabled rules

no-underscore-dangle

this rule just makes it awkward to deal with mongodb models (which have a _id field by default)

import/prefer-default-export

this rule spoils tree-shaking (in some projects) and marks the exporting of cloud functions that require a named export as incorrect

react/jsx-uses-react & react/react-in-jsx-scope

react's new jsx transform doesn't expect React to be in scope when using jsx, and these rules expect it to be imported