How to deal with eslint errors in generated .bs.js files?

The generated .bs.js has tons of eslint errors. For example, every switch command generates a “Expected a default case” error. I know ReScript ensures every case is covered but eslint doesn’t know that. Other errors: default-case, no-fallthrough. These are good errors to have in my handwritten code. Should I just turn off eslint for all .bs.js files?

I would just turn of eslint for .bs.js files

4 Likes

Recent nextjs releases provide extra eslint checks, so some people may want to keep those nextjs checks.

I would just turn of eslint for .bs.js files

Is this still the recommendation? How do you lint for missing dependencies in react hooks for example.

That’s the neat part, you don’t. :sweat_smile:

In all seriousness, there exists a rescript-linter now, but it lacks support for rules of hooks. If those were supported, I would consider using it myself.

I think I’ve found a good middle ground by setting up .bs.js specific overrides in my .eslintrc as necessary:

"overrides": [
    {
      "files": [
        "*.bs.js"
      ],
      "rules": {
        "no-fallthrough": "off",
        "no-mixed-operators": "off",
        "no-unused-expressions": "off",
        "no-useless-concat": "off",
        "eqeqeq": "off"
      }
    }
  ],
2 Likes