Skip to content

Commit

Permalink
tuning typescript experience with better rules
Browse files Browse the repository at this point in the history
  • Loading branch information
zemd committed Jan 5, 2025
1 parent 269a181 commit 17183be
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-pans-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zemd/eslint-flat-config": patch
---

Tuning typescript experience with better rules
2 changes: 2 additions & 0 deletions src/configs/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export default function javascript(): Array<Linter.Config> {
...eslint.rules,
...unicorn.rules,
...sonarjs.configs.recommended.rules,
"sonarjs/no-clear-text-protocols": ["off"],
"sonarjs/no-useless-intersection": ["off"],
...comments.configs.recommended.rules,
},
},
Expand Down
22 changes: 22 additions & 0 deletions src/rules/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ export const rules: Linter.RulesRecord = {
"error",
{ fixStyle: "inline-type-imports" },
],
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
// "@typescript-eslint/explicit-function-return-type": [
// // https://typescript-eslint.io/rules/explicit-function-return-type/
// "error",
Expand Down Expand Up @@ -74,6 +86,15 @@ export const rules: Linter.RulesRecord = {
// should not be forced by default, turn on when you really need it
"off",
],
"@typescript-eslint/no-empty-object-type": [
// https://typescript-eslint.io/rules/no-empty-object-type/
// should not be forced by default, turn on when you really need it
"off",
],
"@typescript-eslint/no-unnecessary-type-parameters": [
// should not be forced by default, turn on when you really need it
"off",
],
};

export default <Feature>{
Expand All @@ -90,5 +111,6 @@ export default <Feature>{
// disabling default eslint rule and using @typescript-eslint/no-unused-vars instead
// to avoid unnecessary errors for type definitions
"no-unused-vars": ["off"],
"no-dupe-class-members": ["off"],
},
};

0 comments on commit 17183be

Please sign in to comment.