Open jstcki opened 8 years ago
I think it's too early for this. Also what about mutating in self contained functions? E.g. reducers?
But interesting way to be immutable without library overhead.
You can always disable rules per line if you know what you're doing (like console.log
in dev mode). This doesn't prevent you from doing anything. It's just linting :smile:
Why's this too early? Because of the plugin's maturity or something else?
E.g. this should do the trick
const arrIndex = arr.reduce((index, d) => {
index[d.id] = d; //eslint-disable-line no-mutation
return index;
}, {});
Yeah plugin maturity and I'd like to see how it works in real applications. I'm aware that I can disable it on a line, file and project basis ;-)
I do like it conceptional. But it is a major step to say we write everything immutably by default. I'd like to see how big the impact is on a average data visualization component where we're not just using react.
Does the plugin detect mutation through functions? e.g. arr.reduce((acc, d) => { acc.set(d.id, id); return acc; }, new Map())
On Thu, Mar 10, 2016 at 12:29 PM Thomas Preusse notifications@github.com wrote:
Yeah plugin maturity and I'd like to see how it works in real applications. I'm aware that I can disable it on a line, file and project basis ;-)
I do like it conceptional. But it is a major step to say we write everything immutably by default. I'd like to see how big the impact is on a average data visualization component where we're not just using react.
— Reply to this email directly or view it on GitHub https://github.com/interactivethings/eslint-config-interactivethings/issues/7#issuecomment-194800496 .
At least the
no-mutation
rule looks quite useful.https://github.com/jhusain/eslint-plugin-immutable