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

feat: [M3-8741] - Add linter rules for common pr feedback points #11258

Conversation

pmakode-akamai
Copy link
Contributor

@pmakode-akamai pmakode-akamai commented Nov 14, 2024

Description 📝

Looking through recent contributions from external teams, there are some rules we can consider adding to reduce common feedback points.

note: I didn't find a way to "Enforce boolean values are not used as types (as per the ticket)" because using true/false as types is valid TS behavior.

Changes 🔄

  • Remove existing camelCase rule as it is not working
  • Enforce new camelCase rule
  • Enforce self closing tags for JSX elements without children
  • Enforce no explicit "any"
  • Enforce some missing eslint rules in api-v4, manager, validation, and ui package

Target release date 🗓️

N/A

How to test 🧪

  • Ensure any existing violations of the new rules trigger warnings/errors in your IDE
  • Ensure everything builds properly

As an Author, I have considered 🤔

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@pmakode-akamai pmakode-akamai self-assigned this Nov 14, 2024
@pmakode-akamai pmakode-akamai changed the title change: [M3-8741] - Add linter rules for common pr feedback points feat: [M3-8741] - Add linter rules for common pr feedback points Nov 14, 2024
@pmakode-akamai pmakode-akamai force-pushed the M3-8741-add-linter-rules-for-common-pr-feedback-points branch from 5b627a3 to e93ddb4 Compare November 15, 2024 11:06
@pmakode-akamai pmakode-akamai force-pushed the M3-8741-add-linter-rules-for-common-pr-feedback-points branch from e93ddb4 to 6a7ada3 Compare November 19, 2024 06:14
@pmakode-akamai pmakode-akamai marked this pull request as ready for review November 19, 2024 06:19
@pmakode-akamai pmakode-akamai requested a review from a team as a code owner November 19, 2024 06:19
@pmakode-akamai
Copy link
Contributor Author

As per the ticket, I'm unsure if we should really remove the argsIgnorePattern ('^_') from the 'no-unused-vars' rule. If removed, we'd get warnings for unused arguments like _ in cases such as onChange={(_, selectedOption) => {}}

I haven't removed it yet, but I’m wondering if we should keep it or not.

Copy link

Coverage Report:
Base Coverage: 86.88%
Current Coverage: 86.88%

"no-console": "error",
"no-undef-init": "off",
"radix": "error",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-namespace": "warn",
"@typescript-eslint/camelcase": "off",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the existing camelCase rule from packages (as it was not working), and added a new one for the necessary packages

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🎉 453 passing tests on test run #6 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing453 Passing2 Skipped89m 58s

Copy link
Contributor

@jaalah-akamai jaalah-akamai left a comment

Choose a reason for hiding this comment

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

✅ CamelCase rule is working
✅ Warns when there's any
✅ Checks for self-closing tags when necessary
✅ Builds properly

@jaalah-akamai jaalah-akamai added the Add'tl Approval Needed Waiting on another approval! label Nov 20, 2024
Copy link
Contributor

@dwiley-akamai dwiley-akamai left a comment

Choose a reason for hiding this comment

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

no-explicit-any is enforced ✅
camelcase warning is enforced ✅
self-closing-comp is enforced for components and HTML tags ✅
No issues building ✅
All checks pass ✅

@dwiley-akamai
Copy link
Contributor

As per the ticket, I'm unsure if we should really remove the argsIgnorePattern ('^_') from the 'no-unused-vars' rule. If removed, we'd get warnings for unused arguments like _ in cases such as onChange={(_, selectedOption) => {}}

I haven't removed it yet, but I’m wondering if we should keep it or not.

I would be in favor of keeping it; I would prefer not to get warnings in cases like that.

@hkhalil-akamai hkhalil-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! Ready for Review labels Nov 20, 2024
@pmakode-akamai pmakode-akamai merged commit 654d24c into linode:develop Nov 21, 2024
23 checks passed
Copy link

cypress bot commented Nov 21, 2024

Cloud Manager E2E    Run #6858

Run Properties:  status check failed Failed #6858  •  git commit 654d24c4ad: feat: [M3-8741] - Add linter rules for common pr feedback points (#11258)
Project Cloud Manager E2E
Branch Review develop
Run status status check failed Failed #6858
Run duration 30m 53s
Commit git commit 654d24c4ad: feat: [M3-8741] - Add linter rules for common pr feedback points (#11258)
Committer Purvesh Makode
View all properties for this run ↗︎

Test results
Tests that failed  Failures 3
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 451
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/e2e/core/linodes/linode-storage.spec.ts • 3 failed tests

View Output Video

Test Artifacts
linode storage tab > delete disk Screenshots Video
linode storage tab > add a disk Screenshots Video
linode storage tab > resize disk Screenshots Video

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants