Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 079793e

Browse files
author
Christopher Quadflieg
committed
chore: add @typescript-eslint/ban-ts-comment rule
1 parent f8503ee commit 079793e

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

src/rules/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import type { EslintRules } from './eslint';
22
import type { RuleConfig } from './rule-config';
3+
import type { TypeScriptEslintRules } from './typescript-eslint';
34

45
/**
56
* Rules.
67
*
78
* @see [Rules](https://eslint.org/docs/user-guide/configuring/rules)
89
*/
9-
export type Rules = Partial<EslintRules> & Partial<Record<string, RuleConfig>>;
10+
export type Rules = Partial<EslintRules & TypeScriptEslintRules & Record<string, RuleConfig>>;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Option.
5+
*/
6+
export type BanTsCommentOption = {
7+
'ts-expect-error'?: boolean | 'allow-with-description';
8+
'ts-ignore'?: boolean | 'allow-with-description';
9+
'ts-nocheck'?: boolean | 'allow-with-description';
10+
'ts-check'?: boolean | 'allow-with-description';
11+
minimumDescriptionLength?: number;
12+
};
13+
14+
/**
15+
* Options.
16+
*/
17+
export type BanTsCommentOptions = [BanTsCommentOption?];
18+
19+
/**
20+
* Bans `@ts-<directive>` comments from being used or requires descriptions after directive.
21+
*
22+
* @see [ban-ts-comment](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md)
23+
*/
24+
export type BanTsCommentRuleConfig = RuleConfig<BanTsCommentOptions>;
25+
26+
/**
27+
* Bans `@ts-<directive>` comments from being used or requires descriptions after directive.
28+
*
29+
* @see [ban-ts-comment](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md)
30+
*/
31+
export interface BanTsCommentRule {
32+
/**
33+
* Bans `@ts-<directive>` comments from being used or requires descriptions after directive.
34+
*
35+
* @see [ban-ts-comment](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md)
36+
*/
37+
'@typescript-eslint/ban-ts-comment': BanTsCommentRuleConfig;
38+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import type { BanTsCommentRule } from './ban-ts-comment';
2+
3+
/**
4+
* All @typescript-eslint rules.
5+
*/
6+
export type TypeScriptEslintRules = BanTsCommentRule;

0 commit comments

Comments
 (0)