Skip to content

Commit

Permalink
fix: update rule types (eslint#18925)
Browse files Browse the repository at this point in the history
* 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 ✨ <[email protected]>

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

Co-authored-by: Tanuj Kanti <[email protected]>

---------

Co-authored-by: Josh Goldberg ✨ <[email protected]>
Co-authored-by: Nicholas C. Zakas <[email protected]>
Co-authored-by: Tanuj Kanti <[email protected]>
  • Loading branch information
4 people authored Oct 8, 2024
1 parent f879be2 commit 064c8b6
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 91 deletions.
26 changes: 24 additions & 2 deletions lib/types/rules/best-practices.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ export interface BestPractices extends Linter.RulesRecord {
* @default false
*/
allowEmptyCase: boolean;
/**
* @default false
*/
reportUnusedFallthroughComment: boolean;
}>,
]
>;
Expand Down Expand Up @@ -872,6 +876,15 @@ export interface BestPractices extends Linter.RulesRecord {
*/
"no-unused-labels": Linter.RuleEntry<[]>;

/**
* Disallow variable assignments when the value is not used
*
*
* @since 9.0.0-alpha.1
* @see https://eslint.org/docs/latest/rules/no-useless-assignment
*/
"no-useless-assignment": Linter.RuleEntry<[]>;

/**
* Disallow useless backreferences in regular expressions
*
Expand Down Expand Up @@ -1045,12 +1058,21 @@ export interface BestPractices extends Linter.RulesRecord {
"require-await": Linter.RuleEntry<[]>;

/**
* Rule to enforce the use of `u` flag on RegExp.
* Enforce the use of `u` or `v` flag on RegExp
*
* @since 5.3.0
* @see https://eslint.org/docs/rules/require-unicode-regexp
*/
"require-unicode-regexp": Linter.RuleEntry<[]>;
"require-unicode-regexp": Linter.RuleEntry<
[
Partial<{
/**
* @default false
*/
requireFlag: "u" | "v";
}>,
]
>;

/**
* Rule to require `var` declarations be placed at the top of their containing scope.
Expand Down
95 changes: 18 additions & 77 deletions lib/types/rules/deprecated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,24 @@ export interface Deprecated extends Linter.RulesRecord {
*/
"no-negated-in-lhs": Linter.RuleEntry<[]>;

/**
* Rule to disallow `Object` constructors.
*
* @since 0.0.9
* @deprecated since 8.50.0, use [`no-object-constructor`](https://eslint.org/docs/rules/no-object-constructor) instead.
* @see https://eslint.org/docs/rules/no-object-constructor
*/
"no-new-object": Linter.RuleEntry<[]>;

/**
* Rule to disallow `new` operators with the `Symbol` object.
*
* @since 2.0.0-beta.1
* @deprecated since 8.27.0, use [`no-new-native-nonconstructor`](https://eslint.org/docs/rules/no-new-native-nonconstructor) instead.
* @see https://eslint.org/docs/rules/no-new-symbol
*/
"no-new-symbol": Linter.RuleEntry<[]>;

/**
* Rule to disallow spacing between function identifiers and their applications.
*
Expand All @@ -214,81 +232,4 @@ export interface Deprecated extends Linter.RulesRecord {
}>,
]
>;

/**
* Rule to require JSDoc comments.
*
* @since 1.4.0
* @deprecated since 5.10.0
* @see https://eslint.org/docs/rules/require-jsdoc
*/
"require-jsdoc": Linter.RuleEntry<
[
Partial<{
require: Partial<{
/**
* @default true
*/
FunctionDeclaration: boolean;
/**
* @default false
*/
MethodDefinition: boolean;
/**
* @default false
*/
ClassDeclaration: boolean;
/**
* @default false
*/
ArrowFunctionExpression: boolean;
/**
* @default false
*/
FunctionExpression: boolean;
}>;
}>,
]
>;

/**
* Rule to enforce valid JSDoc comments.
*
* @since 0.4.0
* @deprecated since 5.10.0
* @see https://eslint.org/docs/rules/valid-jsdoc
*/
"valid-jsdoc": Linter.RuleEntry<
[
Partial<{
prefer: Record<string, string>;
preferType: Record<string, string>;
/**
* @default true
*/
requireReturn: boolean;
/**
* @default true
*/
requireReturnType: boolean;
/**
* @remarks
* Also accept for regular expression pattern
*/
matchDescription: string;
/**
* @default true
*/
requireParamDescription: boolean;
/**
* @default true
*/
requireReturnDescription: boolean;
/**
* @default true
*/
requireParamType: boolean;
}>,
]
>;
}
21 changes: 15 additions & 6 deletions lib/types/rules/ecmascript-6.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ export interface ECMAScript6 extends Linter.RulesRecord {
>;

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

/**
* Rule to disallow specified names in exports.
Expand Down Expand Up @@ -324,7 +324,16 @@ export interface ECMAScript6 extends Linter.RulesRecord {
* @since 2.9.0
* @see https://eslint.org/docs/rules/no-useless-computed-key
*/
"no-useless-computed-key": Linter.RuleEntry<[]>;
"no-useless-computed-key": Linter.RuleEntry<
[
Partial<{
/**
* @default true
*/
enforceForClassMembers: boolean;
}>,
]
>;

/**
* Rule to disallow unnecessary constructors.
Expand Down
21 changes: 16 additions & 5 deletions lib/types/rules/stylistic-issues.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ export interface StylisticIssues extends Linter.RulesRecord {
* @default false
*/
allowArrowFunctions: boolean;
overrides: {
namedExports: "declaration" | "expression" | "ignore";
}
}>,
]
>;
Expand Down Expand Up @@ -870,7 +873,15 @@ export interface StylisticIssues extends Linter.RulesRecord {
*/
"lines-between-class-members": Linter.RuleEntry<
[
"always" | "never",
"always" | "never" | {
enforce: Array<
{
blankLine: "always" | "never";
prev: "method" | "field" | "*";
next: "method" | "field" | "*";
}
>
},
Partial<{
/**
* @default false
Expand Down Expand Up @@ -1279,12 +1290,12 @@ export interface StylisticIssues extends Linter.RulesRecord {
"no-nested-ternary": Linter.RuleEntry<[]>;

/**
* Rule to disallow `Object` constructors.
* Rule to disallow calls to the `Object` constructor without an argument
*
* @since 0.0.9
* @see https://eslint.org/docs/rules/no-new-object
* @since 8.50.0
* @see https://eslint.org/docs/rules/no-object-constructor
*/
"no-new-object": Linter.RuleEntry<[]>;
"no-object-constructor": Linter.RuleEntry<[]>;

/**
* Rule to disallow the unary operators `++` and `--`.
Expand Down
10 changes: 9 additions & 1 deletion lib/types/rules/variables.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,19 @@ export interface Variables extends Linter.RulesRecord {
ignoreRestSiblings: boolean;
argsIgnorePattern: string;
/**
* @default 'none'
* @default 'all'
*/
caughtErrors: "none" | "all";
caughtErrorsIgnorePattern: string;
destructuredArrayIgnorePattern: string;
/**
* @default false
*/
ignoreClassWithStaticInitBlock: boolean;
/**
* @default false
*/
reportUsedIgnorePattern: boolean;
}>,
]
>;
Expand Down

0 comments on commit 064c8b6

Please sign in to comment.