Skip to content

Commit

Permalink
docs: new usage instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Apr 18, 2024
1 parent 075e932 commit d76c5cd
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions packages/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,45 @@ My personal coding style.

This is designed to be a replacement for `eslint:recommended`, `plugin:react-hooks/recommended`, `plugin:@typescript-eslint/recommended`, and of course, everyone's favorite `airbnb`. It also extends `prettier`.

## Installation

```sh
yarn add -D eslint-config-jc
```

No need to install any other plugins. You should probably also have the following dependencies:

- `eslint`
- `typescript-eslint` (for authoring the config)

## Configuration

ESLint config:
`eslint.config.mjs`:

```json
{
"root": true,
"extends": ["jc"]
}
```js
import jcRules from "eslint-config-jc";
import tseslint from "typescript-eslint";

export default tseslint.config(
...jcRules({
// options
}),
{
// Your overrides here
},
);
```

The `jcRules` function has the following options:

- `react`: enable React and JSX rules (also loads browser globals)
- `typescriptTypeCheck`: enabled type-checked rules
- `node`: enable Node.js rules (also loads Node globals)
- `reactClassComp`: enable rules for class components (you probably don't need this)
- `reactPropTypes`: enable rules for prop types (you probably don't need this)

Each option can be set to `true` to enable, or an array of paths used for the `files` ESLint option.

## Configuration philosophy

When analyzing whether a rule should be `error`, `warn`, or `off`, the following assumptions are made:
Expand Down

0 comments on commit d76c5cd

Please sign in to comment.