codeclimate / codeclimate-eslint

Code Climate Engine for ESLint
MIT License
95 stars 93 forks source link

eslint-plugin-security: TypeError: Cannot read property 'recommended' of undefined #359

Closed davehenton closed 6 years ago

davehenton commented 6 years ago

I'm working with a customer who is running into an error surrounding eslint-plugin-security

When the user has the following configuration in their .eslintrc.json:

"plugins": [
  "security"
],
"extends": [
  "plugin:security/recommended"
]

They run into the following error:

engine eslint failed with status 1 and stderr 
/usr/local/node_modules/eslint/lib/config/config-file.js:434
            throw e;
            ^

TypeError: Cannot read property 'recommended' of undefined
Referenced from: /code/./.eslintrc.json
    at loadConfigFile (/usr/local/node_modules/eslint/lib/config/config-file.js:217:40)
    at load (/usr/local/node_modules/eslint/lib/config/config-file.js:535:18)
    at configExtends.reduceRight.e (/usr/local/node_modules/eslint/lib/config/config-file.js:424:36)
    at Array.reduceRight (native)
    at applyExtends (/usr/local/node_modules/eslint/lib/config/config-file.js:408:28)
    at Object.load (/usr/local/node_modules/eslint/lib/config/config-file.js:566:22)
    at loadConfig (/usr/local/node_modules/eslint/lib/config.js:63:33)
    at new Config (/usr/local/node_modules/eslint/lib/config.js:229:42)
    at CLIEngine.getConfigForFile (/usr/local/node_modules/eslint/lib/cli-engine.js:774:30)
    at Object.run (/usr/src/app/lib/eslint.js:236:56)

When the 'plugin:' flag is removed, they receive a different error:

Module not supported: eslint-config-security/recommended
ESLint is running with the /usr/local/node_modules/babel-eslint/index.js parser.

Ignoring the following rules that rely on module resolution:

* import/extensions
* import/no-unresolved
* import/no-extraneous-dependencies
* import/no-named-as-default
* import/no-absolute-path
* import/no-duplicates
* import/no-named-as-default-member

This is an OSS repository, which you can check out here.

I'm not sure exactly what's going on here. Is it possible that it's related to 9771 or 9767?

guillaumearm commented 6 years ago

I have the same issue with eslint-plugin-prettier

my .eslintrc file contains :

"plugins": [
  "prettier"
],
"extends": [
  "plugin:prettier/recommended"
]

error report from https://codeclimate.com :

/usr/src/app/lib/validate_config.js:18
        throw e;
        ^

TypeError: Cannot read property 'recommended' of undefined
Referenced from: /code/.eslintrc
    at loadConfigFile (/usr/local/node_modules/eslint/lib/config/config-file.js:211:40)
    at loadFromDisk (/usr/local/node_modules/eslint/lib/config/config-file.js:486:18)
    at load (/usr/local/node_modules/eslint/lib/config/config-file.js:550:20)
    at configExtends.reduceRight.e (/usr/local/node_modules/eslint/lib/config/config-file.js:421:36)
    at Array.reduceRight (native)
    at applyExtends (/usr/local/node_modules/eslint/lib/config/config-file.js:403:28)
    at loadFromDisk (/usr/local/node_modules/eslint/lib/config/config-file.js:514:22)
    at Object.load (/usr/local/node_modules/eslint/lib/config/config-file.js:550:20)
    at Config.getLocalConfigHierarchy (/usr/local/node_modules/eslint/lib/config.js:228:44)
    at Config.getConfigHierarchy (/usr/local/node_modules/eslint/lib/config.js:180:43)
efueger commented 6 years ago

@davehenton - I had a conversation with another customer and found that using channel: "eslint-4 resolves that type error 👍

@guillaumearm

guillaumearm commented 6 years ago

@efueger :

efueger commented 6 years ago

Thanks for the update @guillaumearm - glad you got that to work!