From a3f163abc03f0fefc6dca1f205b728a4425209e4 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 3 Aug 2020 09:19:34 -0700 Subject: [PATCH] feat(eslint-plugin): [ban-ts-comment] change default for `ts-expect-error` to `allow-with-description` (#2351) BREAKING CHANGE: Default rule options is a breaking change. Fixes #2146 --- .../docs/rules/ban-ts-comment.md | 2 +- .../eslint-plugin/src/rules/ban-ts-comment.ts | 20 +++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/ban-ts-comment.md b/packages/eslint-plugin/docs/rules/ban-ts-comment.md index 60e6508d3bd..2509793ebd3 100644 --- a/packages/eslint-plugin/docs/rules/ban-ts-comment.md +++ b/packages/eslint-plugin/docs/rules/ban-ts-comment.md @@ -29,7 +29,7 @@ interface Options { } const defaultOptions: Options = { - 'ts-expect-error': true, + 'ts-expect-error': 'allow-with-description', 'ts-ignore': true, 'ts-nocheck': true, 'ts-check': false, diff --git a/packages/eslint-plugin/src/rules/ban-ts-comment.ts b/packages/eslint-plugin/src/rules/ban-ts-comment.ts index 3eccf04ced2..f8c68841598 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-comment.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-comment.ts @@ -11,16 +11,6 @@ interface Options { export const defaultMinimumDescriptionLength = 3; -const defaultOptions: [Options] = [ - { - 'ts-expect-error': true, - 'ts-ignore': true, - 'ts-nocheck': true, - 'ts-check': false, - minimumDescriptionLength: defaultMinimumDescriptionLength, - }, -]; - type MessageIds = | 'tsDirectiveComment' | 'tsDirectiveCommentRequiresDescription'; @@ -98,7 +88,15 @@ export default util.createRule<[Options], MessageIds>({ }, ], }, - defaultOptions, + defaultOptions: [ + { + 'ts-expect-error': 'allow-with-description', + 'ts-ignore': true, + 'ts-nocheck': true, + 'ts-check': false, + minimumDescriptionLength: defaultMinimumDescriptionLength, + }, + ], create(context, [options]) { const tsCommentRegExp = /^\/*\s*@ts-(expect-error|ignore|check|nocheck)(.*)/; const sourceCode = context.getSourceCode();