Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
G-Rath committed Aug 28, 2022
1 parent f4dd97a commit 7c1389e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
19 changes: 0 additions & 19 deletions src/rules/__tests__/unbound-method.test.ts
Expand Up @@ -182,25 +182,6 @@ describe('error handling', () => {
},
);
});

describe('when "project" is not set', () => {
const ruleTester = new ESLintUtils.RuleTester({
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
tsconfigRootDir: rootPath,
},
});

ruleTester.run(
'unbound-method jest edition without "project" property',
requireRule(false),
{
valid: validTestCases.concat(invalidTestCases.map(({ code }) => code)),
invalid: [],
},
);
});
});

ruleTester.run('unbound-method jest edition', requireRule(false), {
Expand Down
12 changes: 1 addition & 11 deletions src/rules/unbound-method.ts
Expand Up @@ -33,16 +33,6 @@ const baseRule = (() => {
}
})();

const tryCreateBaseRule = (
context: Readonly<TSESLint.RuleContext<MessageIds, Options>>,
) => {
try {
return baseRule?.create(context);
} catch {
return null;
}
};

interface Config {
ignoreStatic: boolean;
}
Expand Down Expand Up @@ -75,7 +65,7 @@ export default createRule<Options, MessageIds>({
},
},
create(context) {
const baseSelectors = tryCreateBaseRule(context);
const baseSelectors = baseRule?.create(context);

if (!baseSelectors) {
return {};
Expand Down

0 comments on commit 7c1389e

Please sign in to comment.