Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(eslint-plugin): [ban-ts-comment] change default for `ts-expect-e…
…rror` to `allow-with-description` (#2351)

BREAKING CHANGE:

Default rule options is a breaking change.
Fixes #2146
  • Loading branch information
bradzacher committed Aug 29, 2020
1 parent c70f54f commit a3f163a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/eslint-plugin/docs/rules/ban-ts-comment.md
Expand Up @@ -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,
Expand Down
20 changes: 9 additions & 11 deletions packages/eslint-plugin/src/rules/ban-ts-comment.ts
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit a3f163a

Please sign in to comment.