google / eslint-config-google

ESLint shareable config for the Google JavaScript style guide
Apache License 2.0
1.74k stars 140 forks source link

Issues with eslint usage #3

Closed gauntface closed 8 years ago

gauntface commented 8 years ago

I've pretty much always had trouble with extending eslint configs so this could easily just be me.

When attempting to use this config (either in eslintrc or in package.json I was getting this error:

$ eslint ./src 1 ↵ /home/matt/.npm-packages/lib/node_modules/eslint/lib/config/config-file.js:332 throw e; ^

Error: Cannot read config package: eslint-config-google Error: Cannot find module 'eslint-config-google' Referenced from: /home/matt/Projects/Code/sw-precache/app-shell-demo/package.json at Function.Module._resolveFilename (module.js:337:15) at Function.Module._load (module.js:287:25) at Module.require (module.js:366:17) at require (module.js:385:17) at loadPackage (/home/matt/.npm-packages/lib/node_modules/eslint/lib/config/config-file.js:168:16) at loadConfigFile (/home/matt/.npm-packages/lib/node_modules/eslint/lib/config/config-file.js:212:18) at load (/home/matt/.npm-packages/lib/node_modules/eslint/lib/config/config-file.js:385:18) at /home/matt/.npm-packages/lib/node_modules/eslint/lib/config/config-file.js:326:36 at Array.reduceRight (native) at applyExtends (/home/matt/.npm-packages/lib/node_modules/eslint/lib/config/config-file.js:309:28)

When I use the gulp task that uses eslint there is no issue. Could it be a problem with attempting to use global eslint?

cc @addyosmani @sindresorhus

sindresorhus commented 8 years ago

I think you need to install it globally if you use the global ESLint.

gauntface commented 8 years ago

That would make sense.

@addyosmani worth adding something to the README or just close?

sindresorhus commented 8 years ago

For reference: https://github.com/eslint/eslint/issues/4822#issuecomment-167600953

I don't think every shareable config should have to document this. It's just how ESLint works and is better documented there. Open an issue on ESLint if you think it could be clearer in its docs.