When I run yarn run lint fileName
, it returns
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
What I've tried are yarn install
and yarn upgrade
. npm install
is also done. Oddly, ESLint itself is working so it can edit my file in spite of this error. However, I would like to solve this error.
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"lint": "eslint --ext .ts,.tsx,.js,.jsx"
},
"dependencies": {
"@expo/react-native-action-sheet": "^3.8.0",
"@freakycoder/react-native-header-view": "^0.5.1",
"@react-native-firebase/app": "^7.3.0",
"@react-navigation/native": "^5.5.1",
"base-64": "^0.1.0",
"eslint-cli": "^1.1.1",
"expo": "^37.0.12",
"expo-facebook": "~8.1.0",
"expo-font": "~8.1.0",
"expo-google-sign-in": "~8.1.0",
"expo-image-picker": "~8.1.0",
"google-auth-library": "^6.0.2",
"native-base": "^2.13.12",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-actionsheet": "^2.4.2",
"react-native-elements": "^2.0.2",
"react-native-gesture-handler": "~1.6.0",
"react-native-image-picker": "^2.3.1",
"react-native-modal": "^11.5.6",
"react-native-tableview-simple": "^3.2.0",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "~0.11.7",
"react-navigation": "^4.3.9",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.10.3",
"babel-eslint": "^10.1.0",
"babel-preset-expo": "^8.2.3",
"eslint": "^7.3.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.0",
"prettier": "2.0.5",
"react-native-dotenv": "^0.2.0"
}
}
This is my package.json. I am not sure what is the problem. I would appreciate any suggestions.
This is by design from eslint and both NPM and Yarn return the error as an exit code.
You can silence the exit code in both by adding the --silent
flag.
npm run lint /file/path --silent
yarn run --silent lint /file/path
It could be that there is a lint finding that throws an error. ESLint does this if the rule is set to error
and not warning
. See discussion at https://github.com/eslint/eslint/issues/7933 for the issue in npm (yarn may have same problem)
The short version is that you have to either:
warning
instead of error
"lint": "eslint app/;exit 0"
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.