Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    qwhatevera
    @qwhatevera
    @qwhatevera are you using the correct parser (JSON)?
    @RyanZim I don't know where to pick a parser.
    I'm testing in here:https://prettier.io/playground
    qwhatevera
    @qwhatevera

    @qwhatevera are you using the correct parser (JSON)?

    I already know how to pick a parser and config in prettier.config.js,but I still don't know whick parser to pick to fix my problem? I mean change a parser maybe affect other files like .vue .css etc

    Ryan Zimmerman
    @RyanZim
    You need to use the json parser. You can select the parser in the sidebar of the playground.
    If you can't see the sidebar, click the Show Options in the bottom left of the playground
    @qwhatevera ^
    Thomas Jowsey
    @jowsey
    Hey guys, not sure if this is a dumb ask but does anyone know if it's possible to have Prettier automatically format used snippets in VS Code? Thanks
    qwhatevera
    @qwhatevera
    @RyanZim Thanks for your reply, it works.
    nicolas.deveaud
    @nicolas.deveaud:matrix.org
    [m]
    Hi everyone !
    I would love to know more about next release timing: who defines when the release is shipped, what are the steps before it is released, etc.
    I'm waiting for a fix to be released and I'd like to have a idea on how long it can take for this release to come.... of course this info would not change anything, but just knowing what is going on helps waiting 😅 And if by the way I can help.... why not 😉
    whycomeimsocool
    @whycomeimsocool:matrix.org
    [m]
    Hi everyone :) does anyone know how to stop prettier from changing <br> into <br /> ????
    jn
    @ziddey
    using react + htm instead of jsx. I'd like to make use of embedded language formatting, but the default html parser changes attributes like colSpan to colspan which obviously makes react unhappy. I suppose I could make a custom parser and change all my template tags from html to match? Anyone have a better idea?
    jmkozko
    @jmkozko
    hi, is there a way to disable this rule for chained decorators? i see that prettier wants this:
    @Returns(200, SomeClass).Description('Description Here')
    to be formatted as
    @(Returns(200, SomeClass).Description('Description Here'))
    this only occurs when the decorators are chained
    jmkozko
    @jmkozko
    or is there a way to print debug information to see what rule was violated?
    netzego
    @netzego:matrix.org
    [m]
    Hey everyone, is it possible to stop the ugly linebreaks somehow?
    {% extends "base.html" %}
    {% block content %}
    <h1 class="title">:-)</h1>
    {% endblock content %}
    {% extends "base.html" %} {% block content %}
    <h1 class="title">:-(</h1>
    {% endblock content %}
    Riho Pihlak
    @rpihlak
    Hi! I'm trying to create a plugin for formatting embedded SQL in TS. The plugin works on SQL files but not embedded SQL. I defined name, parsers and extensions in languages. Am I missing something? Is it at all possible? I tested with the following example.
    console.log(html`<DIV>  </DIV>`); // works
    console.log(sql`CREATE TABLE example (  id INT PRIMARY KEY  );`); // doesn't work
    Riho Pihlak
    @rpihlak
    Hi! Can the built-in TypeScript parser detect and parse embedded languages with plugins? I want to create a plugin for SQL to format embedded SQL in TypeScript files. Example:
    import { MigrationInterface, QueryRunner } from 'typeorm';
    
    export class CreateExtensionPgcrypto1616393535319 implements MigrationInterface {
      public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(sql`
          CREATE EXTENSION IF NOT EXISTS pgcrypto;
        `);
      }
    
      public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(sql`
          DROP EXTENSION pgcrypto;
        `);
      }
    }
    Paul Schreiber
    @paulschreiber
    Is there Prettier-TextMate integration? I found https://www.phpied.com/prettier-in-textmate/ and tried it, but it crashes on save (terminating with uncaught exception of type std::length_error: basic_string).
    ssbarnea
    @ssbarnea:matrix.org
    [m]
    i found a recent bug in prettier prettier/prettier#12364 and I was trying to find the line to fix myself but due to lack of prefix it seems hard to spot there the console output is made from.
    ssbarnea
    @ssbarnea:matrix.org
    [m]
    is this channel really used by prettier devs?
    i tried finding another one but i was not able to find it yet.
    I would like to keep the code in the h2 compact and almost the same
    Ben Allfree
    @benallfree
    hey everyone, is there any reason prettier wouldn't be formatting Typescript code blocks in markdown? a js fence works, but ts fence doesn't seem to have any effect
    ```js
    // This gets formatted
    ```
    ```ts
    // This doesn't :(
    ```
    joebalzac
    @joebalzac
    How do I stop prettier from formatting all files in project
    eg...when I push to Github it says 111 files changes, I only want it to show the files that have been actually changed?
    Please help!
    Eric G
    @EricG-Personal
    @joebalzac perhaps using .prettierignore is what you are looking for?
    I was hoping someone here may be able to help me out with this SO question…
    Mouad Ennaciri
    @mouadennaciri
    Hello, I have a simple question, how can we format the code with only the defined options.
    I run for example the command npx prettier --write --tab-width 2 "**/*.ts" to format the code in 2 spaces, but it also makes other changes like changing single quotes by double quotes...
    How can I define that I want to format only the spaces option?
    1 reply
    Damien Butt
    @damienbutt
    Hi all,
    Hopefully a simple question.
    Is there a way either in the vscode extension settings or with a prettier config file that I can add other file associations? For instance tell prettier to treat a .xyz extension as a .js file for formatting purposes?
    Without going down the route of creating a custom plugin
    Mopsior
    @Mopsior
    Hi, why this is not working?
    .prettierignore is in project dir
    image.png
    Joe Gornick
    @jgornick
    Hey folks, can someone please educate me why I'd use prettier vs eslint fixes? All of the options I see that can be configured are provided as rules for eslint with fixes. So, why not run eslint to lint and format your code?
    10 replies
    Apteryx
    @apteryxxyz
    Hi there, is there a rule/option that will do the following:
    Top image is what prettier formats to,
    bottom image is what I want
    C1.PNG
    C2.png
    Ghost
    @ghost~60ac179d6da03739847d5244
    Hi from VS Code extension community!
    Looking for signposting on ignoring the non-standard py-script tag in a HTML file. Is this best done by the user? Context here: prettier/prettier-vscode#2531
    Conor McGrath
    @conor909

    I was a graphic designer in a previous career and have some knowledge around typography and design. Is there any way prettier could format based off consistency within the file / block as opposed to line by line. So instead of some lines being broken, it finds consistency with previous lines.

    So you end up with this:

    const foo = ({ polo }) => {
      const functionOne = () => myArray.map(item => (item.something === polo))
      const functionTwo = () => myArrayWithLongerName.map(item => (item.somethingElse === polo))
      const functionThree = () => myArrayWithLongerName.map(item => (item.somethingElse === polo))
      return [ ...functionOne, ...functionTwo, ...functionThree ]
    }

    or this:

    const foo = ({ polo }) => {
      const functionOne = () => myArray.map(
        item => (item.something === polo)
      )
      const functionTwo = () => myArrayWithLongerName.map(
        item => (item.somethingElse === polo)
      )
      const functionThree = () => myArrayWithLongerName.map(
        item => (item.somethingElse === polo)
      )
      return [ ...functionOne, ...functionTwo, ...functionThree ]
    }

    instead of this:

    const foo = ({ polo }) => {
      const functionOne = () => myArray.map(item => (item.something === polo))
      const functionTwo = () => myArrayWithLongerName.map(
        item => (item.somethingElse === polo)
      )
      const functionThree = () => myArrayWithLongerName.map(
        item => (item.somethingElse === polo)
      )
      return [ ...functionOne, ...functionTwo, ...functionThree ]
    }
    8 replies
    It works if I set the parser to html, but in my project I'm using JSX.
    Nick Retallack
    @nickretallack
    Working around it using a template literal
    annyanich
    @ann-:matrix.org
    [m]
    Hey! I LOVE prettier, I use it to format everything in my Typescript / Vue projects. Now I am working in a PHP / Vue codebase (the FOSS online learning platform https://studip.de, for those interested) and am considering how to implement auto-formatting and linting on the PHP side. I understand that prettier-php is not yet stable, especially when it comes to mixed html and php. Yet I highly value the philosophy of low-config formatters like Prettier and Black. So my question is, are any of you working in PHP, and if so, how do you currently auto-format your production codebases?
    3 replies
    annyanich
    @ann-:matrix.org
    [m]
    :point_up: Edit: Hey! I LOVE prettier, I use it to format everything in my Typescript / Vue projects. Now I am working in a PHP / Vue codebase (the FOSS online learning platform https://studip.de, for those interested) and am considering how to implement auto-formatting and linting on the PHP side. I understand that prettier-php is not yet stable, especially when it comes to mixed html and php. Yet I highly value the philosophy of low-config formatters like Prettier and Black. So my question is, are any of you working in PHP, and if so, how do you currently auto-format and lint your production codebases?