relayjs / eslint-plugin-relay

A plugin for the code linter ESLint to lint specific details about Relay.
MIT License
98 stars 46 forks source link

must-colocate-fragment-spreads gives false errors with yarn workspaces #103

Open tbergquist-godaddy opened 4 years ago

tbergquist-godaddy commented 4 years ago

Hi, we have a monorepo setup with yarn workspaces, where we have 2 apps, and a workspace of shared fragments between these apps.

Importing import { MyComponent } from '@org/fragments triggers error from this rule, even if its fragment is correctly used in the importing component.

I tried having a look at the code and see if I could come up with a fix, but it seems like this rule is based on matching the ImportDeclaration value against the name of the fragment.

I am not sure how eslint can extract this from the workspace name.

hosmelq commented 4 years ago

I am having the same issue. I am importing my components in the following way.

import {Section} from './components'

If I import in the following way it works well.

import {Section} from './components/Section/Section'