-
Notifications
You must be signed in to change notification settings - Fork 4
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 use it? #3
Comments
Hi @grundmanise, That configuration should be working, it might just be a typo on your comment, but does your |
While reviewing your configuration, I think I found the issue. The way to use import files from the path is using the following pattern Since your project name ( I completely forgot about that logic in the plugin, I'll update the Readme immediately, thank you for bringing that to my attention. |
Hi @guzart , Yes, it starts with the dot as per http://eslint.org/docs/user-guide/configuring#configuration-file-formats. Very strange.. but today Thanks. |
Oh, I've confused you, sorry. |
Oh! that's a really neat trick, I am totally going to start using it. Just by reading at the source code (of this plugin) I couldn't find any reason why it shouldn't be working 🤷♂️. Let me know if you get this error again. |
@guzart Thanks for the plugin! We're using a lot of different package.json files in a lot of directories with different names throughout our app. eg. import React, { Component } from 'react'
import { View, Image, StyleSheet, TouchableOpacity, StatusBar, ScrollView } from 'react-native'
import { PRIMARY_WHITE } from '@theme/colours'
import adjustSize from '@lib/adjustSize' Where Anyway, trying to add eslint and came across your plugin and it works for root directory imports, but not the other (eg. |
@simonbuerger nice approach add this rules to
BTW: @guzart thanks for the plugin, is awesome :) |
Thanks guys! @gusgard That's a good stopgap solution, thank you! I've been pretty busy at work, but I promised myself I would take a deep dive into this issue tomorrow. @simonbuerger I wonder if this could be a clash with npm's scoped packages naming convention. |
Hey @simonbuerger - we have been doing the exact same thing for a current project and we could not get this plugin to work as well. Did you find a solution in the end? Btw, I tried removing the |
@lucasmotta sorry, no. I just switched off the no-unresolved rule :( The unfortunate fact is that the react-native packagers (metro bundler) behaviour in this regard is not standards compliant or consistent with how any other module bundlers work. So the node resolver this plugin utilises simply won't work. An eslint plugin that uses metros own resolver would be required. See https://github.com/facebook/metro/blob/master/packages/metro-resolver/src/resolve.js |
I also tried this plugin hoping to resolve files in my Great plugin, very well needed, hopefully the owner can fix this bug. 👍 |
Hi, thanks for this plugin.
But how can I use it?
Consider this project setup:
and for example importing
(Project/src/foo/foo.js)
like thisimport Foo from 'src/foo/foo
;` -> gives me the following error:The text was updated successfully, but these errors were encountered: