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

Rule suggestion: List style (brackets) #236

Open
carlpett opened this issue Mar 17, 2020 · 2 comments
Open

Rule suggestion: List style (brackets) #236

carlpett opened this issue Mar 17, 2020 · 2 comments

Comments

@carlpett
Copy link

I'd like to propose a rule for checking style for lists. We have some files where we mix the two forms:

foo: ["a","b","c"]
bar:
  - 1
  - 2
  - 3

Having options to only allow either, or consistent would be great!

(To some extent also dicts, where we sometimes get baz: { qux: true }, but this seems less common)

@adrienverge
Copy link
Owner

Hey, this is a good idea.

  • This could be done by adding some options to braces and brackets, for example:

    brackets:
      forbid: true

    Drawback: we cannot force the flow style (the one with brackets) and forbid the block style (the multi-line one).

  • Another option would be to add 2 other rules:

    mappings-style:
      type: block | flow | whatever
    sequences-style:
      type: block | flow | whatever

@make-github-pseudonymous-again

How difficult would it be to implement this?

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

3 participants