Skip to content

Commit

Permalink
Update eslint-plugin-eslint-plugin (#1563)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Nov 1, 2021
1 parent d4ce499 commit 9c03a78
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
5 changes: 2 additions & 3 deletions package.json
Expand Up @@ -65,7 +65,7 @@
"enquirer": "2.3.6",
"eslint": "^8.0.0",
"eslint-ava-rule-tester": "^4.0.0",
"eslint-plugin-eslint-plugin": "^4.0.1",
"eslint-plugin-eslint-plugin": "^4.0.2",
"eslint-remote-tester": "^2.0.1",
"eslint-remote-tester-repositories": "^0.0.3",
"execa": "^5.1.1",
Expand Down Expand Up @@ -134,8 +134,7 @@
],
"eslint-plugin/require-meta-docs-url": "off",
"eslint-plugin/require-meta-has-suggestions": "off",
"eslint-plugin/require-meta-schema": "off",
"eslint-plugin/no-deprecated-context-methods": "off"
"eslint-plugin/require-meta-schema": "off"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion rules/no-unused-properties.js
Expand Up @@ -90,7 +90,7 @@ const create = context => {
return property.key.value;
}

return context.getSource(property.key);
return context.getSourceCode().getText(property.key);
};

const checkProperty = (property, references, path) => {
Expand Down
2 changes: 1 addition & 1 deletion rules/no-useless-undefined.js
Expand Up @@ -172,7 +172,7 @@ const create = context => {
start = previousArgument.range[1];
} else {
// If all arguments removed, and there is trailing comma, we need remove it.
const tokenAfter = context.getTokenAfter(lastUndefined);
const tokenAfter = sourceCode.getTokenAfter(lastUndefined);
if (isCommaToken(tokenAfter)) {
end = tokenAfter.range[1];
}
Expand Down
7 changes: 4 additions & 3 deletions rules/prefer-optional-catch-binding.js
Expand Up @@ -30,14 +30,15 @@ const create = context => ({
messageId: type === 'Identifier' ? MESSAGE_ID_WITH_NAME : MESSAGE_ID_WITHOUT_NAME,
data: {name},
* fix(fixer) {
const tokenBefore = context.getTokenBefore(node);
const sourceCode = context.getSourceCode();
const tokenBefore = sourceCode.getTokenBefore(node);
assertToken(tokenBefore, {
test: isOpeningParenToken,
expected: '(',
ruleId: 'prefer-optional-catch-binding',
});

const tokenAfter = context.getTokenAfter(node);
const tokenAfter = sourceCode.getTokenAfter(node);
assertToken(tokenAfter, {
test: isClosingParenToken,
expected: ')',
Expand All @@ -50,7 +51,7 @@ const create = context => ({

const [, endOfClosingParenthesis] = tokenAfter.range;
const [startOfCatchClauseBody] = parent.body.range;
const text = context.getSourceCode().text.slice(endOfClosingParenthesis, startOfCatchClauseBody);
const text = sourceCode.text.slice(endOfClosingParenthesis, startOfCatchClauseBody);
const leadingSpacesLength = text.length - text.trimStart().length;
if (leadingSpacesLength !== 0) {
yield fixer.removeRange([endOfClosingParenthesis, endOfClosingParenthesis + leadingSpacesLength]);
Expand Down

0 comments on commit 9c03a78

Please sign in to comment.