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

Version 4.x stopped inferring options from ESLint config #62

Closed
mrm007 opened this issue May 25, 2017 · 2 comments
Closed

Version 4.x stopped inferring options from ESLint config #62

mrm007 opened this issue May 25, 2017 · 2 comments

Comments

@mrm007
Copy link
Contributor

mrm007 commented May 25, 2017

  • prettier-eslint-cli version: 4.0.1
  • prettier version: 1.3.1
  • eslint version: 3.19.0

Relevant code/config.
See example repo. Run with yarn start. There is a v3 branch for prettier-eslint-config@3.

What you did:

With prettier-eslint-config@4 the inferred options are:

  "prettierOptions": {
    "bracketSpacing": true,
    "parser": "babylon",
    "printWidth": 80,
    "semi": true,
    "singleQuote": false,
    "tabWidth": 2,
    "trailingComma": "none",
    "useTabs": false,
  },

The expected options are the ones obtained with prettier-eslint-config@3:

  "prettierOptions": {
    "bracketSpacing": true,
    "parser": "babylon",
    "printWidth": 120,
    "semi": true,
    "singleQuote": true,
    "tabWidth": 2,
    "trailingComma": "all",
    "useTabs": false,
  },

Problem description:

The new behaviour is caused by the changes in #59, specifically this change. Default options specified for yargs take precedence so the ESLint config getters never get called:

code

@kentcdodds
Copy link
Member

Ah! Yeah, that's a problem! Glad that I pushed that as a major version bump so it didn't mess everyone up unsuspectingly!

So I think that the problem is that the default values from the CLI should be used as fallbackPrettierOptions and right now they're being used as prettierOptions which overrides the prettier options.

So I'm pretty sure the solution would be to remove the default values for all the prettier options. prettier-eslint has the defaults already so there's really no need to have them at all.

Would you like to make a pull request to do that?

@mrm007
Copy link
Contributor Author

mrm007 commented May 25, 2017

Will do! I wasn't sure how to handle it but now that you gave me the answer, I can.

mrm007 added a commit to mrm007/prettier-eslint-cli that referenced this issue May 25, 2017
mrm007 added a commit to mrm007/prettier-eslint-cli that referenced this issue May 25, 2017
kentcdodds pushed a commit that referenced this issue May 25, 2017
* fix(parser): remove default options passed to `prettier-eslint` (#62)

* docs(contributors): added mrm007

Closes #62
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

No branches or pull requests

2 participants