btholt / complete-intro-to-react-v4

The Complete Intro to React, as given for Frontend Masters
https://frontendmasters.com/learn/react/
1.14k stars 248 forks source link

Cannot find module 'eslint-config-prettier-react' #8

Closed lowtrux closed 6 years ago

lowtrux commented 6 years ago

I noticed that some people had the same problem on the previous version of this course but none (i literally tried everything they suggested) of the solutions mentioned there worked for me. Every time I run the "lint": "eslint \"src/*/.{js,jsx}\" --quiet" I get the same error on the console " Cannot find module 'eslint-config-prettier-react' ". I have already deleted my package.json, copy the one on the repo and then use npm install to get the same versions but still have the same error. Really hope someone can help. I have also installed the ESLint extension for VSCode but it's not working also, i guess because of the same problem.

This is my package.json:

{
  "name": "adopt-me",
  "version": "1.0.0",
  "description": "An app to teach you to write React",
  "main": "src/App.js",
  "scripts": {
    "test": "",
    "format": "prettier --write \"src/**/*.{js,jsx}\"",
    "lint": "eslint \"src/**/*.{js,jsx}\" --quiet",
    "dev": "parcel src/index.html"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/btholt/complete-intro-to-react-v4.git"
  },
  "author": "Brian Holt <btholt@gmail.com>",
  "license": "Apache-2.0",
  "bugs": {
    "url": "https://github.com/btholt/complete-intro-to-react-v4/issues"
  },
  "homepage": "https://github.com/btholt/complete-intro-to-react-v4#readme",
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-eslint": "^8.2.6",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "eslint": "^5.3.0",
    "eslint-config-prettier": "^2.9.0",
    "eslint-plugin-import": "^2.13.0",
    "eslint-plugin-jsx-a11y": "^6.1.1",
    "eslint-plugin-react": "^7.10.0",
    "parcel-bundler": "^1.9.7",
    "prettier": "^1.14.2"
  },
  "dependencies": {
    "@reach/router": "^1.1.1",
    "petfinder-client": "^0.0.3",
    "react": "^16.4.2",
    "react-dom": "^16.4.2"
  }
}

This is my .eslintrc.json:

{
  "extends": [
    "eslint: recommended",
    "plugin: import/errors",
    "plugin: react/recommended",
    "plugin:jsx-a11y/recommended",
    "prettier",
    "prettier-react"
  ],
  "rules": {
    "react/prop-types": 0
  },
  "plugins": ["react", "import", "jsx-a11y"],
  "parserOptions": {
    "ecmaVersion": 2018,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "env": {
    "es6": true,
    "browser": true,
    "node": true
  }
}
1Marc commented 6 years ago

I'm not able to reproduce this off master. I did git checkout master npm install and npm run lint without any errors, only a small warning about the version of React not being specified to the linter.