简体   繁体   中英

Visual studio 2015 update 3 eslint Cannot find module eslint-plugin-react

After install "Visual studio update 3" and "DotNetCore.1.0.0-VS2015Tools.Preview2"

Stop work eslint in all projects.

I not use eslint-plugin-react before

package.json

"devDependencies": {
    "gulp-eslint": "^3.0.1"
}

gulpfile.js

gulp.task('eslint', function () {
    return gulp.src(['scripts/app/**/*.js'])
        .pipe(eslint())
        .pipe(eslint.format())
        .pipe(eslint.failAfterError());
});

Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17)

I`ts not help

PM> npm eslint -v
3.8.6
PM> npm install -g eslint-plugin-react
C:\Users\Alexandr\AppData\Roaming\npm
`-- eslint-plugin-react@5.2.2 

Create .eslintrc in solution root with rules

{
  "env": {
    "node": true
  },
  "rules": {
    "array-bracket-spacing": [2, "never"],
    "block-scoped-var": 2,
    "brace-style": [2, "1tbs"],
    "camelcase": 1,
    "computed-property-spacing": [2, "never"],
    "curly": 2,
    "eol-last": 2,
    "eqeqeq": [2, "smart"],
    "max-depth": [1, 3],
    "max-len": [1, 80],
    "max-statements": [1, 30],
    "new-cap": 1,
    "no-extend-native": 2,
    "no-mixed-spaces-and-tabs": 2,
    "no-trailing-spaces": 2,
    "no-unused-vars": 1,
    "no-use-before-define": [2, "nofunc"],
    "object-curly-spacing": [2, "always"],
    "quotes": [2, "single", "avoid-escape"],
    "semi": [2, "always"],
    "space-unary-ops": 2
  }
}

Or modify "c:\\Users....\\.eslintrc"

I don`t uderstand what is

"plugins": [ "react" ]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM