eslint-plugin-chai-friendly icon indicating copy to clipboard operation
eslint-plugin-chai-friendly copied to clipboard

feat: add eslint api v9 compatibility

Open MikeMcC399 opened this issue 9 months ago • 0 comments

  • 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 use sourceCode.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

MikeMcC399 avatar May 13 '24 11:05 MikeMcC399