Closed irohitb closed 5 years ago
I am getting Es-linting issues when trying to import multiple types [Screen shot below]
In my RN project, I have created various data types in my project
export type props = { btnText: string, colorType: number, btnType: number, onPress: Function, btnStyle?: Object, textStyle?: Object } export type buttonSubStyle = { width: number, height: number, backgroundColor: string, borderRadius?: number, borderColor?: string } export type textSubStyle = { color: string, fontSize: number, }
They exist in datatTypes/buttonType.js
I am importing them in my components/elements/button.js
import type {props, buttonSubStyle, textSubStyle} from "./../../dataTypes/buttonType" const button = (props:props) => { const TYPE_LARGE_ROUND = 1 const TYPE_SMALL_ROUND_OUTLINE = 2 const TYPE_SMALL_ROUND = 3 const TYPE_SMALL_FILTER = 4 const COLOR_BLUE = 1 const COLOR_WHITE = 2 const COLOR_GREEN = 3 const {btnStyle, textStyle, onPress, btnType, btnText, colorType} = props let subStyle:buttonSubStyle = { width: 300, height: 50, borderRadius: 20, backgroundColor: theme.primaryBlue } let textSubStyle:textSubStyle = { color: theme.primaryWhite }
Here linting is saying props and textSubStyle is defined but never used whereas it is not giving any issues for buttonSubStyle
Can someone tell me why am I getting this error?
This is my eslint configuration
{ "env": { "browser": true, "es6": true }, "parser": "babel-eslint", "extends": ["eslint:recommended", "plugin:react/recommended", "prettier"], "globals": { "Atomics": "readonly", "SharedArrayBuffer": "readonly" }, "parserOptions": { "ecmaFeatures": { "jsx": true }, "ecmaVersion": 2018, "sourceType": "module" }, "plugins": ["react", "flowtype"] }
My package.json file
{ "name": "frontend", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start" }, "dependencies": { "react": "16.8.3", "react-native": "0.59.9", "react-native-gesture-handler": "^1.3.0", "react-navigation": "^3.11.0" }, "husky": { "hooks": { "pre-commit": "lint-staged" } }, "devDependencies": { "@babel/core": "^7.4.5", "@babel/runtime": "^7.4.5", "babel-eslint": "^10.0.1", "babel-jest": "^24.8.0", "babel-preset-flow": "^6.23.0", "flow-bin": "^0.93.0", "eslint": "^5.16.0", "eslint-config-prettier": "^4.3.0", "eslint-plugin-flowtype": "^3.9.1", "eslint-plugin-import": "^2.17.3", "eslint-plugin-react": "^7.13.0", "husky": "^2.4.0", "jest": "^24.8.0", "lint-staged": "^8.1.7", "metro-react-native-babel-preset": "^0.54.1", "prettier": "1.17.1", "react-devtools": "^3.6.1", "react-test-renderer": "16.8.6" }, "jest": { "preset": "react-native" } }
I am getting Es-linting issues when trying to import multiple types [Screen shot below]
In my RN project, I have created various data types in my project
They exist in datatTypes/buttonType.js
I am importing them in my components/elements/button.js
Here linting is saying props and textSubStyle is defined but never used whereas it is not giving any issues for buttonSubStyle
Can someone tell me why am I getting this error?
This is my eslint configuration
My package.json file