8000 fix: update rule types (#18925) · eslint/eslint@064c8b6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 064c8b6

Browse files
snitin315JoshuaKGoldbergnzakasTanujkanti4441
authored
fix: update rule types (#18925)
* fix: add missing type for `no-useless-assignment` * fix: update `func-style` types * fix: udpate types for `require-unicode-regexp` * fix: udpate types for `no-unused-vars` * fix: update `no-fallthrough` types * fix: update `no-useless-computed-key` types * fix: update `no-unused-vars` types * fix: remove valid-jsdoc & required-jsdoc types * fix: update `no-new-native-nonconstructor` types * fix: update `no-object-constructor` types * fix: update `lines-between-class-members` types * chore: remove unwanted change * chore: update lib/types/rules/deprecated.d.ts Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com> * Update lib/types/rules/ecmascript-6.d.ts Co-authored-by: Tanuj Kanti <86398394+Tanujkanti4441@users.noreply.github.com> --------- Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com> Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com> Co-authored-by: Tanuj Kanti <86398394+Tanujkanti4441@users.noreply.github.com>
1 parent f879be2 commit 064c8b6

File tree

5 files changed

+82
-91
lines changed

5 files changed

+82
-91
lines changed

lib/types/rules/best-practices.d.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,10 @@ export interface BestPractices extends Linter.RulesRecord {
417417
* @default false
418418
*/
419419
allowEmptyCase: boolean;
420+
/**
421+
* @default false
422+
*/
423+
reportUnusedFallthroughComment: boolean;
420424
}>,
421425
]
422426
>;
@@ -872,6 +876,15 @@ export interface BestPractices extends Linter.RulesRecord {
872876
*/
873877
"no-unused-labels": Linter.RuleEntry<[]>;
874878

879+
/**
880+
* Disallow variable assignments when the value is not used
881+
*
882+
*
883+
* @since 9.0.0-alpha.1
884+
* @see https://eslint.org/docs/latest/rules/no-useless-assignment
885+
*/
886+
"no-useless-assignment": Linter.RuleEntry<[]>;
887+
875888
/**
876889
* Disallow useless backreferences in regular expressions
877890
*
@@ -1045,12 +1058,21 @@ export interface BestPractices extends Linter.RulesRecord {
10451058
"require-await": Linter.RuleEntry<[]>;
10461059

10471060
/**
1048-
* Rule to enforce the use of `u` flag on RegExp.
1061+
* Enforce the use of `u` or `v` flag on RegExp
10491062
*
10501063
* @since 5.3.0
10511064
* @see https://eslint.org/docs/rules/require-unicode-regexp
10521065
*/
1053-
"require-unicode-regexp": Linter.RuleEntry<[]>;
1066+
"require-unicode-regexp": Linter.RuleEntry<
1067+
[
1068+
Partial<{
1069+
/**
1070+
* @default false
1071+
*/
1072+
requireFlag: "u" | "v";
1073+
}>,
1074+
]
1075+
>;
10541076

10551077
/**
10561078
* Rule to require `var` declarations be placed at the top of their containing scope.

lib/types/rules/deprecated.d.ts

Lines changed: 18 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@ export interface Deprecated extends Linter.RulesRecord {
191191
*/
192192
"no-negated-in-lhs": Linter.RuleEntry<[]>;
193193

194+
/**
195+
* Rule to disallow `Object` constructors.
196+
*
197+
* @since 0.0.9
198+
* @deprecated since 8.50.0, use [`no-object-constructor`](https://eslint.org/docs/rules/no-object-constructor) instead.
199+
* @see https://eslint.org/docs/rules/no-object-constructor
200+
*/
201+
"no-new-object": Linter.RuleEntry<[]>;
202+
203+
/**
204+
* Rule to disallow `new` operators with the `Symbol` object.
205+
*
206+
* @since 2.0.0-beta.1
207+
* @deprecated since 8.27.0, use [`no-new-native-nonconstructor`](https://eslint.org/docs/rules/no-new-native-nonconstructor) instead.
208+
* @see https://eslint.org/docs/rules/no-new-symbol
209+
*/
210+
"no-new-symbol": Linter.RuleEntry<[]>;
211+
194212
/**
195213
* Rule to disallow spacing between function identifiers and their applications.
196214
*
@@ -214,81 +232,4 @@ export interface Deprecated extends Linter.RulesRecord {
214232
}>,
215233
]
216234
>;
217-
218-
/**
219-
* Rule to require JSDoc comments.
220-
*
221-
* @since 1.4.0
222-
* @deprecated since 5.10.0
223-
* @see https://eslint.org/docs/rules/require-jsdoc
224-
*/
225-
"require-jsdoc": Linter.RuleEntry<
226-
[
227-
Partial<{
228-
require: Partial<{
229-
/**
230-
* @default true
231-
*/
232-
FunctionDeclaration: boolean;
233-
/**
234-
* @default false
235-
*/
236-
MethodDefinition: boolean;
237-
/**
238-
* @default false
239-
*/
240-
ClassDeclaration: boolean;
241-
/**
242-
* @default false
243-
*/
244-
ArrowFunctionExpression: boolean;
245-
/**
246-
* @default false
247-
*/
248-
FunctionExpression: boolean;
249-
}>;
250-
}>,
251-
]
252-
>;
253-
254-
/**
255-
* Rule to enforce valid JSDoc comments.
256-
*
257-
* @since 0.4.0
258-
* @deprecated since 5.10.0
259-
* @see https://eslint.org/docs/rules/valid-jsdoc
260-
*/
261-
"valid-jsdoc": Linter.RuleEntry<
262-
[
263-
Partial<{
264-
prefer: Record<string, string>;
265-
preferType: Record<string, string>;
266-
/**
267-
* @default true
268-
*/
269-
requireReturn: boolean;
270-
/**
271-
* @default true
272-
*/
273-
requireReturnType: boolean;
274-
/**
275-
* @remarks
276-
* Also accept for regular expression pattern
277-
*/
278-
matchDescription: string;
279-
/**
280-
* @default true
281-
*/
282-
requireParamDescription: boolean;
283-
/**
284-
* @default true
285-
*/
286-
requireReturnDescription: boolean;
287-
/**
288-
* @default true
289-
*/
290-
requireParamType: boolean;
291-
}>,
292-
]
293-
>;
294235
}

lib/types/rules/ecmascript-6.d.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ export interface ECMAScript6 extends Linter.RulesRecord {
221221
>;
222222

223223
/**
224-
* Rule to disallow `new` operators with the `Symbol` object.
225-
*
224+
* Rule to disallow `new` operator with global non-constructor functions
225+
*
226226
* @remarks
227227
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
228228
*
229-
* @since 2.0.0-beta.1
230-
* @see https://eslint.org/docs/rules/no-new-symbol
229+
* @since 8.27.0
230+
* @see https://eslint.org/docs/rules/no-new-native-nonconstructor
231231
*/
232-
"no-new-symbol": Linter.RuleEntry<[]>;
232+
"no-new-native-nonconstructor": Linter.RuleEntry<[]>;
233233

234234
/**
235235
* Rule to disallow specified names in exports.
@@ -324,7 +324,16 @@ export interface ECMAScript6 extends Linter.RulesRecord {
324324
* @since 2.9.0
325325
* @see https://eslint.org/docs/rules/no-useless-computed-key
326326
*/
327-
"no-useless-computed-key": Linter.RuleEntry<[]>;
327+
"no-useless-computed-key": Linter.RuleEntry<
328+
[
329+
Partial<{
330+
/**
331+
* @default true
332+
*/
333+
enforceForClassMembers: boolean;
334+
}>,
335+
]
336+
>;
328337

329338
/**
330339
* Rule to disallow unnecessary constructors.

lib/types/rules/stylistic-issues.d.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,9 @@ export interface StylisticIssues extends Linter.RulesRecord {
382382
* @default false
383383
*/
384384
allowArrowFunctions: boolean;
385+
overrides: {
386+
namedExports: "declaration" | "expression" | "ignore";
387+
}
385388
}>,
386389
]
387390
>;
@@ -870,7 +873,15 @@ export interface StylisticIssues extends Linter.RulesRecord {
870873
*/
871874
"lines-between-class-members": Linter.RuleEntry<
872875
[
873-
"always" | "never",
876+
"always" | "never" | {
877+
enforce: Array<
878+
{
879+
blankLine: "always" | "never";
880+
prev: "method" | "field" | "*";
881+
next: "method" | "field" | "*";
882+
}
883+
>
884+
},
874885
Partial<{
875886
/**
876887
* @default false
@@ -1279,12 +1290,12 @@ export interface StylisticIssues extends Linter.RulesRecord {
12791290
"no-nested-ternary": Linter.RuleEntry<[]>;
12801291

12811292
/**
1282-
* Rule to disallow `Object` constructors.
1293+
* Rule to disallow calls to the `Object` constructor without an argument
12831294
*
1284-
* @since 0.0.9
1285-
* @see https://eslint.org/docs/rules/no-new-object
1295+
* @since 8.50.0
1296+
* @see https://eslint.org/docs/rules/no-object-constructor
12861297
*/
1287-
"no-new-object": Linter.RuleEntry<[]>;
1298+
"no-object-constructor": Linter.RuleEntry<[]>;
12881299

12891300
/**
12901301
* Rule to disallow the unary operators `++` and `--`.

lib/types/rules/variables.d.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,19 @@ export interface Variables extends Linter.RulesRecord {
185185
ignoreRestSiblings: boolean;
186186
argsIgnorePattern: string;
187187
/**
188-
* @default 'none'
188+
* @default 'all'
189189
*/
190190
caughtErrors: "none" | "all";
191191
caughtErrorsIgnorePattern: string;
192192
destructuredArrayIgnorePattern: string;
193+
/**
194+
* @default false
195+
*/
196+
ignoreClassWithStaticInitBlock: boolean;
197+
/**
198+
* @default false
199+
*/
200+
reportUsedIgnorePattern: boolean;
193201
}>,
194202
]
195203
>;

0 commit comments

Comments
 (0)
0