Skip to content

Commit

Permalink
feat(eslint-config): remove some deprecated rules and enable some rules
Browse files Browse the repository at this point in the history
  • Loading branch information
zanminkian committed Nov 23, 2024
1 parent 55cf874 commit 7b93dbd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
19 changes: 15 additions & 4 deletions packages/eslint-config/src/config/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
{
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions packages/eslint-plugin/src/rules/call-arguments-length.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ");
};
Expand Down

0 comments on commit 7b93dbd

Please sign in to comment.