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

fix: parserOptions, rules default values for ESLint 6 #76

Closed
wants to merge 1 commit into from

Conversation

wheeler
Copy link
Contributor

@wheeler wheeler commented Sep 21, 2019

Problem

When trying to use jest-runner-eslint on a project being upgraded to ESLint 6 there are the following errors:

ESLint configuration in CLIOptions is invalid:
    - Property "parserOptions" is the wrong type (expected object but got `null`).
    - Property "rules" is the wrong type (expected object but got `null`).

Setup

I "use ESLint 6" by forcing the version using the following in my package.json

  "resolutions": { "eslint": "6.4.0" },

Cause

ESLint 6 introduces type checks on the config.
See ~ PR: eslint/eslint#11546 || Commit: eslint/eslint@6ae21a4

Two default values set in normalizeConfig.js are not compatible.

Fix

Change the default values for these two configurations from null to {} in normalizeConfig.js.

Using this change jest-runner-eslint + ESlint 6 runs normally for my project. I also tested with this change but back on ESLint 5 and that continues to work.

This is not intended to fully support ESLint 6 but step in the right direction.

@ljharb
Copy link
Collaborator

ljharb commented Sep 21, 2019

This seems like an overlap of #70.

@wheeler
Copy link
Contributor Author

wheeler commented Sep 21, 2019

@ljharb I agree there is overlap. #70 fixes one of these fields under the umbrella of allowing ESLint 6. This fixes two. This PR does not contain the assertion that ESLint 6 is fully supported - but it does not have any impact on ESLint 5. If this were merged and #70 were rebased that would then contain only the package.json changes allowing ESLint 6 (and possibly be closer to passing).

Edit: I see now that #70 mentions parserOptions but does not fix it. Please let me know if you would like this PR changed to have a different scope or if there is some way I could contribute to moving #70 forward.

@ljharb
Copy link
Collaborator

ljharb commented Sep 21, 2019

There's no value imo in adding anything less than full support for ES6 (which is sorely needed)

@wheeler wheeler mentioned this pull request Sep 21, 2019
7 tasks
@wheeler
Copy link
Contributor Author

wheeler commented Sep 21, 2019

OK, closing.

@wheeler wheeler closed this Sep 21, 2019
@wheeler
Copy link
Contributor Author

wheeler commented Sep 25, 2019

@ljharb more complete version here -> #77

@wheeler wheeler deleted the mw-config-defs branch October 25, 2019 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants