Skip to content

Commit 7c1389e

Browse files
authoredAug 28, 2022
fix(unbound-method): don't suppress errors from base rule (#1219)
BREAKING CHANGE: errors thrown by the `unbound-method` base rule are no longer suppressed - really this means that if you don't specify `project` when this rule is enabled and `@typescript-eslint/eslint-plugin` is present, that error will no longer be suppressed instead of silently doing nothing; it will still not throw if this rule is enabled without the base rule being present
1 parent f4dd97a commit 7c1389e

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed
 

‎src/rules/__tests__/unbound-method.test.ts

-19
Original file line numberDiff line numberDiff line change
@@ -182,25 +182,6 @@ describe('error handling', () => {
182182
},
183183
);
184184
});
185-
186-
describe('when "project" is not set', () => {
187-
const ruleTester = new ESLintUtils.RuleTester({
188-
parser: '@typescript-eslint/parser',
189-
parserOptions: {
190-
sourceType: 'module',
191-
tsconfigRootDir: rootPath,
192-
},
193-
});
194-
195-
ruleTester.run(
196-
'unbound-method jest edition without "project" property',
197-
requireRule(false),
198-
{
199-
valid: validTestCases.concat(invalidTestCases.map(({ code }) => code)),
200-
invalid: [],
201-
},
202-
);
203-
});
204185
});
205186

206187
ruleTester.run('unbound-method jest edition', requireRule(false), {

‎src/rules/unbound-method.ts

+1-11
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ const baseRule = (() => {
3333
}
3434
})();
3535

36-
const tryCreateBaseRule = (
37-
context: Readonly<TSESLint.RuleContext<MessageIds, Options>>,
38-
) => {
39-
try {
40-
return baseRule?.create(context);
41-
} catch {
42-
return null;
43-
}
44-
};
45-
4636
interface Config {
4737
ignoreStatic: boolean;
4838
}
@@ -75,7 +65,7 @@ export default createRule<Options, MessageIds>({
7565
},
7666
},
7767
create(context) {
78-
const baseSelectors = tryCreateBaseRule(context);
68+
const baseSelectors = baseRule?.create(context);
7969

8070
if (!baseSelectors) {
8171
return {};

0 commit comments

Comments
 (0)
Please sign in to comment.