Add ESLint rules to enforce existing lib style (#621)

Adds a few rules that enforce consistency across the repo.

Only change is one top-level const arrow function is now a function
definition.
This commit is contained in:
filtered
2025-02-27 05:12:26 +11:00
committed by GitHub
parent 7e6b64f216
commit c166a34fd8
2 changed files with 5 additions and 1 deletions

View File

@@ -225,6 +225,10 @@ export default tseslint.config(
"antfu/consistent-chaining": "error",
"antfu/consistent-list-newline": "error",
"antfu/curly": "error",
"antfu/import-dedupe": "error",
"antfu/no-import-dist": "error",
"antfu/no-ts-export-equal": "error",
"antfu/top-level-function": "error",
},
},

View File

@@ -13,6 +13,6 @@ export function toClass<P, C>(cls: new (plain: P) => C, obj: P | C): C {
/**
* Checks if an object is an instance of {@link IColorable}.
*/
export const isColorable = (obj: unknown): obj is IColorable => {
export function isColorable(obj: unknown): obj is IColorable {
return typeof obj === "object" && obj !== null && "setColorOption" in obj && "getColorOption" in obj
}