1.0.0-rc5 • Published 3 years ago
@bshdo/eslint-config v1.0.0-rc5
Installation
yarn add -D @bshdo/eslint-config @rushstack/eslint-patch eslint prettier
Create .eslintrc.js
file with following code:
// This is a workaround for: https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-patch/modern-module-resolution');
module.exports = {
// use @bshdo/eslint-config/react for React/NextJs projects
extends: ['@bshdo/eslint-config'],
};
Create a file called .prettierrc.js
module.exports = require('@bshdo/eslint-config/prettier-config');
Add the following script to your package.json
"lint": "eslint '*/**/*.{js,ts,tsx}'"
"lint:fix": "eslint '*/**/*.{js,ts,tsx}' --fix"
VSCode autoformat
Add the following snippet to your settings.json to autoformat your code on every save
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
Note
The package currently makes use of a patched version of eslint (@rushstack/eslint-patch), which eliminates the need of installing all used eslint plugins in the target repository as well. Therefore it's important to load the patched version using the .eslintrcjs snippet from above