Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to opt-out of eslint-plugin-react #279

Closed
zcuric opened this issue Oct 22, 2019 · 5 comments · Fixed by #308
Closed

Option to opt-out of eslint-plugin-react #279

zcuric opened this issue Oct 22, 2019 · 5 comments · Fixed by #308
Labels
kind: feature New feature or request

Comments

@zcuric
Copy link

zcuric commented Oct 22, 2019

Current Behavior

tsdx supports eslint-plugin-react outof the box. If React is not used this warning pops up:

Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. Assuming latest React version for linting.

Desired Behavior

Opt-out of eslint plugins that are not in used. For example, I'm using tsdx to build a logger plugin for a specific library. I don't need .eslintrc extendingreact-app, because my work is only node related.

Suggested Solution

My suggestion is to remove any dedicated eslint plugin except the ones that are typescript and prettier related. User would manually add additional rules to the project if needed, for example eslint-plugin-vue, and configure it in the local .eslintrc. This way tsdx remains decoupled from any specific library.

Who does this impact? Who is this for?

TypeScript users that develop plugins, libraries for NodeJS.

@arthurdenner
Copy link
Contributor

@zcuric, I looked into this and noticed that, in order to remove the warning thrown by eslint-plugin-react, we would need to change tsdx quite a lot because there is no way to ignore this message on the plugin that react-app is using it under the hood.

And also, we can't remove react-app from the extends list if the project doesn't have react as a (dev)dependency because that would cause other issues since it handles a lot more stuff - like TypeScript parsing.

If @jaredpalmer is on board with this, I'd like to work on a change, but I'm not sure if it's worth. The warning is harmless anyway.

@zcuric
Copy link
Author

zcuric commented Oct 30, 2019

@arthurdenner tsdx is great tool and I know that authors are very tied to react ecosystem, but my reasoning is: to make the tool better is to decouple it from any specific framework and provide the basis to develop any kind of TS library, regardless of environment. Not just removing specific eslint plugins, but all that specific coupled stuff.

Sadly, I'm not experienced in TS that much for a proper contribution to the project, but from what I see, this could be done.

@arthurdenner
Copy link
Contributor

@zcuric, as I said, it definitely can be done. If you want to work on it, you just have to change the ESLint config that is created on the lint command. My point was that we are currently using a tool that handles more than just React, so removing it requires more changes and I'll wait for some input from maintainers to suggest some changes.

@JustFly1984
Copy link

JustFly1984 commented Nov 1, 2019

As I understand, react-app is part of dependencies for templates. I think if you move ./src to sub directory and manage dependencies for project in separate package.json from templates, you can get rid of stuff which is not directly required by tsdx itself. I have tried to get rid of react-app myself, but without restructuring directories I could not do it myself.

@swyxio
Copy link
Collaborator

swyxio commented Nov 4, 2019

@arthurdenner i'd be happy to accept a PR for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants