-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
platform-based shared configs #283
Comments
maybe, we should setting
|
when setting extensions to
It's work on react native. |
Cannot get @yutin1987's example to work on my React Native project. Am I missing something? Error:
{
"extends": "airbnb-base",
"parser": "babel-eslint",
"plugins": [
"react",
"react-native"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ios.js", ".android.js"]
}
}
},
"env": {
"es6": true,
"node": true,
},
"rules": {
"react-native/no-unused-styles": 0,
"react-native/split-platform-components": 2,
"react-native/no-inline-styles": 2,
"react-native/no-color-literals": 0,
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"no-use-before-define": 0,
"jsx-quotes": 2,
}
}
import React, { Component } from 'react';
import {
StyleSheet,
View,
} from 'react-native';
import API from '../Data/Api';
import Storage from '../Data/Storage';
import utils from '../Utils/utils';
import MenuView from './MenuView';
import Spinner from './Spinner';
import DateRowPlaceholder from './DateRowPlaceholder';
... snip ...
{
"name": "Kuu",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"lint": "eslint index.*.js app/*"
},
"dependencies": {
"moment": "^2.13.0",
"react": "^15.1.0",
"react-native": "^0.27.0-rc2",
"react-native-code-push": "^1.12.0-beta",
"react-native-collapsible": "^0.6.0",
"react-native-vector-icons": "^2.0.3"
},
"devDependencies": {
"babel-eslint": "^6.1.0",
"eslint": "^2.13.1",
"eslint-config-airbnb-base": "^3.0.1",
"eslint-import-resolver-node": "^0.2.1",
"eslint-plugin-import": "^1.9.2",
"eslint-plugin-react": "^5.2.2",
"eslint-plugin-react-native": "^1.1.0"
}
} |
@jozan not sure, looks good from what you've posted. What is the extension on |
It's Could it be that uppercase pathnames confuse the resolver somehow? |
re: uppercase -- Unlikely. The outcry would be deafening, I think. 😁 Works fine for me with all mixes of case. The case does need to match the FS, though, even on case-insensitive filesystems like Windows and OSX. Also: on Windows, some users have reported that running in a terminal where the CWD casing doesn't match the FS can result in what you're seeing. |
I will do some testing during the weekend on a fresh project. The project I'm trying to set up eslint and eslint-plugin-import has been created in around React Native 0.10 and updated since then to the almost latest version. Maybe there is some cruft that should be removed. Quite unlikely but I assume this might be a weird environment issue rather than plugin problem. I'll keep you posted. |
Since I'm using Typescript, I had to change up the value for |
@ssamkough the latter two aren’t needed; a file can only have one extension. |
Gather up settings for different JS platforms and drop into
config/[platform]
, then referenced asplugin:import/[platform]
.This is useful even (and maybe especially) if a special resolver is not needed.
Node is the default (for now), so alternate platforms that might warrant a named shared config are
extensions
set up for Node resolver)Meteor (see Allow aliases for paths #274, maybe also just a resolver config)see eslint-import-resolver-meteor on npmShared config might be a good place for comments about usage on each platform.
The text was updated successfully, but these errors were encountered: