@putout/plugin-remove-useless-computed
v1.0.1
Published
🐊Putout plugin adds ability to remove useless `computed`
Maintainers
Readme
@putout/plugin-remove-useless-computed 
The object initializer syntax also supports computed property names. That allows you to put an expression in square brackets
[], that will be computed and used as the property name.(c) MDN
🐊Putout plugin adds ability to remove useless computed.
Checkout in 🐊Putout Editor.
Install
npm i @putout/plugin-remove-useless-computedRule
{
"rules": {
"remove-useless-computed": "on"
}
}❌ Example of incorrect code
export const replace = {
['section("@select", select(__args))']: ({__args}, path) => {
__args.unshift(identifier('id'));
return path;
},
};✅ Example of correct code
export const replace = {
'section("@select", select(__args))': ({__args}, path) => {
__args.unshift(identifier('id'));
return path;
},
};Comparison
Linter | Rule | Fix
--------|-------|------------|
🐊 Putout | remove-useless-computed | ✅
⏣ ESLint | no-useless-computed-key | ✅
License
MIT
