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

Commit 0e45a3e

Browse files
committed
Add rule @typescript-eslint/no-explicit-any
1 parent b9e8e90 commit 0e45a3e

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

src/rules/typescript-eslint/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import type { BanTsCommentRule } from './ban-ts-comment';
22
import type { ExplicitFunctionReturnTypeRule } from './explicit-function-return-type';
33
import type { InterfaceNamePrefixRule } from './interface-name-prefix';
44
import type { MemberOrderingRule } from './member-ordering';
5+
import type { NoExplicitAnyRule } from './no-explicit-any';
56

67
/**
78
* All @typescript-eslint rules.
89
*/
910
export type TypeScriptEslintRules = BanTsCommentRule &
1011
ExplicitFunctionReturnTypeRule &
1112
InterfaceNamePrefixRule &
12-
MemberOrderingRule;
13+
MemberOrderingRule &
14+
NoExplicitAnyRule;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Option.
5+
*/
6+
export type NoExplicitAnyOption = {
7+
/**
8+
* If `true`, auto-fixing will be made available in which the "any" type is converted to an "unknown" type.
9+
*
10+
* @default false
11+
*/
12+
fixToUnknown: boolean;
13+
/**
14+
* Specify if arrays from the rest operator are considered okay.
15+
*
16+
* @default false
17+
*/
18+
ignoreRestArgs: boolean;
19+
};
20+
21+
/**
22+
* Options.
23+
*/
24+
export type NoExplicitAnyOptions = [NoExplicitAnyOption?];
25+
26+
/**
27+
* Disallow usage of the `any` type.
28+
*
29+
* @see [no-explicit-any](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md)
30+
*/
31+
export type NoExplicitAnyRuleConfig = RuleConfig<NoExplicitAnyOptions>;
32+
33+
/**
34+
* Disallow usage of the `any` type.
35+
*
36+
* @see [no-explicit-any](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md)
37+
*/
38+
export interface NoExplicitAnyRule {
39+
/**
40+
* Disallow usage of the `any` type.
41+
*
42+
* @see [no-explicit-any](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md)
43+
*/
44+
'@typescript-eslint/no-explicit-any': NoExplicitAnyRuleConfig;
45+
}

0 commit comments

Comments
 (0)