From 4d9b581cc81bbd4f778a9d87f1ac022f676116e2 Mon Sep 17 00:00:00 2001 From: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Date: Thu, 23 May 2024 17:52:20 +0200 Subject: [PATCH] update eslint-plugin-chai-friendly@0.8.0 documentation --- FLAT-CONFIG.md | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/FLAT-CONFIG.md b/FLAT-CONFIG.md index b37c4e8..e5c014e 100644 --- a/FLAT-CONFIG.md +++ b/FLAT-CONFIG.md @@ -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' - ], - - } - ) - ) - }] + } +] ```