Eslint and Egg.js lint error
Using Eslint with egg.js will have errors when linting files using:
eslint --fix --ext .js,.vue --ignore-path .gitignore .
Full Error Message
``` D:\server>eslint --fix --ext .js,.vue --ignore-path .gitignore . Error: Cannot find module 'eslint-config-egg' Referenced from: D:\server\.eslintrc at ModuleResolver.resolve (C:\Users\Johnson\AppData\Roaming\npm\node_modules\eslint\lib\util\module-resolver.js:72:19) at resolve (C:\Users\Johnson\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:484:28) at load (C:\Users\Johnson\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:556:26) at configExtends.reduceRight (C:\Users\Johnson\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:430:36) at Array.reduceRight (The reason is because `eslint-config-egg` is not in eslint global file. So we should use the local eslint instead: ``` node_modules/.bin/eslint --fix --ext .js,.vue --ignore-path .gitignore . ``` For Windows users: ``` node_modules\.bin\eslint --fix --ext .js,.vue --ignore-path .gitignore . ``` ## Further Reading 1. [Error: Cannot find module 'eslint-config-standard' \| GitHub Issues](https://github.com/standard/eslint-config-standard/issues/84#issuecomment-315129706)