From 68630282d1701aeef15020f9384905d5c18250d4 Mon Sep 17 00:00:00 2001 From: Shahar Dawn Or Date: Tue, 10 Jan 2023 14:37:52 +0700 Subject: [PATCH] test: correct 'all plugin rules are considered' Co-authored-by: Rostislav Simonik --- src/index.test.ts | 57 +++++++++-------------------------------------- 1 file changed, 11 insertions(+), 46 deletions(-) diff --git a/src/index.test.ts b/src/index.test.ts index 5ece2be2..9f289607 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -362,69 +362,41 @@ test('all plugin rules are considered', (t) => { // This serves as a todo list and should ideally eventually end up empty // and then fail upon plugin upgrades where new rules are released. const notYetConsideredRules: string[] = [ - 'adjacent-overload-signatures', - 'array-type', 'await-thenable', 'ban-ts-comment', 'ban-tslint-comment', 'ban-types', 'class-literal-property-style', 'consistent-generic-constructors', - 'consistent-indexed-object-style', - 'consistent-type-assertions', - 'consistent-type-definitions', 'consistent-type-exports', 'consistent-type-imports', 'default-param-last', - 'explicit-function-return-type', 'explicit-member-accessibility', 'explicit-module-boundary-types', 'init-declarations', - 'member-delimiter-style', 'member-ordering', - 'method-signature-style', - 'naming-convention', - 'no-base-to-string', 'no-confusing-non-null-assertion', - 'no-confusing-void-expression', 'no-duplicate-enum-values', 'no-duplicate-imports', - 'no-dynamic-delete', 'no-empty-function', - 'no-empty-interface', 'no-explicit-any', - 'no-extra-non-null-assertion', 'no-extra-semi', - 'no-extraneous-class', - 'no-floating-promises', - 'no-for-in-array', 'no-implicit-any-catch', - 'no-implied-eval', 'no-inferrable-types', 'no-invalid-this', - 'no-invalid-void-type', 'no-loop-func', 'no-magic-numbers', 'no-meaningless-void-operator', - 'no-misused-new', - 'no-misused-promises', - 'no-namespace', 'no-non-null-asserted-nullish-coalescing', - 'no-non-null-asserted-optional-chain', - 'no-non-null-assertion', 'no-parameter-properties', 'no-redundant-type-constituents', 'no-require-imports', 'no-restricted-imports', 'no-shadow', - 'no-this-alias', 'no-type-alias', - 'no-unnecessary-boolean-literal-compare', 'no-unnecessary-condition', 'no-unnecessary-qualifier', 'no-unnecessary-type-arguments', - 'no-unnecessary-type-assertion', - 'no-unnecessary-type-constraint', 'no-unsafe-argument', 'no-unsafe-assignment', 'no-unsafe-call', @@ -432,43 +404,36 @@ test('all plugin rules are considered', (t) => { 'no-unsafe-member-access', 'no-unsafe-return', 'no-useless-empty-export', - 'no-var-requires', 'non-nullable-type-assertion-style', 'padding-line-between-statements', 'parameter-properties', 'prefer-as-const', 'prefer-enum-initializers', 'prefer-for-of', - 'prefer-function-type', - 'prefer-includes', 'prefer-literal-enum-member', 'prefer-namespace-keyword', - 'prefer-nullish-coalescing', - 'prefer-optional-chain', - 'prefer-readonly', 'prefer-readonly-parameter-types', - 'prefer-reduce-type-parameter', 'prefer-regexp-exec', 'prefer-return-this-type', 'prefer-string-starts-ends-with', - 'prefer-ts-expect-error', - 'promise-function-async', - 'require-array-sort-compare', 'require-await', - 'restrict-plus-operands', - 'restrict-template-expressions', - 'return-await', 'sort-type-constituents', 'sort-type-union-intersection-members', - 'strict-boolean-expressions', 'switch-exhaustiveness-check', - 'triple-slash-reference', - 'type-annotation-spacing', 'typedef', 'unbound-method', 'unified-signatures' ] + const assertNotInOurRules = (rule: string): void => { + const typescriptRule = `@typescript-eslint/${rule}` + t.false(Object.keys(ourRules).includes(typescriptRule), `Actually, the rule ${typescriptRule} is included!`) + } + intentionallyExcludedRules.forEach(assertNotInOurRules) + notYetConsideredRules.forEach(assertNotInOurRules) const inexplicablyExcludedRules = Object.keys(typescriptEslintRules) - .filter((rule) => !Object.keys(ourRules).includes(rule) && !intentionallyExcludedRules.includes(rule) && !notYetConsideredRules.includes(rule)) - t.deepEqual(inexplicablyExcludedRules, []) + .filter((rule) => { + const typescriptRule = `@typescript-eslint/${rule}` + return !Object.keys(ourRules).includes(typescriptRule) && !intentionallyExcludedRules.includes(rule) && !notYetConsideredRules.includes(rule) + }) + t.deepEqual(inexplicablyExcludedRules, [], 'rules inexplicably excluded') })