Skip to content
New issue

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

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

Already on GitHub? # to your account

Export a "recommended" configuration #72

Closed
azz opened this issue Dec 16, 2017 · 2 comments
Closed

Export a "recommended" configuration #72

azz opened this issue Dec 16, 2017 · 2 comments

Comments

@azz
Copy link
Member

azz commented Dec 16, 2017

Usually when I set up a project with Prettier I use both eslint-{plugin,config}-prettier.

---
plugins:
- prettier # eslint-plugin-prettier
extends:
- prettier # eslint-config-prettier
rules:
  prettier/prettier: error # eslint-plugin-prettier

What would be great is if this module exported a "recommended" configuration that did this for me:

---
extends:
- plugin:prettier/recommended

Effectively:

module.exports.configs = {
  recommended: {
    extends: ['prettier'],
    plugins: ['prettier'],
    rules: {
      'prettier/prettier': 'error'
    },
  }
}

Would such an addition be welcome?

@not-an-aardvark
Copy link
Member

Sounds reasonable to me. Is the assumption that users would create a .prettierrc file if they want to use a non-default prettier config? (Without a .prettierrc file, the user would have to override the prettier/prettier rule config in order to use something other than the prettier defaults, which would partially defeat the point of including it in a separate config.)

Another option would be to just export eslint-config-prettier as its own config, without enabling prettier/prettier.

@azz
Copy link
Member Author

azz commented Dec 16, 2017

Is the assumption that users would create a .prettierrc file if they want to use a non-default prettier config?

Yes. This is recommended because editor extensions such as prettier-atom and prettier-vscode will read .prettierrc, but won't read settings from ESLint, which can lead to an inconsistent experience.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants