Skip to content

linter: 1.62.0 introduces issues with tanstack router #21921

@Xhale1

Description

@Xhale1

What version of Oxlint are you using?

1.62.0

What command did you run?

No response

What does your .oxlintrc.json (or oxlint.config.ts) config file look like?

{
  "categories": {
    "correctness": "off"
  },
  "plugins": ["react"],
  "rules": {
    "react/only-export-components": [
      "error",
      {
        "allowConstantExport": true,
        "customHOCs": ["createFileRoute", "createRootRouteWithContext", "createRootRoute"]
      }
    ]
  }
}

What happened?

After upgrading to Oxlint 1.62.0, I'm noticing a new error that I can't seem to solve. Consider this code:

import { createFileRoute } from "@tanstack/react-router";

export const Route = createFileRoute("/profile")({
  component: Component,
});

// Error here, on `Component`
function Component() {
  return <div />;
}

This yields the following error:

Fast refresh only works when a file only exports components. Move your component(s) to a separate file.oxc[eslint-plugin-react(only-export-components)](https://oxc.rs/docs/guide/usage/linter/rules/react/only-export-components.html)

My guess is this is related to #20608, but I have not verified.

For additional context, a similar (though maybe unrelated) error was triggered in Eslint-land with eslint-plugin-react-refresh 0.5.0, released in February. The maintainers recommendation is to use extraHOCs which I believe corresponds to oxlint's customHOCs though I'm not positive.

I also experimented with adding the following setting to no avail:

{
"react/only-export-components": [
      "error",
      {
        "allowConstantExport": true,
        "customHOCs": ["createFileRoute", "createRootRouteWithContext", "createRootRoute"],
        "allowExportNames": [
           "createFileRoute",
           "createRootRouteWithContext",
           "createRootRoute",
           "Route"
        ]
      }
    ]
}

Metadata

Metadata

Assignees

Labels

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions