Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Add eslint-plugin-immutable rules #7

Open
jstcki opened this issue Mar 10, 2016 · 5 comments
Open

Add eslint-plugin-immutable rules #7

jstcki opened this issue Mar 10, 2016 · 5 comments
Labels

Comments

@jstcki
Copy link
Contributor

jstcki commented Mar 10, 2016

At least the no-mutation rule looks quite useful.

https://github.com/jhusain/eslint-plugin-immutable

@jstcki jstcki mentioned this issue Mar 10, 2016
4 tasks
@jstcki jstcki added this to the 3.0 milestone Mar 10, 2016
@tpreusse
Copy link
Contributor

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.

@jstcki
Copy link
Contributor Author

jstcki commented Mar 10, 2016

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 😄

Why's this too early? Because of the plugin's maturity or something else?

@jstcki
Copy link
Contributor Author

jstcki commented Mar 10, 2016

E.g. this should do the trick

const arrIndex = arr.reduce((index, d) => {
 index[d.id] = d; //eslint-disable-line no-mutation
 return index;
}, {});

@tpreusse
Copy link
Contributor

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.

@wereHamster
Copy link
Member

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 [email protected]
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
#7 (comment)
.

@jstcki jstcki removed this from the 3.0 milestone May 31, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants