Useless function call is not removed by plugin-remove-useless-functions
See original GitHub issueHi there 👋
It could be that the plugin I’m looking for exists, but I can’t find the one.
I have the next statement:
const test = (fn, value) => {
return (a => fn(a))(value);
}
const test(console.log, 42);
I want it to be transformed to
const test = (fn, value) => {
return fn(value);
}
const test(console.log, 42);
I expected that plugin-remove-useless-functions does the thing, but it doesn’t.
What’s the best way I can solve the issue?
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
putout/README.md at master - GitHub
Perfection is finally attained not when there is no longer anything to add, ... remove console.log calls ... @putout/plugin-remove-useless-functions · npm.
Read more >putout - npm Package Health Analysis - Snyk
The npm package putout was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as...
Read more >no-useless-call - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Compare Versions | putout | npm - Open Source Insights
Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json.
Read more >putout/ChangeLog - UNPKG
66, - feature(@putout/plugin-remove-useless-await) add suppoort of not async functions. 67, - feature(putout) bin: disable remove-empty/import, ESM: disable ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just checked how the
remove-iife
plugin works. Here some extra cases I checked:Result:
fn(value)
Expected:fn(42)
ornoTransform()
.Result:
fn(value)
Expected:fn(value, 42)
ornoTransform()
.Result:
fn(value)
Expected:fn({customProp: value.x})
ornoTransform()
What do you think?
Just landed to @putout/plugin-remove-iife, it’s more related 😃.
You can try it in 🐊Putout
v27.8.0
🎉