0.10.2 • Published 3 years ago

@keegan-lillo/eslint-config-typescript v0.10.2

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

@keegan-lillo/linters

Monorepo of various lint configurations I use for my personal projects.

Choose Your Own Adventure

Prettier

You will need Prettier for both the ESLint and Stylelint configs.

Install Prettier

$ yarn add -D prettier

Using My Config

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

ESLint

Install ESLint

$ yarn add -D eslint

Install the Config

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 and eslint-config-standard-with-typescript
  • @keegan-lillo/eslint-config-typescript-typescript
    • Extends @keegan-lillo/eslint-config-typescript and eslint-config-standard-react
yarn add -D @keegan-lillo/eslint-config-typescript-react

Use the Config

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.

tsconfig.eslint.json

{
  "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

Stylelint Config for SCSS with some very strict property ordering.

Installation

Install the dependencies
yarn add -D @keegan-lillo/eslint-stylelint-config-scss
Stylelint

Add the following to your .stylelintrc

{
  "extends": ["@keegan-lillo/stylelint-config-scss"]
}