by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    The reason prettier works that way by default is that your manual reformat technically adds whitespace to the value inside the tag.
    Eric Nemchik
    @nemchik
    that makes sense. so using htmlWhitespaceSensitivity: "ignore" would accomplish what i want visually, but would be adding white space that could affect the output of the markup itself. (assuming ignore means what i think it means after reading. the docs don't really explain explicitly the difference between the 3 options - saying whitespace is ignored or not doesn't quite explain the effect, thus i had overlooked this option when searching the docs initially)
    Ryan Zimmerman
    @RyanZim
    Yep, ignore should do what you describe.
    Ghost
    @ghost~5ec7a467d73408ce4fe48f3d
    Hey 👋
    There is a neat feature request for WebStorm/PhpStorm for better code folding support. Prettier is formating long class names in a new line. But if the element is folded there is no way to see it in the IDE. If anyone got a JetBrains account and could maybe upvote for this feature request: https://youtrack.jetbrains.com/issue/WEB-45637
    It would mean alot for me. This would make prettier even better with JetBrains Products :)
    Javed Bartlett
    @javedbartlett
    image.png
    Hello!
    I was wondering if it were possible to have parens added around a block of multiline jsx with prettier?
    Every time I save my file it removes the parens and it's not lining up with my companies lint config
    Ryan Zimmerman
    @RyanZim
    prettier does not comply with arbitrary lint configs. If you must comply with an external config, you might look into prettier-eslint, to let eslint re-add the parens.
    Manuel Mendez
    @mmlb
    hey all, I went looking in the docs and github issues and couldn't find the answer to my quesion: how can I configure prettier to sort json object by keys?
    I've got a markdown file with what was a one line json blob wrapped in "```json", and prettier reflowed to many lines ( :+1: ) but it would be nice to also sort the keys.
    I saw an issue about package.json but I'm looking for more generic json sorting.
    also maybe yaml too
    hmm looks like prettier does not do the json reflow in the ```json within markdown, looks like I did that manually
    Gregorio Setti
    @desmondhume

    Hi! I'm using prettier on some markdown files, but it seems to ignore errors inside the yaml front matter.
    The prettier playground show the error correctly but not my local setup (they have the same versions and options):

    Prettier 2.0.5
    Playground link

    --parser mdx

    Input:

    ---
    title: test: 1
    ---
    
    # Test 1

    Output:

    SyntaxError: Nested mappings are not allowed in compact mappings (1:8)
    > 1 | title: test: 1
        |        ^^^^^^^
    any idea?
    Jed Fox
    @j-f1
    Prettier just ignores invalid syntax in embedded languages because we can never be positive that you intended to embed something of a different language. However on the playground we throw errors, probably for debugging purposes.
    Gregorio Setti
    @desmondhume
    got it :thumbsup: I guess I'll be able to hook a remark plugin to check it maybe :thought_balloon:
    G. Richard Bellamy
    @rbellamy
    When trying to work with the XML plugin (https://github.com/prettier/plugin-xml) using Typescript, I get a compilation error:
    return prettier.format(
          dom.serialize(),
          {
            printWidth: options.printWidth,
            tabWidth: options.tabWidth,
            parser: "xml"
          });
    TS2322: Type 'xml' is not assignable to type '"babel" | "babel-flow" | "babel-ts" | "flow" | "typescript" | "css"...
    I'm open to suggestions
    t7yang
    @t7yang
      const add = useCallback(
        (uuid: string) => value.every(each => each !== uuid) && handleChange([...value, uuid]),
        [value, handleChange]
      );
    
      const remove = useCallback((uuid: string) => handleChange(value.filter(each => each !== uuid)), [
        value,
        handleChange,
      ]);
    I think the latter (which format by prettier) is less readability
    Spunkie
    @Spunkie

    Can someone please help me figure out why eslint->prettier is complaining about random unexpected tokens on .html files?

    This is a fairly close to default setup from create-nuxt-app when selecting both eslint and prettier. Everything else is working great expect this one html file, and I'm way into a rabbit hole of docs and GH issue with no avail.

    In that example I can move tags around it's just complain about one of them with an unexpect token error, usually complaining about whatever the 3rd tag under <head> is. Or it'll just complain about line 6 when it's completely blank, just weirdness in general.
    Ehcane
    @ehcane
    Hello guys, I am struggling with configuring Prettier. I am very pleased with how everything works but I want to change how it modifies my css files. For these I want it just to add semicolons at the end of the lines without modifying the spaces and blank lines in the file.
    Mark Kevin Besinga
    @besingamkb
    hello. i dont really know how to configure prettier but I just use it on my vscode but suddenly right now my package.json has been formated using 4 spaces instead of 2. how can I fix that? this is my vscode settings.json
    {
      "workbench.iconTheme": "vscode-icons",
      "editor.formatOnPaste": true,
      "editor.formatOnSave": true,
      "editor.codeActionsOnSave": {
        "source.fixAll": true
      },
      "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
      "javascript.format.placeOpenBraceOnNewLineForControlBlocks": false,
      "javascript.format.placeOpenBraceOnNewLineForFunctions": false,
      "typescript.format.insertSpaceBeforeFunctionParenthesis": true,
      "typescript.format.placeOpenBraceOnNewLineForControlBlocks": false,
      "typescript.format.placeOpenBraceOnNewLineForFunctions": false,
      "vetur.format.defaultFormatter.html": "js-beautify-html",
      "vetur.format.defaultFormatter.js": "vscode-typescript",
      "[vue]": {
        "editor.defaultFormatter": "octref.vetur"
      },
      "prettier.tabWidth": 2
    }
    Marceau Maubert
    @marceau-maubert
    hi, I'm currently having an issue where the script part of my .vue files are refusing to get formatted by prettier in vscode properly, despite the output log saying that it's doing it. I tried messing with all kinds of settings and the only setting I could get to work is vueIndentScriptAndStyle. any idea why?