Skip to content

Commit 07158e7

Browse files
authored
Merge pull request #11 from ovos/fix/cypress-chai-friendly
use `chai-friendly/no-unused-expressions` for cypress test files to allow `expect(foo).to.be.true` https://github.com/ihordiachenko/eslint-plugin-chai-friendly https://github.com/cypress-io/eslint-plugin-cypress#cypress-and-chai-recommended
2 parents 52890dc + 467a733 commit 07158e7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

eslint.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,14 @@ function customize(options: CustomizeOptions = {}) {
616616

617617
if (cypress) {
618618
const cypressPlugin = require('eslint-plugin-cypress/flat');
619+
const chaiFriendlyPlugin = require('eslint-plugin-chai-friendly');
619620
config.push({
620621
...cypressPlugin.configs.recommended,
621622
name: 'cypress',
623+
plugins: {
624+
...cypressPlugin.configs.recommended.plugins,
625+
'chai-friendly': chaiFriendlyPlugin,
626+
},
622627
files: [
623628
`${testsDir}/**/*.?(c|m)[jt]s`,
624629
'**/__tests__/**/*.?(c|m)[jt]s',
@@ -632,6 +637,10 @@ function customize(options: CustomizeOptions = {}) {
632637
// Still when `this` context needs to be accessed, a dev can easily convert an arrow function to a regular function.
633638
// This rule comes from our default config for `mocha`.
634639
'mocha/no-mocha-arrows': 'off',
640+
// allow 'expect(foo).to.be.true' https://github.com/ihordiachenko/eslint-plugin-chai-friendly
641+
'no-unused-expressions': 'off',
642+
'@typescript-eslint/no-unused-expressions': 'off',
643+
'chai-friendly/no-unused-expressions': shared['no-unused-expressions'],
635644
},
636645
});
637646
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@vitest/eslint-plugin": "^1.1.25",
2222
"eslint": "^9.19.0",
2323
"eslint-import-resolver-typescript": "^3.7.0",
24+
"eslint-plugin-chai-friendly": "^1.0.1",
2425
"eslint-plugin-check-file": "^2.8.0",
2526
"eslint-plugin-cypress": "^4.1.0",
2627
"eslint-plugin-import": "npm:eslint-plugin-import-x@^4.6.1",

0 commit comments

Comments
 (0)