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

Commit 3576cf1

Browse files
committed
Add rule @typescript-eslint/no-parameter-properties
1 parent bb76c88 commit 3576cf1

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { InterfaceNamePrefixRule } from './interface-name-prefix';
44
import type { MemberOrderingRule } from './member-ordering';
55
import type { NoExplicitAnyRule } from './no-explicit-any';
66
import type { NoInferrableTypesRule } from './no-inferrable-types';
7+
import type { NoParameterPropertiesRule } from './no-parameter-properties';
78

89
/**
910
* All @typescript-eslint rules.
@@ -13,4 +14,5 @@ export type TypeScriptEslintRules = BanTsCommentRule &
1314
InterfaceNamePrefixRule &
1415
MemberOrderingRule &
1516
NoExplicitAnyRule &
16-
NoInferrableTypesRule;
17+
NoInferrableTypesRule &
18+
NoParameterPropertiesRule;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Option.
5+
*/
6+
export type NoParameterPropertiesOption = {
7+
/**
8+
* @see [allows](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.md#options)
9+
*/
10+
allows?: ['readonly', 'private', 'protected', 'public', 'private readonly', 'protected readonly', 'public readonly'];
11+
};
12+
13+
/**
14+
* Options.
15+
*/
16+
export type NoParameterPropertiesOptions = [NoParameterPropertiesOption?];
17+
18+
/**
19+
* Disallow the use of parameter properties in class constructors.
20+
*
21+
* @see [no-parameter-properties](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.md)
22+
*/
23+
export type NoParameterPropertiesRuleConfig = RuleConfig<NoParameterPropertiesOptions>;
24+
25+
/**
26+
* Disallow the use of parameter properties in class constructors.
27+
*
28+
* @see [no-parameter-properties](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.md)
29+
*/
30+
export interface NoParameterPropertiesRule {
31+
/**
32+
* Disallow the use of parameter properties in class constructors.
33+
*
34+
* @see [no-parameter-properties](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.md)
35+
*/
36+
'@typescript-eslint/no-parameter-properties': NoParameterPropertiesRuleConfig;
37+
}

0 commit comments

Comments
 (0)