Repository: eslint/eslint
File: lib/types/rules/ecmascript-6.d.ts (TypeScript)

Code before:

    /**
     * Rule to disallow specified modules when loaded by `import`.
     *
     * @since 2.0.0-alpha-1
     * @see https://eslint.org/docs/rules/no-restricted-imports
     */
    "no-restricted-imports": Linter.RuleEntry<
        [
            ...Array<
                | string
                | ({
                      name: string;
                      message?: string;
                      importNames?: string[];
                      allowImportNames?: string[];
                  } & (
                      | { importNames?: string[]; allowImportNames?: never }
                      | { allowImportNames?: string[]; importNames?: never }
                  ))
                | Partial<{
                      paths: Array<
                          | string
                          | ({
                                name: string;
                                message?: string;
                                importNames?: string[];
                                allowImportNames?: string[];
                            } & (
                                | {
                                      importNames?: string[];
                                      allowImportNames?: never;
                                  }
                                | {
                                      allowImportNames?: string[];
                                      importNames?: never;
                                  }
                            ))
                      >;
                      patterns: Array<
                          string | ValidNoRestrictedImportPatternOptions
                      >;
                  }>
            >
        ]
    >;

    /**
     * Rule to disallow `this`/`super` before calling `super()` in constructors.
     *
     * @remarks

Review comment (refactor):
[Style] This is getting to be pretty deep & complex 😅. Suggestion: extract out the reused portions into named interfaces, such as the two `{ importNames?: ...; allowImportNames?: ... }` shapes?

For example, the `ValidNoRestrictedImportPatternOptions` type could look something like:

```ts
type ValidNoRestrictedImportPatternOptions =
  NoRestrictedImportPatternCommonOptions &
    EitherGroupOrRegEx &
    EitherNameSpecifiers;
```

It might also make sense to write a utility type to generate the _"union of objects, where each only allows one property"_ types. [`type-fest`](https://github.com/sindresorhus/type-fest)'s [`MergeExclusive`](https://github.com/sindresorhus/type-fest/blob/3d473d1f8b0ec5820e1f3aaf7965b68784423778/source/merge-exclusive.d.ts) does that for just two. [Here's a playground for a type that allows arbitrary objects](https://www.typescriptlang.org/play/?exactOptionalPropertyTypes=true#code/C4TwDgpgBA6glsAFgewK7ADwBUA0UDSEIAggDanIDuEAJlBAB7AQB2NAzlANZHIBmULAD4oAXigBvAL5QAZJIBQUKAG1CIAJIsWEAE5Q4LKAFEGAY1KoaEDDxD9BedWQrUaQgLoB+AFxQdAG56ANwKUqEKoJBQAApwZlzEbNhO9EysHNy8AsJikjLyEkqqMQZG+B5+WCoxHqHhCpHg0HEJSTQAInDsAIbkVADySHrsKQRELlS0acxsnHYOuaLF8q2JybjjJP1uQiuwCCjoY847tEIRUdAAqixwyCwAYsi6AyykIG8Q6tgi4tJyRTKNRlLL2HKVWLxdadbp9VxDRAjE4XMIqBYQy7NKAANT6cBoADlkAAlCDsYC6eLMGgaAC2YBewBiPWAzF0LAGYGA9xYnH+BSgt15z1e70+Oh+RWU8Ko9MZumAhJ6dIgLLZehYfgpVJYAHMVHVirLKPKmcrVextZTDAajco4AzzSq1az2VqoDrbYbQg6nYqLeTrbq7fVUQprBYerpoGYHhSoMhubyrbj8UTSeSbWYaWbFer3VyefGInABAAKJPFvkAOkdCqVLvYAEogYnkyXigB6LtQAB6XjCQA), with `{} &`s added to get TypeScript to print the type nicely after narrowing. 🤷 that might be a bit heavyweight for just this one rule's types though.

Code after:
                    namedFrom: boolean;
                    /**
                     * @default false
                     */
                    namespaceFrom: boolean;
                }>;
            }>,
        ]
    >;

    /**
     * Rule to disallow specified modules when loaded by `import`.
     *
     * @since 2.0.0-alpha-1
     * @see https://eslint.org/docs/rules/no-restricted-imports
     */
    "no-restricted-imports": Linter.RuleEntry<
        [
            ...Array<
                | string
                | ValidNoRestrictedImportPathOptions
                | Partial<{
                      paths: Array<string | ValidNoRestrictedImportPathOptions>;
                      patterns: Array<string | ValidNoRestrictedImportPatternOptions>;
                  }>
            >
        ]
    >;

    /**
     * Rule to disallow `this`/`super` before calling `super()` in constructors.
     *
     * @remarks
     * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
     *
     * @since 0.24.0
     * @see https://eslint.org/docs/rules/no-this-before-super
     */
    "no-this-before-super": Linter.RuleEntry<[]>;

    /**
     * Rule to disallow unnecessary computed property keys in object literals.
     *
     * @since 2.9.0
     * @see https://eslint.org/docs/rules/no-useless-computed-key
     */
    "no-useless-computed-key": Linter.RuleEntry<
        [
            Partial<{
                /**
                 * @default true