From c166a34fd8cc3f50cd77583e96ceea7ddc0346f2 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Thu, 27 Feb 2025 05:12:26 +1100 Subject: [PATCH] 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. --- eslint.config.js | 4 ++++ src/utils/type.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index 34e59abaf..8592e57d9 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -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", }, }, diff --git a/src/utils/type.ts b/src/utils/type.ts index 0b1be57b8..03758e7cb 100644 --- a/src/utils/type.ts +++ b/src/utils/type.ts @@ -13,6 +13,6 @@ export function toClass(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 }