Monorepo of various lint configurations I use for my personal projects.
You will need Prettier for both the ESLint and Stylelint configs.
$ yarn add -D prettier
If you are not using your own Prettier config already, you can use mine. Just
create a new .prettierrc
file at the root of your project with the following
content:
"@keegan-lillo/prettier-config"
Then install the config:
yarn add -D @keegan-lillo/prettier-config
$ yarn add -D eslint
There are 3 config packages available:
@keegan-lillo/eslint-config-base
- Enforces Prettier format
- Enforces import/property ordering
@keegan-lillo/eslint-config-typescript
- Extends
@keegan-lillo/eslint-config-base
andeslint-config-standard-with-typescript
- Extends
@keegan-lillo/eslint-config-typescript-typescript
- Extends
@keegan-lillo/eslint-config-typescript
andeslint-config-standard-react
- Extends
yarn add -D @keegan-lillo/eslint-config-typescript-react
Add the following to your .eslintrc
.
{
extends: ['@keegan-lillo/typescript-react'],
parserOptions: { project: './tsconfig.eslint.json' },
}
parserOptions.project
is necessary for most of the Typescript rules. If your
project contains files covered by eslint but not by your tsconfig.json
, you
can create another file such as tsconfig.eslint.json
and point
parserOptions.project
at it instead. Then in this file you can exclude/include
all the files that will be covered by ESLint.
{
"extends": "./tsconfig.json",
"include": ["path/to/all/eslint/files"]
}
IMPORTANT! These ESLint configs will auto-patch ESLint to make it less
annoying to install dependencies. You must make sure the config is first in the
extends
array. I am using:
@rushstack/eslint-patch
behind the scenes. If you don't want to have my configs first, then you will
need to following
these
instructions.
Stylelint Config for SCSS with some very strict property ordering.
yarn add -D @keegan-lillo/stylelint-config-scss
Add the following to your .stylelintrc
{
"extends": ["@keegan-lillo/stylelint-config-scss"]
}