|
2 | 2 |
|
3 | 3 | 💼 This rule is enabled in the following configs: `currying`, ☑️ `lite`, ✅ `recommended`, 🔒 `strict`.
|
4 | 4 |
|
| 5 | +💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting). |
| 6 | + |
5 | 7 | <!-- end auto-generated rule header -->
|
6 | 8 |
|
7 | 9 | Disallow use of rest parameters, the `arguments` keyword and enforces that functions take at least 1 parameter.
|
8 | 10 |
|
| 11 | +Note: type information is only required when using the [overrides](#overrides) option. |
| 12 | + |
9 | 13 | ## Rule Details
|
10 | 14 |
|
11 | 15 | In functions, `arguments` is a special variable that is implicitly available.
|
@@ -65,6 +69,17 @@ type Options = {
|
65 | 69 | ignoreIIFE: boolean;
|
66 | 70 | ignoreGettersAndSetters: boolean;
|
67 | 71 | };
|
| 72 | + overrides?: Array< |
| 73 | + { |
| 74 | + match: TypeDeclarationSpecifier | TypeDeclarationSpecifier[]; |
| 75 | + options: { |
| 76 | + allowRestParameter: boolean; |
| 77 | + allowArgumentsKeyword: boolean; |
| 78 | + enforceParameterCount: "see above"; |
| 79 | + }; |
| 80 | + disable: boolean; |
| 81 | + } |
| 82 | + >; |
68 | 83 | ignoreIdentifierPattern?: string[] | string;
|
69 | 84 | ignorePrefixSelector?: string[] | string;
|
70 | 85 | };
|
@@ -170,6 +185,26 @@ If true, this option allows for the use of [IIFEs](https://developer.mozilla.org
|
170 | 185 |
|
171 | 186 | Getters should always take zero parameters, and setter one. If for some reason you want to treat these function like any other function, then you can set this option to `false`.
|
172 | 187 |
|
| 188 | +### `overrides` |
| 189 | + |
| 190 | +Allows for applying overrides to the options based on where the function's type is defined. |
| 191 | +This can be used to override the settings for types coming from 3rd party libraries. |
| 192 | + |
| 193 | +Note: Using this option requires type infomation. |
| 194 | +Note 2: Only the first matching override will be used. |
| 195 | + |
| 196 | +#### `overrides[n].specifiers` |
| 197 | + |
| 198 | +A specifier, or an array of specifiers to match the function type against. |
| 199 | + |
| 200 | +#### `overrides[n].options` |
| 201 | + |
| 202 | +The options to use when a specifiers matches. |
| 203 | + |
| 204 | +#### `overrides[n].disable` |
| 205 | + |
| 206 | +If true, when a specifier matches, this rule will not be applied to the matching node. |
| 207 | + |
173 | 208 | ### `ignorePrefixSelector`
|
174 | 209 |
|
175 | 210 | This allows for ignore functions where one of the given selectors matches the parent node in the AST of the function node.\
|
|
0 commit comments