Create-react-app: [Discussion] Deactivating new-cap rule (Immutable.js user)

Created on 20 Aug 2016  Â·  6Comments  Â·  Source: facebook/create-react-app

Hello!

I just tried out create-react app and it's pretty cool! However, I'm an heavy user of Immutable and the eslint new-cap rule does not behave well with it (activated by default).

For now, I'm deactivating the rule on a per-file basis so that's not such a big issue! But I can't seem to be able to deactivate it project-wide in the package.json (it actually works on my editor, but not on the dev server ...).

To tackle this issue, I see two possibilities:

  • Find a way to get the dev server reading the project's eslint configuration in package.json (that would be cool to have that working anyway! => I'll try to take a look myself 😉 if it's possible)
  • Have a discussion around the new-cap rule that isn't universally liked (and discouraged when used with immutable, I'll point to you one comment from @leebyron on this: https://github.com/eslint/eslint/issues/2023#issuecomment-80255655, not saying we should get rid of it because he said so but I'd like to see what others think about it too!)

Thank you again for this project, hope this discussion will help make it even better!

Most helpful comment

We should disable that rule. It shouldn't have been in our config in the first place.

All 6 comments

We should disable that rule. It shouldn't have been in our config in the first place.

Happy to merge a PR that removes it.

@gaearon Was planning to do that 😉, lemme just finish a small thing at work here…

@gaearon, that didn't took much time anyway so here it is: #470

Why don't you add an exception for Immutable?

"new-cap": [2, { "capIsNewExceptionPattern" : "^Immutable\\.." }]

PS: About immutable new-cap convention: https://github.com/facebook/immutable-js/issues/10

We don't want to special-case Immutable here, IMO it would just be more confusing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

barcher picture barcher  Â·  3Comments

onelson picture onelson  Â·  3Comments

ap13p picture ap13p  Â·  3Comments

alleroux picture alleroux  Â·  3Comments

fson picture fson  Â·  3Comments