Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Joshua J Wilborn
    @JoshuaJWilborn
    Hello, I'm having a very strange issue...we have a project using eslint + prettier, and I run the linting locally, everything passes...then in CI it fails. I already removed my ~/.eslintrc and ~/.prettierrc files in case they were causing the mismatch but that didn't work. What else might cause something like this?
    Torleif Berger
    @Svish
    In Markdown you should be able to add two spaces at the end of a line to get a forced line break, but Prettier seems to remove this in .mdx-files... is that a bug in Prettier? In the handling of Markdown files? MDX files? 😟
    Torleif Berger
    @Svish
    Could also be VS Code...
    Tony Dehnke
    @tonydehnke_twitter

    Think I am seeing a prettier issue in a yaml file containing some ruby. How could I get this to pass?

    SyntaxError: Nested mappings are not allowed in compact mappings (18:13)
      16 |   # Your application name. Renaming here affects where data displays in New
      17 |   # Relic.  For more details, see https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications
    > 18 |   app_name: <%= ENV["SERVER_ENV"] == 'staging' ? '12vBiz (Staging)' : '12vBiz' %>

    this is in the config file tor NewRelic - newrelic.yml

    Tony Dehnke
    @tonydehnke_twitter

    Sorry here is more of the error

    /node_modules/prettier/index.js:13588
          throw error;
          ^
    
    SyntaxError: Nested mappings are not allowed in compact mappings (19:13)
      17 |   # Relic.  For more details, see https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications
      18 |   # prettier-ignore
    > 19 |   app_name: <%= ENV["SERVER_ENV"] == 'staging' ? '12vBiz (Staging)' : '12vBiz' %>
         |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    > 20 | 
         | ^

    I tried adding the #prettier-ignore per the prettier docs, but that doesn't seem to work either.

    Portia Burton
    @pkafei
    I would like to use prettier to correct common spelling errors. Does anyone know how I would go about doing that? I'm guessing I would create a regex rule in the config file, but I'm not sure how I would do that.
    rxliuli
    @rxliuli
    EhGMhuAUcAANKba.png
    Is there a way to format the ts code into the following style?
    https://twitter.com/buildsghost/status/1301976526603206657
    Daniel Laubacher
    @dlaub3
    prettierv2.png
    I can't seem to get prettier to work with trailing commas. Am I doing something wrong? Prettier keeps removing them.
    node v12.20.0
    I expected prettier to add the missing trailing comma, not remove the existing ones.
    Daniel Laubacher
    @dlaub3
    It seems that I misunderstood the rule, and trailing commas are only added when there are multiple lines.
    David Aurelio
    @davidaurelio

    Hi. I am adding prettier to a repo and would like to use .eslintignore as ignores file. The problem is to make this frictionless for the dozens of developers working on it.

    While invoking the CLI is wrapped and --ignore-path set accordingly, providing this for editor integrations seems harder. I can’t use a symlink .prettierignore -> .eslintignore, because we also use windows, where git symlink support depends on local configuration. .prettierrc does not support ignorePath.

    Is there any way to provide my team with a no-config experience? Thanks.

    Alon Bukai
    @Alonski
    Hey friends, who can I talk to about pushing this forward please?
    Matthew Adams
    @matthewadams
    It's Feb, 2021. What is the most minimal eslint & prettier TypeScript config to get all defaults, not have eslint or prettier conflict, and to work out of the box in WebStorm & VS Code so that I get eslint --fix & prettier --write on save or reformat? Please don't point me to https://prettier.io/docs/en/integrating-with-linters.html, because I'm ugly & dumb, and that page is confusing to me.
    Matthew Adams
    @matthewadams
    ^^^ @jlongster ?
    Matthew Adams
    @matthewadams
    Um, anyone? Bueller?
    verdecchia
    @verdecchia:matrix.org
    [m]
    Hi to everybody! I'm an Italian software developer and I added prettier to an existing project. Everything works like a charm, but I got an with a 'p' tag element. Well, in real I dislike how this 'p' element was used and I removed it, but I'm wondering why this happens.
    May someone could help me and answering why it happens? Maybe I'm doing something wrong in vue? Thanks!
    Kristina
    @KristinaPlusPlus
    Hello! I am taking a stab at writing my first prettier plugin for blazor support. I'd love feedback and potentially help debugging the two issues I have logged against myself -> https://github.com/KristinaPlusPlus/prettier-plugin-razor
    bytreakz
    @bytreakz

    Hey Guys, I just got prettier and it makes my
    <a href="https://de.wikipedia.org/wiki/Inlineframe" target="iframeA">Wikipedia</a>

    into:
    <a href="https://de.wikipedia.org/wiki/Inlineframe" target="iframeA"

        >Wikipedia</a

    >

    it it somehow possible to make my code look like this:
    <a href="https://de.wikipedia.org/wiki/Inlineframe" target="iframeA">
    Wikipedia
    </a>

    ?

    bytreakz
    @bytreakz

    See https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting

    it works now with "ignore", thanks! Is it normal that it stays in one line if I change my print width settings from 80 to 100 or can I change it somehow that i looks like this:
    <a href="https://de.wikipedia.org/wiki/Inlineframe" target="iframeA">
    Wikipedia
    </a>
    ?

    Jed Fox
    @j-f1
    If the element fits on one line within the printWidth, we will print it on one line.
    bytreakz
    @bytreakz
    okay, thanks for the fast answers! :)
    Christopher G
    @ChrisG661
    hello! i was using prettier in vscode for HTML and somehow it started to ignore the line/print wrap on class attributes. It only happens when i am saving the file, but behaves accordingly when invoked manually using format document. how do i troubleshoot this?

    it ignores the line wrap when i format on save:

    <div
      class="flex flex-row items-stretch w-full mx-auto space-x-1  justify-evenly justify-items-stretch h-80"
    >

    but when ran manually with format document it correctly wraps:

    <div
      class="
        flex flex-row
        items-stretch
        w-full
        mx-auto
        space-x-1
        justify-evenly justify-items-stretch
        h-80
      "
    >
    Christopher G
    @ChrisG661
    it also works on some other file when i set "html.format.wrapLineLength": to 80
    Jed Fox
    @j-f1
    Maybe you’re using a different formatter for format on save? I think there’s an option in settings.json to change the default formatter both globally and by file type.
    Helge
    @Tylopilus
    Hi Chat, is there a bug in the html formatting or am I missing out a config?
    ```
    <body>
        <shared-button name="Peter" class="sc-shared-button-h hydrated">
          <div class="sc-shared-button">hi Peter,</div>
          <button class="sc-shared-button">load tic</button>
        </shared-button>
        <my-input class="sc-my-input-h hydrated"
          ><input type="text" class="sc-my-input" /><button class="sc-my-input">
            clear</button
          ><button class="sc-my-input">load</button></my-input
        >
        <h1>Hallo Welt</h1>
      </body>
    Helge
    @Tylopilus
    <my-input class="sc-my-input-h hydrated"
          ><input type="text" class="sc-my-input" /><button class="sc-my-input">
            clear</button
          ><button class="sc-my-input">load</button></my-input
        >
    this part looks iffy for me though
    Jed Fox
    @j-f1
    If you manually insert a space it will switch to a more “normal” formatting, it’s just that inserting that space may affect the layout in some cases so Prettier can’t automatically do it there.
    <my-input class="sc-my-input-h hydrated"
          > <input type="text" class="sc-my-input" /><button class="sc-my-input">
            clear</button
          > <button class="sc-my-input">load</button></my-input
        >
    That’s the general idea ^
    Helge
    @Tylopilus
    I see what may be the side effects that prettier cannot enforce a propper line break by its own?
    Matt Rossman
    @mattrossman
    image.png
    anyone know how I can stop prettier from adding this extra linebreak after string literal params? I use string literals a lot for GLSL shaders and it's annoying having it take up so much vertical space
    i guess it's kind of specific to string literals, for other kinds of params I'd expect the paren on a new line
    Byron Ferguson
    @byronferguson
    has their been a default config change recently? I have swathes of code where the class="" attribute in my HTML is now expanded to a single class per line.
    Matthew Edwards
    @wondersloth

    I have a question, if the following is possible with the plugin system.

    I want to extend the javascript printer to have an embed for a tagged template literal with

    hbs`<div></div>`

    This would be similar to the html tagged template literal but would be for handlebars syntax inside.

    If not that, potentially a version of the plugin that will process an alternative file extension .gjs which like react or something will have a <template> tag on a class.

    // ...
    export default class MyComponent extends Component {
      <template>
        <div>Some Hbs here.</div>
      <template>
    };

    This format, I don't think warrants a change in the main repo of prettier, because the API is not final but for current application development in glimmer.js experimental fork.

    I've playing around with creating a plugin, but I can't really get the embed or print functions to recursively call as described from the documentation. I am seeing it get called once with the node being a file, but I thought it would be doing more.

    Anthony Ronda
    @anthonyronda
    Hi y'all. Discovered no easy way to get Prettier to work with text files, even by doing a *.txt override with "parser" : "markdown", which is close enough for my needs. This seems like something I might have to submit as an Issue. Any advice or final checks I should try before I do?
    Caleb Jasik
    @jasikpark
    Hiya - is there a way to disable loading a parser automatically? We are currently developing a parser within a monorepo, and prettier is automatically pulling in the unfinished and broken language plugin and using it to format all of the Astro code in the repo...
    Caleb Jasik
    @jasikpark
    Well, for know our solution is to either disable embeddedLanguageFormatting or move the prettier-plugin-astro package into it's own repo out of the monorepo