Skip to content

Commit

Permalink
update eslint-plugin-chai-friendly@0.8.0 documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcC399 committed May 23, 2024
1 parent 16362ab commit 4d9b581
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions FLAT-CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,39 +123,24 @@ export default [

### Cypress and Chai recommended

[eslint-plugin-chai-friendly](https://www.npmjs.com/package/eslint-plugin-chai-friendly) is combined with the Cypress plugin `eslint-plugin-cypress`.
[eslint-plugin-chai-friendly](https://www.npmjs.com/package/eslint-plugin-chai-friendly) (minimum version [eslint-plugin-chai-friendly@0.8.0](https://github.com/ihordiachenko/eslint-plugin-chai-friendly/releases/tag/v0.8.0) required for ESLint v9 support and flat config support) is combined with the Cypress plugin `eslint-plugin-cypress`.

The [eslint-plugin-chai-friendly@0.7.4](https://github.com/ihordiachenko/eslint-plugin-chai-friendly/releases/tag/v0.7.4) plugin is not directly compatible with ESLint `9.x` or with flat config. Utilities offered by ESLint enable this plugin to be used nevertheless:

- [@eslint/compat](https://www.npmjs.com/package/@eslint/compat)
- [@eslint/eslintrc](https://www.npmjs.com/package/@eslint/eslintrc) using the `FlatCompat` class

The recommended rules for both plugins are used: `cypress/recommended` and `plugin:chai-friendly/recommended`.
The recommended rules for both plugins are used: `pluginCypress.configs.recommended` and `pluginChaiFriendly.configs.recommended`:

```shell
npm install @eslint/compat @eslint/eslintrc eslint-plugin-chai-friendly --save-dev
npm install eslint-plugin-chai-friendly@^0.8.0 --save-dev
```

```js
import { fixupConfigRules } from '@eslint/compat'
import { FlatCompat } from '@eslint/eslintrc'
import pluginCypress from 'eslint-plugin-cypress/flat'
const compat = new FlatCompat()
import pluginChaiFriendly from 'eslint-plugin-chai-friendly'
export default [
pluginCypress.configs.recommended,
pluginChaiFriendly.configs.recommended,
{
rules: {
'cypress/no-unnecessary-waiting': 'off',
},
...fixupConfigRules(
compat.config(
{
extends: [
'plugin:chai-friendly/recommended'
],

}
)
)
}]
}
]
```

0 comments on commit 4d9b581

Please sign in to comment.