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(linter): add fixer for eslint/no-new-wrappers #4771

Closed
wants to merge 1 commit into from
Closed

feat(linter): add fixer for eslint/no-new-wrappers #4771

wants to merge 1 commit into from

Conversation

heygsc
Copy link
Contributor

@heygsc heygsc commented Aug 9, 2024

part of #4179

Copy link

graphite-app bot commented Aug 9, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added the A-linter Area - Linter label Aug 9, 2024
Copy link

codspeed-hq bot commented Aug 9, 2024

CodSpeed Performance Report

Merging #4771 will not alter performance

Comparing heygsc:fixer-no-new-wrappers (9c4f260) with main (63f274c)

Summary

✅ 29 untouched benchmarks

@@ -91,5 +100,27 @@ fn test() {
",
];

Tester::new(NoNewWrappers::NAME, pass, fail).test_and_snapshot();
let fix = vec![
("var a = new String('hello');", "var a = String('hello');"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you, I'm sorry, could I refuse this fixer? This changes the code meaning and seems String('hello') is not also good:

typeof new String('hello') // 'object'
typeof String("hello")

I'd like 'hello', but it will have other edge cases:

new Number(1).toString() // original code

1.toString() // SyntaxError

It's acceptable and more safe to change one by one manually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, I'm sorry, could I refuse this fixer? This changes the code meaning and seems String('hello') is not also good:

typeof new String('hello') // 'object'
typeof String("hello")

I'd like 'hello', but it will have other edge cases:

new Number(1).toString() // original code

1.toString() // SyntaxError

It's acceptable and more safe to change one by one manually.

That makes sense.

@heygsc heygsc closed this Aug 9, 2024
@heygsc heygsc deleted the fixer-no-new-wrappers branch August 9, 2024 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants