-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle 'no-unused-expressions' violations due to use of Chai expect #3
Comments
Can you give a short example of the test with expression you wrote that errored so we can test this? |
Sure: const onRequest = ({ request }) => {
expect(request.body.email.billingUpdate).to.be.true
expect(request.body.phone.documentUpdate).to.be.false
} |
👋Here's discussion about this topic eslint/eslint#2102 |
Eslint decided to not address this issue as it is library specific. It seems that the best fix for this would be to add the eslint-plugin-chai-friendly plugin to our eslint config or some similar configuration to ignore chai's |
@jennifer-shehane Just tested this out. Works great and still catches errors not related to Cypress/Chai. 👍 |
Because of the way ESLint plugins work, we can't bundle a plugin with our plugin and have it "just work". The user still needs to install the chai plugin manually as their own dependency. If we include the rule and a user doesn't install the plugin (which they might not even need if they're not using the So instead, I'm going to document this in the README. |
Resurrecting an old issue, but there is now a way to bundle plugins together: https://www.npmjs.com/package/@rushstack/eslint-patch As used by airbnb, for example: https://github.com/vuejs/eslint-config-airbnb/blob/main/packages/eslint-config-airbnb/CHANGELOG.md#700 |
Using a Chai expect expression in a test with the StandardJS ESLint config will throw the ESLint error:
Since Chai is bundled with Cypress I think it only makes sense that eslint-plugin-cypress handle this without the user having to install a separate plugin to handle Chai expressions.
The text was updated successfully, but these errors were encountered: