@putout/plugin-remove-useless-computed
🐊Putout plugin adds ability to remove useless `computed`
Last updated 3 months ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-remove-useless-computed 
SYNC missed versions from official npm registry.

@putout/plugin-remove-useless-computed NPM version

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-computed

Rule

{
    "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

Current Tags

  • 1.0.1                                ...           latest (3 months ago)

2 Versions

  • 1.0.1                                ...           3 months ago
  • 1.0.0                                ...           3 months ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (6)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE