Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(unbound-method): don't suppress errors from base rule #1219

Merged
merged 1 commit into from Aug 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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