From 7b93dbdc447486971a7c23675d014dfaaa7cc6b8 Mon Sep 17 00:00:00 2001 From: zanminkian Date: Sat, 23 Nov 2024 08:35:57 +0000 Subject: [PATCH] feat(eslint-config): remove some deprecated rules and enable some rules --- .../eslint-config/src/config/typescript.ts | 19 +++++++++++++++---- .../src/rules/no-relative-parent-imports.ts | 2 +- .../src/rules/call-arguments-length.ts | 4 ++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/eslint-config/src/config/typescript.ts b/packages/eslint-config/src/config/typescript.ts index f3710989..5c41f08a 100644 --- a/packages/eslint-config/src/config/typescript.ts +++ b/packages/eslint-config/src/config/typescript.ts @@ -188,13 +188,12 @@ export function typescript(project?: string) { "@typescript-eslint/no-unnecessary-type-assertion": "error", "@typescript-eslint/no-unnecessary-type-constraint": "error", "@typescript-eslint/no-unsafe-declaration-merging": "error", - // '@typescript-eslint/no-unsafe-function-type': "error", - // "@typescript-eslint/no-wrapper-object-types": "error", + "@typescript-eslint/no-unsafe-function-type": "error", + "@typescript-eslint/no-wrapper-object-types": "error", "@typescript-eslint/prefer-as-const": "error", "@typescript-eslint/prefer-function-type": "error", "@typescript-eslint/prefer-optional-chain": "error", "@typescript-eslint/prefer-readonly": "error", - "@typescript-eslint/prefer-ts-expect-error": "error", "@typescript-eslint/restrict-plus-operands": [ "error", { @@ -203,9 +202,21 @@ export function typescript(project?: string) { allowNullish: false, allowNumberAndString: false, allowRegExp: false, + skipCompoundAssignments: false, + }, + ], + "@typescript-eslint/restrict-template-expressions": [ + "error", + { + allow: [], + // allowAny: false, + allowBoolean: false, + allowNever: false, + allowNullish: false, + allowNumber: false, + allowRegExp: false, }, ], - // "@typescript-eslint/restrict-template-expressions": "error", "@typescript-eslint/return-await": ["error", "always"], "@typescript-eslint/switch-exhaustiveness-check": [ "error", diff --git a/packages/eslint-plugin-esm/src/rules/no-relative-parent-imports.ts b/packages/eslint-plugin-esm/src/rules/no-relative-parent-imports.ts index da65937e..702be6b0 100644 --- a/packages/eslint-plugin-esm/src/rules/no-relative-parent-imports.ts +++ b/packages/eslint-plugin-esm/src/rules/no-relative-parent-imports.ts @@ -9,5 +9,5 @@ export const noRelativeParentImports = createRule({ }); function checkDepth(_filename: string, source: string) { - return new RegExp(`^(\\.\\./){${depth},}`).test(source); + return new RegExp(`^(\\.\\./){${depth.toString()},}`).test(source); } diff --git a/packages/eslint-plugin/src/rules/call-arguments-length.ts b/packages/eslint-plugin/src/rules/call-arguments-length.ts index 0a8f3f76..92da47f4 100644 --- a/packages/eslint-plugin/src/rules/call-arguments-length.ts +++ b/packages/eslint-plugin/src/rules/call-arguments-length.ts @@ -30,14 +30,14 @@ const rule: Rule.RuleModule = { expectedLength && "min" in expectedLength ) { - result.push(`>= ${expectedLength.min}`); + result.push(`>= ${String(expectedLength.min)}`); } if ( typeof expectedLength === "object" && expectedLength && "max" in expectedLength ) { - result.push(`<= ${expectedLength.max}`); + result.push(`<= ${String(expectedLength.max)}`); } return result.join(" and "); };