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

How to disable eslint-config-react-app? #907

Closed
NARUTOne opened this issue Oct 16, 2020 · 2 comments
Closed

How to disable eslint-config-react-app? #907

NARUTOne opened this issue Oct 16, 2020 · 2 comments
Labels
kind: support Asking for support with something or a specific use case problem: removed issue template OP removed the issue template without good cause problem: stale Issue has not been responded to in some time solution: duplicate This issue or pull request already exists solution: workaround available There is a workaround available for this issue

Comments

@NARUTOne
Copy link

Current Behavior

React Hook "useCompose" is called in function "getWidgetProps" that is neither a React function component nor a custom React Hook function.eslint(react-hooks/rules-of-hooks)

Desired Behavior

Don't tip. This is only function. The current project is a pure library of tools using Typescript

It doesn't work.

module.exports = {
  "extends": [
    // "react-app",
    "prettier/@typescript-eslint",
    "plugin:prettier/recommended"
  ],
  "settings": {
    // "react": {
    //   "version": "999.999.999"
    // }
  }
}

Suggested Solution

Who does this impact? Who is this for?

Describe alternatives you've considered

Additional context

@agilgur5 agilgur5 added the problem: removed issue template OP removed the issue template without good cause label Oct 16, 2020
@agilgur5 agilgur5 changed the title How not to React eslint How to disable eslint-config-react-app Oct 16, 2020
@agilgur5 agilgur5 changed the title How to disable eslint-config-react-app How to disable eslint-config-react-app? Oct 16, 2020
@agilgur5
Copy link
Collaborator

agilgur5 commented Oct 16, 2020

Based on the names of your functions (useCompose and getWidgetProps, it sounds like you're writing a library for React components, is that not correct? If so, I'd certainly recommend following the official hooks lint rules. getWidgetProps doesn't follow hook naming conventions, which is why you're getting the error; I'd recommend naming it appropriately.

If you really want to disable a rule for that particular function, you can use an ESLint inline ignore for that.

If you're not writing for usage in React, which isn't really clear as you didn't provide any repro, then yes you're hitting a known issue with the way the ESLint API's merging works. This would be a duplicate of #514 which is a duplicate of #498. In #498 (comment) I described how to disable rules using ESLint configuration, which you can similarly use for this (just different rules).

As I mentioned in #514 (comment), if you use package.json#eslint instead of an eslintrc, that uses a shallow merge and so your config that you've written here should work if put into package.json#eslint instead.

@agilgur5 agilgur5 added kind: support Asking for support with something or a specific use case solution: duplicate This issue or pull request already exists solution: workaround available There is a workaround available for this issue labels Oct 16, 2020
@agilgur5
Copy link
Collaborator

Also, if you set react to 999.999.999 that should disable all React rules per #308 . You've commented out settings.react; you should uncomment that if you're not writing for React.

@agilgur5 agilgur5 added the problem: stale Issue has not been responded to in some time label Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: support Asking for support with something or a specific use case problem: removed issue template OP removed the issue template without good cause problem: stale Issue has not been responded to in some time solution: duplicate This issue or pull request already exists solution: workaround available There is a workaround available for this issue
Projects
None yet
Development

No branches or pull requests

2 participants