eslint-plugin-chai-friendly
eslint-plugin-chai-friendly copied to clipboard
feat: add eslint api v9 compatibility
- closes https://github.com/ihordiachenko/eslint-plugin-chai-friendly/issues/32
Issue
Running the following in this repo (currently based on [email protected]):
npm ci
npm test
results in the deprecation warning:
(node:29800) DeprecationWarning: "no-unused-expressions" rule is using
context.getAncestors()
, which is deprecated and will be removed in ESLint v9. Please usesourceCode.getAncestors()
instead.
Change
Use the information in the blog post Preparing your custom rules for ESLint v9.0.0 from Sep 26, 2023 from the section context.getAncestors() to update the rule lib/rules/no-unused-expressions.js so that it is compatible with ESLint v9
and with earlier ESLint versions.
Verification
Deprecation
Confirm that deprecation is resolved by executing:
npm ci
npm test
Verify that no deprecation warning is output and that all tests pass (81 passing).
Backwards compatibility
Install an earlier version of ESLint (8.0.0
), before the replacement method SourceCode#getAncestors(node)
was added, and confirm that tests continue to pass (81 passing).
npm install [email protected]
npm test