Giter Club home page Giter Club logo

Comments (15)

gusbemacbe avatar gusbemacbe commented on June 2, 2024 1

Too bad that this plugin does not support it. I will uninstall it and search for another plugin that does not take my freedom away.

from eslint-plugin-jsonc.

ota-meshi avatar ota-meshi commented on June 2, 2024

Thank you for posting issue.
I don't think the brace-style rule is needed for JSON as it is a rule for block statements.

Instead, I think you can use two rules.
https://ota-meshi.github.io/eslint-plugin-jsonc/rules/object-curly-newline.html
https://ota-meshi.github.io/eslint-plugin-jsonc/rules/object-curly-spacing.html

What do you think?
I don't know what it means to use the Allman style in JSON.

from eslint-plugin-jsonc.

henryruhs avatar henryruhs commented on June 2, 2024

Thanks for the quick response, I was actual trying those rules but they don't enforce the brace style like allman.

/* eslint jsonc/brace-style: ["error", "allman"] */
{
    /* ✓ GOOD */
    "GOOD":
    {
        "foo": "bar"
    }

    /* ✗ BAD */
    "BAD": {
         "foo": "bar"
     }
}

from eslint-plugin-jsonc.

ota-meshi avatar ota-meshi commented on June 2, 2024

Thank you for your explanation.
There doesn't seem to be a rule in ESLint to apply the Allman style to object expressions either.
Do you have a rule for applying the Allman style to JavaScript object expressions? It will be helpful if you have it.

from eslint-plugin-jsonc.

henryruhs avatar henryruhs commented on June 2, 2024

There is a rule of course, see allman brace style.

from eslint-plugin-jsonc.

ota-meshi avatar ota-meshi commented on June 2, 2024

No, it's not. brace-style rule that apply to block statements. What I want is a rule that applies to object expressions.

from eslint-plugin-jsonc.

ota-meshi avatar ota-meshi commented on June 2, 2024

Related to eslint/eslint#5203

from eslint-plugin-jsonc.

ota-meshi avatar ota-meshi commented on June 2, 2024

I couldn't find any information about the style of placing a newline before an object expression.
I've found information about applying the Allman style to statements, but not about object literal expressions.

Do you have a popular style guide on it?
Without it, I don't think I can implement the rule.
(However, you are free to create your own plugins and create rules to use them.)

from eslint-plugin-jsonc.

henryruhs avatar henryruhs commented on June 2, 2024

First of all, is there no way to just use the eslint rule for JavaScript? Allman (BSD), Whitesmiths, GNU, Horstmann ... there are tons of styles that enforce placing the { and [ on the next line.

https://en.wikipedia.org/wiki/Indentation_style#Styles

from eslint-plugin-jsonc.

ota-meshi avatar ota-meshi commented on June 2, 2024

I think the link you provided only mentions the "statements".
Object expressions are not statements.

from eslint-plugin-jsonc.

henryruhs avatar henryruhs commented on June 2, 2024

Sure, why would you think it affects statements aswell? It doesn't...

from eslint-plugin-jsonc.

ota-meshi avatar ota-meshi commented on June 2, 2024

I don't understand your favorite style. If it's common, I want that document. Without it I can't implement the rule. That's because I can't understand the details of the style.

from eslint-plugin-jsonc.

henryruhs avatar henryruhs commented on June 2, 2024

There is a wikipedia article pointing out that popular developers and projects are using different indent styles. There is a eslint rule providing "good" and "bad" examples aswell... see the code.

Whatsoever, I cannot provide something that is not available... there is no commision taking care of that coding styles from my knowledge, so I have no idea what document you are looking for!?

from eslint-plugin-jsonc.

ota-meshi avatar ota-meshi commented on June 2, 2024

The question I'm just wondering is, do objects that don't have properties also line break? Also, do I need a line break before the close brace?

{
  "a": {},
  "b":
  {},
  "c":
  {
  },
}

Perhaps there are many other questions in implementing the rule. I don't think I can solve them myself. If I ask you questions one by one, I think it's more efficient for you to implement the rule.

from eslint-plugin-jsonc.

ota-meshi avatar ota-meshi commented on June 2, 2024

By the way, I don't favorite your favorite style. So I don't use the new rule.

from eslint-plugin-jsonc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.