Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherjbaker committed Apr 8, 2023
1 parent a582f35 commit 60d05f6
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 31 deletions.
42 changes: 28 additions & 14 deletions README.md
Expand Up @@ -4,32 +4,49 @@ Bitovi's Recommended ESLint Rule Set

## Installation

Run `npm install --save-dev @bitovi/eslint-config` or `npm i -D @bitovi/eslint-config`
Run `npm install --save-dev @bitovi/eslint-config`

## Usage

In your Project's ESLint config file, extend any of the available rules.
This package ships with several primary configs, containing our full reccomendations for that stack. You will usually want to use one of these directly.

* angular
* react

In your Project's ESLint config file, extend one of them.

```
extends: [
"@bitovi/eslint-config/angular",
]
```

## Advanced Usage

If you only want a portion of our config or want more fine-grained control, you can access each of our smaller configs direction. In your Project's ESLint config file, extend any of the available configs.

```
extends: [
'@bitovi/eslint-config/angular', // includes all angular recommended rules, see Available Rules below
'@bitovi/eslint-config/rules/rxjs', // for specific rule usage, in this example the rxjs rules
"@bitovi/eslint-config/configs/rxjs",
"@bitovi/eslint-config/configs/jest",
]
```

## Available Rules
## Available Configs

| Rule | angular | react |
| Config | angular | react |
| ---------------------- | ------------------ | ------------------ |
| angular-a11y | :white_check_mark: | |
| angular-best-practices | :white_check_mark: | |
| base | :white_check_mark: | :white_check_mark: |
| import | | :white_check_mark: |
| jest | :white_check_mark: | :white_check_mark: |
| jsx | | :white_check_mark: |
| karma | :white_check_mark: | |
| ngrx | :white_check_mark: | |
| react-best-practices | | :white_check_mark: |
| rxjs | :white_check_mark: | |
| typescript | :white_check_mark: | :white_check_mark: |
| typescript-strict | | :white_check_mark: |

### angular-a11y

Expand Down Expand Up @@ -65,25 +82,22 @@ In your Project's ESLint config file, extend any of the available rules.

### base

base rule includes `eslint:recommended`
base config includes `eslint:recommended`

### jest

jest rule includes `jest/recommended` and, depending if you are using angular or react, `testing-library/angular` or `testing-library/react`.
jest config includes `jest/recommended` and, depending if you are using angular or react, `testing-library/angular` or `testing-library/react`.

| Rule | Error Level |
| ----------------- | ----------- |
| jest/no-export | off |
| jest/valid-expect | off |

### karma

to-do

### ngrx

ngrx rule includes `ngrx/recommended` if @ngrx/store or @ngrx/component-store version is less than 14.
Otherwise, ngrx rule includes `@ngrx/recommended`.
ngrx config includes `ngrx/recommended` if @ngrx/store or @ngrx/component-store version is less than 14.
Otherwise, ngrx config includes `@ngrx/recommended`.

### rxjs

Expand Down
6 changes: 3 additions & 3 deletions angular.js
Expand Up @@ -3,10 +3,10 @@ module.exports = {
"./configs/base",
"./configs/typescript",
"./configs/rxjs",
"./configs/angular-a11y",
"./configs/angular-best-practices",
"./configs/ngrx",
"./configs/jest",
"./configs/karma",
"./configs/ngrx",
"./configs/angular-a11y",
"./configs/angular-best-practices",
].map(require.resolve),
};
7 changes: 7 additions & 0 deletions configs/import.js
Expand Up @@ -7,6 +7,8 @@ module.exports = {
extends: ["plugin:import/recommended", "plugin:import/typescript"],

rules: {
"import/no-unresolved": "off",

"@typescript-eslint/consistent-type-imports": "error",
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
"import/first": "error",
Expand All @@ -16,6 +18,11 @@ module.exports = {
"import/order": [
"error",
{
"newlines-between": "always-and-inside-groups",
alphabetize: {
order: 'asc',
caseInsensitive: true ,
},
groups: [
"type",
"builtin",
Expand Down
10 changes: 0 additions & 10 deletions configs/jsx.js

This file was deleted.

9 changes: 7 additions & 2 deletions configs/react-best-practices.js
@@ -1,6 +1,11 @@
module.exports = {
plugins: ["react", "react-hooks"],
extends: ["plugin:react/recommended", "plugin:react-hooks/recommended"],
plugins: ["react", "react-hooks", "jsx-a11y"],
extends: [
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:react/jsx-runtime",
"plugin:jsx-a11y/recommended",
],

rules: {
"react/no-unknown-property": "off",
Expand Down
4 changes: 2 additions & 2 deletions react.js
Expand Up @@ -10,9 +10,9 @@ module.exports = {
extends: [
"./configs/base",
"./configs/typescript-strict",
"./configs/react-best-practices",
"./configs/jest",
"./configs/jsx",
"./configs/import",
"./configs/react-best-practices",
].map(require.resolve),

rules: {
Expand Down

0 comments on commit 60d05f6

Please sign in to comment.