sindresorhus/eslint-plugin-unicorn
Improve DX around `prefer-global-this` in TypeScript files
已关闭
#2,488 创建于 2024年10月25日
docsenhancementhelp wanted
仓库指标
- 星标
- (5,022 个星标)
- PR 合并指标
- (平均合并 4小时 30分钟) (30 天内合并 26 个 PR)
描述
A lot of types in the wild are either only set on Window or differ between window.* and globalThis.*. These types are wrong, but they do come up when this rule is applied.
There are a few ways that this rule can help with the migration:
- disable the rule's auto-fix in TS files
- extend the message to specify how to specify the type
- suggest solutions in the rule's readme
Examples:
- https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2482
- https://github.com/xojs/eslint-config-xo-typescript/issues/91
- https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2468
Originally posted by @fregante in https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2482#issuecomment-2424797467