Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    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?
    Michael Chen
    @michael:cnml.de
    [m]
    Hello, I just freshly installed prettier with the prettier-xml plugin but it does not seem to format my code with npx prettier --no-config file.xml and it outputs
    <root
      xmlns="urn:schemas-upnp-org:device-1-0"
      xmlns:r="urn:restful-tv-org:schemas:upnp-dd"
    >
    <specVersion>
    <major>1</major>
    <minor>0</minor>
    </specVersion>
    <device>
    <deviceType>urn:schemas-upnp-org:device:tvdevice:1</deviceType>
    <friendlyName>harman/kardon</friendlyName>
    <manufacturer> </manufacturer>
    <modelName>BDS</modelName>
    <UDN>uuid:a72dec90-f668-11de-8000-001c5022d4ad</UDN>
    </device>
    </root>