From ecb9b6b758f4287b71a95aaef4c85fd1cffc0272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Verit=C3=A9=20Mugabo?= Date: Sat, 11 Nov 2023 22:38:56 -0500 Subject: [PATCH] Revert "fix: export the "unbound-method" rule (#286)" (#288) This reverts commit 62240e508a7423864215fdef8c038a0d476c2590. --- README.md | 19 +------------------ docs/rules/unbound-method.md | 2 +- src/index.ts | 6 +++--- tests/unbound-method.test.ts | 4 ++-- 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 0c24383..3f96e79 100644 --- a/README.md +++ b/README.md @@ -170,27 +170,10 @@ export default [ | [require-top-level-describe](docs/rules/require-top-level-describe.md) | Enforce that all tests are in a top-level describe | | 🌐 | | | | [valid-describe-callback](docs/rules/valid-describe-callback.md) | Enforce valid describe callback | ✅ | | | | | [valid-expect](docs/rules/valid-expect.md) | Enforce valid `expect()` usage | ✅ | | | | - -#### Requires Type Checking - -| Name | Description | 💼 | ⚠️ | 🔧 | 💡 | ❌ | -| :--------------------------------------------- | :----------------------------------------------------------- | :-- | :-- | :-- | :-- | :-- | -| [unbound-method](docs/rules/unbound-method.md) | Enforce unbound methods are called with their expected scope | | | | | | +| [valid-title](docs/rules/valid-title.md) | Enforce valid titles | ✅ | | 🔧 | | -In order to use the rules powered by TypeScript type-checking, you must be using -`@typescript-eslint/parser` & adjust your eslint config as outlined -[here](https://typescript-eslint.io/linting/typed-linting). - -Note that unlike the type-checking rules in `@typescript-eslint/eslint-plugin`, -the rules here will fallback to doing nothing if type information is not -available, meaning it's safe to include them in shared configs that could be -used on JavaScript and TypeScript projects. - -Also note that `unbound-method` depends on `@typescript-eslint/eslint-plugin`, -as it extends the original `unbound-method` rule from that plugin. - #### Credits - [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) diff --git a/docs/rules/unbound-method.md b/docs/rules/unbound-method.md index fee527d..515c6b4 100644 --- a/docs/rules/unbound-method.md +++ b/docs/rules/unbound-method.md @@ -6,7 +6,7 @@ -This rule extends the base [`@typescript-eslint/unbound-method`][https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unbound-method.md] +This rule extends the base [`@typescript-eslint/unbound-method`][original-rule] rule, meaning you must depend on `@typescript-eslint/eslint-plugin` for it to work. It adds support for understanding when it's ok to pass an unbound method to `expect` calls. diff --git a/src/index.ts b/src/index.ts index 1091d7c..839c3fd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -47,7 +47,7 @@ import preferTodo, { RULE_NAME as preferTodoName } from './rules/prefer-todo' import preferSpyOn, { RULE_NAME as preferSpyOnName } from './rules/prefer-spy-on' import preferComparisonMatcher, { RULE_NAME as preferComparisonMatcherName } from './rules/prefer-comparison-matcher' import preferToContain, { RULE_NAME as preferToContainName } from './rules/prefer-to-contain' -import unboundMethod, { RULE_NAME as unboundMethodName } from './rules/unbound-method' +// import unboundMethod, { RULE_NAME as unboundMethodName } from './rules/unbound-method' const createConfig = (rules: Record) => ({ plugins: ['vitest'], @@ -165,8 +165,8 @@ export default { [preferTodoName]: preferTodo, [preferSpyOnName]: preferSpyOn, [preferComparisonMatcherName]: preferComparisonMatcher, - [preferToContainName]: preferToContain, - [unboundMethodName]: unboundMethod + [preferToContainName]: preferToContain + // [unboundMethodName]: unboundMethod }, configs: { all: createConfig(allRules), diff --git a/tests/unbound-method.test.ts b/tests/unbound-method.test.ts index 31f6c2f..3319d38 100644 --- a/tests/unbound-method.test.ts +++ b/tests/unbound-method.test.ts @@ -32,7 +32,7 @@ ruleTester.run('unbound-method', unboundMethod, { logArrowBound(); logManualBind();`, - skip: false + skip: true } ], invalid: [ @@ -48,7 +48,7 @@ ruleTester.run('unbound-method', unboundMethod, { Promise.resolve().then(console.log); `, - skip: false, + skip: true, errors: [ { line: 10,