Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci/enhance lint rules #8

Merged
merged 5 commits into from
Jun 10, 2023
Merged

ci/enhance lint rules #8

merged 5 commits into from
Jun 10, 2023

Conversation

moontai0724
Copy link
Member

@moontai0724 moontai0724 commented Jun 10, 2023

This PR enables all eslint rules, with following modifications:

Disabled Rules (required)

  • no-magic-numbers: this will wrongly detect a number passed to a function as a magic number.
  • new-cap: the decorators will be wrongly detected
  • class-methods-use-this: some methods are not using this

Disabled Rules (optional, in personal preference)

  • no-console: this will disable console.log, console.error, etc. This could be removed if we have our own logger.
  • one-var: I prefer to not merge variables to single annotation.
  • no-continue: preseve the possibility to use continue in loops.

Replaced Rules

  • no-useless-constructor: replaced by @typescript-eslint/no-useless-constructor to support typescript dummy variable annountation.
  • no-shadow: replaced by @typescript-eslint/no-shadow to better handle with typescript only types.
  • sort-imports: replaced by import and simple-import-sort to auto sort imports.

Attitional Rules

  • @typescript-eslint/consistent-type-imports: announce imports as type only import if not using its value.
  • padding-line-between-statements: to separete statments to enhance readability.

TypeScript ESLint Rules

This PR also enables all TypeScript ESLint rule but disabled some rules due to those rules are too strict. For detail, see .eslintrc.json#L41-L50

@moontai0724 moontai0724 added the enhancement New feature or request label Jun 10, 2023
@moontai0724 moontai0724 requested a review from a20688392 June 10, 2023 09:27
@moontai0724 moontai0724 self-assigned this Jun 10, 2023
@moontai0724 moontai0724 enabled auto-merge (squash) June 10, 2023 14:26
@moontai0724 moontai0724 disabled auto-merge June 10, 2023 14:26
@moontai0724 moontai0724 enabled auto-merge June 10, 2023 14:26
Copy link
Collaborator

@a20688392 a20688392 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this PR is to improve the code quality and set rules, I know that some modifications are to optimize the code, thanks for improving the code quality.

@moontai0724 moontai0724 merged commit 2921cba into develop Jun 10, 2023
@moontai0724 moontai0724 deleted the ci/enhance-lint-rules branch June 10, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants