I am trying to make ESLint and Prettier work for days but whatever I do, nothing changes.
I don't even know what I installed globally but here is my project's local package.json
{
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^8.0.4",
"babel-preset-react-native": "4.0.0",
"global": "^4.3.2",
"react": "16.5.0",
"react-native": "0.57.2",
"react-native-linear-gradient": "^2.4.0",
"react-native-navigation": "^1.1.488",
"react-native-snap-carousel": "^3.7.5",
"react-native-vector-icons": "^6.0.2",
"react-navigation": "^2.17.0"
},
"devDependencies": {
"babel-eslint": "^10.0.1",
"babel-jest": "23.6.0",
"eslint-config-prettier": "^3.1.0",
"eslint-plugin-prettier": "^3.0.0",
"jest": "23.6.0",
"prettier": "^1.14.3",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
}
}
my .eslintrc
contains
{
"extends": ["react-app", "plugin:prettier/recommended"]
}
And output in ESLint section says
[Error - 1:15:10 PM] Cannot find module 'eslint-plugin-prettier' Referenced from: /Users/me/project/.eslintrc
I have VSCode settings adjusted, so that is fine, but this simple doesn't work.
I believe you're missing the main eslint package. Can you try adding this to your package.json
"eslint": "^5.8.0",