From 30c1fcb3f177fa82b069e73e816f9ed8ad028cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Mon, 8 May 2023 06:41:51 +0200 Subject: [PATCH] Replace deprecated `context#getSourceCode()` for new `context#sourceCode` See https://github.com/eslint/eslint/pull/17107 --- README.md | 2 +- lib/rule-composer.js | 4 ++-- package.json | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ffd8e13..d295356 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ module.exports = ruleComposer.joinReports([ semiRule, context => ({ ClassProperty(node) { - if (context.getSourceCode().getLastToken(node).value !== ';') { + if (context.sourceCode.getLastToken(node).value !== ';') { context.report({ node, message: 'Missing semicolon.' }) } } diff --git a/lib/rule-composer.js b/lib/rule-composer.js index 4d44993..578200e 100644 --- a/lib/rule-composer.js +++ b/lib/rule-composer.js @@ -126,7 +126,7 @@ module.exports = Object.freeze({ return Object.freeze({ create(context) { const filename = context.getFilename(); - const sourceCode = context.getSourceCode(); + const sourceCode = context.sourceCode; const settings = context.settings; const options = context.options; return getRuleCreateFunc(rule)( @@ -158,7 +158,7 @@ module.exports = Object.freeze({ return Object.freeze({ create(context) { const filename = context.getFilename(); - const sourceCode = context.getSourceCode(); + const sourceCode = context.sourceCode; const settings = context.settings; const options = context.options; return getRuleCreateFunc(rule)( diff --git a/package.json b/package.json index 1959999..c826bfd 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,9 @@ "mocha": "^10.2.0", "typescript": "^5.0.4" }, + "peerDependencies": { + "eslint": "^8.40.0" + }, "engines": { "node": ">=8.3.0" }