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

refactor: use optional chaining for improved readability and maintained functionality #1280

Closed
wants to merge 15 commits into from

Conversation

thebedigupta
Copy link
Contributor

Description
In this PR I worked on this issue link

I already added a test file where I captured all the tests that I performed test-results.txt

  • Simplified Null Check
  • Maintained functionality

This change addresses suggestions from SonarCloud to adopt modern JavaScript features.

Related issue(s)

Copy link

changeset-bot bot commented Oct 3, 2024

⚠️ No Changeset found

Latest commit: 78192c1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

thebedigupta and others added 6 commits October 4, 2024 00:24
By Mistake I stage this file I am really sorry for that
I used code formatter inside my local setup that why this confusion was created
Provide a detailed explanation in the file comment and remove unnecessary changes made by my code formatter.
Copy link
Contributor

Choose a reason for hiding this comment

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

Get back this file pls.

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unwanted comments from this file

get: () => {
// Using ?. to check if parameters and the key exist
// This is shorter and does the same thing as the old if statements
if (this.templateConfig.parameters?.[key] == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Here there's one condition also exists !self.templateConfig.parameters pls. add that also in validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check PR description where I mention the issue that I solved in this PR sonarcloud highlight the issue that Prefer using an optional chain expression instead, as it's more concise and easier to read. that's what I did if i implement one more codition !self.templateConfig.parameters then this PR makes no sense here I hope you understand

This change makes the code more concise and easier to read while maintaining the same functionality. It checks if either the parameters object doesn't exist or if the specific key is not defined within it.

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

please remove any changes to cli.js and any formatting changes you added to your PR

remove any unnecessary changes
Copy link

sonarcloud bot commented Oct 9, 2024

@thebedigupta
Copy link
Contributor Author

please remove any changes to cli.js and any formatting changes you added to your PR

I removed all kind of changes in the cli.js file

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

cli.js is still showing up in the list of modified files

@DhairyaMajmudar
Copy link
Contributor

Pls. have a look on the comment #1283 (comment) to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants