eslint-plugin-unicorn
eslint-plugin-unicorn copied to clipboard
missing TypeScript declaration file
Now that ESLint 9 is released and everyone is migrating to flat config, importing the plugin into a flat config by following the official documentation actually results in a red squiggly line, because no declaration file exists (when using checkJs and/or @ts-check).
I suspect many/most users will be using TypeScript to validate that their new flat configs do not have typos in them. Thus, shipping a declaration file for this plugin would really be appreciated!
same here
Types already available https://github.com/eslint-types/define-config-plugin-types/tree/main/types/unicorn
Maybe @Shinigami92 can help us move to this repo?
Types already available eslint-types/define-config-plugin-types@
main/types/unicornMaybe @Shinigami92 can help us move to this repo?
I can try to help, but unfortunate I currently have much todo with maintaining node-pg-migrate, @faker-js/faker and private work, plus vacation & enjoying a bit of rest-freetime for my own ^^'
Right now I'm also not migrated to eslint v9 and all current tries are resulting in failures somehow, especially due to eslint-plugin-deprecation 😖
There is also a post by @nzakas that the eslint v8->v9 migration path will get a bit more stabilization in "near" future.
If someone wants to tackle a PR for unicorn, have a look into my script https://github.com/eslint-types/define-config-plugin-types/blob/main/scripts/generate-plugin-dts.ts and take everything needed to build up a starting base for unicorn types itself.
Then I assume they just need to be bundled into one index.d.ts and shipped via package.json "types" field.
Here's a workaround that shuts up typescript. It's not much of use because it does not validate rules. In fact I'm not sure how rules validation could even be made to work in typescript.
declare module "eslint-plugin-unicorn" {
import type {Eslint} from "eslint";
const plugin: Eslint.Plugin;
export = plugin;
}
In fact I'm not sure how
rulesvalidation could even be made to work in typescript.
declare module "eslint-plugin-unicorn" {
import type { TSESLint } from "@typescript-eslint/utils";
import type { ConfigWithExtends } from "typescript-eslint";
type Configs = "recommended" | "all" | "flat/recommended" | "flat/all";
interface PluginUnicorn extends TSESLint.FlatConfig.Plugin {
configs: Record<Configs, ConfigWithExtends>;
}
export = plugin as PluginUnicorn;
}