Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support augmented global properties #233

Closed
Shinigami92 opened this issue Sep 22, 2023 · 4 comments · Fixed by #238
Closed

Support augmented global properties #233

Shinigami92 opened this issue Sep 22, 2023 · 4 comments · Fixed by #238
Assignees
Labels
enhancement New feature or request

Comments

@Shinigami92
Copy link
Collaborator

Vue has something like this: https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties

@antfu suggested to try out to support this, so plugin authors can define their own TypeScript definitions and eslint-define-config would then just use these.

So code in the specific plugin projects would look like this:

import type { DeprecationRuleConfig } from './rules/deprecation/deprecation';

declare module 'eslint-define-config' {
  interface Rules {
    /**
     * Do not use deprecated APIs.
     *
     * @see [deprecation](https://github.com/gund/eslint-plugin-deprecation)
     */
    'deprecation/deprecation'?: DeprecationRuleConfig;
  }
}
import type { AdjacentOverloadSignaturesRuleConfig } from './rules/typescript-eslint/adjacent-overload-signatures';
// ...

declare module 'eslint-define-config' {
  interface Rules {
    /**
     * Require that function overload signatures be consecutive.
     *
     * @see [adjacent-overload-signatures](https://typescript-eslint.io/rules/adjacent-overload-signatures)
     */
    '@typescript-eslint/adjacent-overload-signatures'?: AdjacentOverloadSignaturesRuleConfig;
    // ...
  }
}
@ST-DDT
Copy link

ST-DDT commented Sep 24, 2023

When this is explored, maybe it is time to move this library/feature to the eslint main repository. 🤔

@antfu
Copy link
Collaborator

antfu commented Sep 25, 2023

That would be nice, especially now with the Flat Config users can alias plugins to have different prefixes, this would also such configs still provide type safety

@Shinigami92
Copy link
Collaborator Author

@Shinigami92
Copy link
Collaborator Author

Started some first experiments, and it seems to work 🚀

temp

@Shinigami92 Shinigami92 self-assigned this Oct 6, 2023
@Shinigami92 Shinigami92 added the enhancement New feature or request label Oct 6, 2023
@Shinigami92 Shinigami92 pinned this issue Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants