Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] TypeError when extend recommended config #63

Closed
dimadk24 opened this issue Aug 11, 2019 · 11 comments
Closed

[BUG] TypeError when extend recommended config #63

dimadk24 opened this issue Aug 11, 2019 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@dimadk24
Copy link

Describe the bug
eslint throws TypeError: Cannot read property 'recommended' of undefined when extend recommended config

TypeError: Cannot read property 'recommended' of undefined
Referenced from: /Users/dmitrijk/Projects/orders-manager-frontend/.eslintrc.json
    at loadConfigFile (/Users/dmitrijk/Projects/orders-manager-frontend/node_modules/eslint/lib/config/config-file.js:216:40)
    at loadFromDisk (/Users/dmitrijk/Projects/orders-manager-frontend/node_modules/eslint/lib/config/config-file.js:523:18)
    at load (/Users/dmitrijk/Projects/orders-manager-frontend/node_modules/eslint/lib/config/config-file.js:587:20)
    at configExtends.reduceRight (/Users/dmitrijk/Projects/orders-manager-frontend/node_modules/eslint/lib/config/config-file.js:453:36)
    at Array.reduceRight (<anonymous>)
    at applyExtends (/Users/dmitrijk/Projects/orders-manager-frontend/node_modules/eslint/lib/config/config-file.js:431:26)
    at loadFromDisk (/Users/dmitrijk/Projects/orders-manager-frontend/node_modules/eslint/lib/config/config-file.js:551:22)
    at Object.load (/Users/dmitrijk/Projects/orders-manager-frontend/node_modules/eslint/lib/config/config-file.js:587:20)
    at Config.getLocalConfigHierarchy (/Users/dmitrijk/Projects/orders-manager-frontend/node_modules/eslint/lib/config.js:240:44)
    at Config.getConfigHierarchy (/Users/dmitrijk/Projects/orders-manager-frontend/node_modules/eslint/lib/config.js:192:43)

To Reproduce
have following devDependencies in package.json:

{
    "eslint": "~5.16.0",
    "eslint-config-airbnb": "^17.1.1",
    "eslint-plugin-import": "^2.18.2",
    "eslint-plugin-jest-formatting": "^0.1.0",
   ...
}

have following .eslintrc.json:

{
  "env": {
    "browser": true,
    "es6": true
  },
  "extends": [
    "eslint:recommended",
    "airbnb",
    "plugin:jest-formatting/recommended"
  ],
  "globals": {
    "Atomics": "readonly",
    "SharedArrayBuffer": "readonly"
  },
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 2018,
    "sourceType": "module"
  },
  "plugins": ["jest-formatting"],
  "rules":
  ...
  }
}

Of course I have installed plugin via yarn add eslint-plugin-jest-formatting --dev.
I have node_modules/eslint-plugin-jest-formatting/lib/index.js file. Exactly this file causes this issue.

Expected behavior
No error happens

Desktop (please complete the following information):

  • OS: MacOS Mojave v10.14.
  • Node: v10.16.0
  • Yarn: 1.17.3
@dimadk24 dimadk24 added the bug Something isn't working label Aug 11, 2019
@benkimpel
Copy link
Collaborator

Hey @dimadk24. Thanks for the report.

@dangreenisrael I suspect that we'll either need to 1) export a single object as the default export or 2) export a single object with module.exports. I've seen other eslint plugins that use module.exports with an object while the rest of the file ES6 uses import/export. It comes down to how ESLint attempts to import our code and I'm not sure on the specifics. lmk your thoughts.

@benkimpel
Copy link
Collaborator

benkimpel commented Aug 11, 2019

@dimadk24 if you'd like a workaround while the issue is investigated you can remove the line from extends and then list each of the rules individually under rules.

@dimadk24
Copy link
Author

@benkimpel, thanks for the quick response! Will do so

@dangreenisrael
Copy link
Owner

I'm pretty sure that this is because the master version isn't deployed to NPM. I will put a note in the readme. So sorry @dimadk24

@benkimpel
Copy link
Collaborator

Ooh! Easier fix. Great, @dangreenisrael.

@dangreenisrael
Copy link
Owner

Also, @dimadk24, thanks so much for taking the time to report this bug. It is appreciated.

@dimadk24
Copy link
Author

Thanks for such a fast resolution!

@dangreenisrael
Copy link
Owner

😄

@dangreenisrael
Copy link
Owner

@dimadk24 v1.0.0 has been released

@dimadk24
Copy link
Author

@dangreenisrael, thanks for notifying! Updated to this version

@dangreenisrael
Copy link
Owner

😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants