@papb/linter
v0.4.4
Published
My custom linter configs and dependencies collected in one place to avoid repetition.
Downloads
3
Readme
@papb/linter
My custom linter configs and dependencies collected in one place to avoid repetition.
Why?
Until some time ago I was just using XO in my repos and overwriting a few rule configurations manually. However, XO now requires the project to be ESM and I don't want to do that. I don't want to stay locked in an old XO version either.
Install
# With npm
$ npm install --save-dev eslint@^8 prettier@^2 @papb/linter
# With yarn
$ yarn add --dev eslint@^8 prettier@^2 @papb/linter
Usage
// .eslintrc.cjs
module.exports = require('@papb/linter').eslintrc();
// .prettierrc.cjs
module.exports = require('@papb/linter').prettierrc();
# Will lint all `.js`, `.ts`, `.cjs` and `.md` files.
$ npx eslint . --max-warnings 0
# Will check all `.js`, `.ts`, `.cjs` and `.md` for prettier style.
$ npx prettier --check .
# Will overwrite in-place all `.js`, `.ts`, `.cjs` and `.md` for prettier style.
$ npx prettier --write .
Note: It is possible for ESLint to pass while prettier --check
still fails, so you should run both.
Recommended npm scripts:
{
"scripts": {
"lint": "eslint . --max-warnings 0 && prettier --check .",
"prettier": "prettier --write .",
}
}