因此,我尝试使用ESLint和Gulp将Airbnb样式指南添加到我公司的代码库中。我遇到了以下错误:
Error: Failed to load plugin import: Cannot find module 'eslint-plugin-import'
Referenced from: airbnb-base
Referenced from:
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
这是我目前的配置:
eslint.gulp.js
export default (gulp, plugins, config) => {
return gulp.src([
`${config.SRC}/**/*.js`,
`!${config.SRC}/**/__generated/*.js`,
`!${config.SRC}/libraries/**`,
`!**/node_modules/**`
])
.pipe(plugins.errorHandler())
.pipe(plugins.eslint({
"extends": "airbnb-base"
})
)
.pipe(plugins.eslint.format())
.pipe(plugins.eslint.failAfterError());
}
.eslintrc file
{
"env": {
"es6": true,
"browser": true
},
"extends": "airbnb-base",
"rules": {}
}
任何想法我可能做错了什么?
答案 0 :(得分:0)
我建议
npm install npm@latest -g
rm -rf node_modules
npm install