prettier v2.0 Release Notes

  • ๐Ÿ’… JavaScript: Fix formatting of pseudo-elements and pseudo-classes in styled-components template literals (#7842 by @thorn0)

    <!-- prettier-ignore -->

    // Input
    const Foo = styled.div`
      ${media.smallDown}::before {}
    `;
    
    // Prettier 2.0.0
    const Foo = styled.div`
      ${media.smallDown}: : before{
      }
    `;
    
    // Prettier 2.0.2
    const Foo = styled.div`
      ${media.smallDown}::before {
      }
    `;
    

    TypeScript: Avoid trailing commas on index signatures with only one parameter (#7836 by @bakkot)

    ๐Ÿ“œ TypeScript index signatures technically allow multiple parameters and trailing commas, but it's an error to have multiple parameters there, and Babel's TypeScript parser does not accept them. So Prettier now avoids putting a trailing comma there when you have only one parameter.

    <!-- prettier-ignore -->

    // Input
    export type A = {
      a?: {
        [
          x: string
        ]: typeof SomeLongLongLongTypeName[keyof typeof SomeLongLongLongTypeName];
      } | null;
    };
    
    // Prettier 2.0.0
    export type A = {
      a?: {
        [
          x: string,
        ]: typeof SomeLongLongLongTypeName[keyof typeof SomeLongLongLongTypeName];
      } | null;
    };
    
    // Prettier 2.0.2
    export type A = {
      a?: {
        [
          x: string
        ]: typeof SomeLongLongLongTypeName[keyof typeof SomeLongLongLongTypeName];
      } | null;
    };
    

    โช Revert "markdown: fix redundant leading spaces in markdown list" (#7847)

    ๐Ÿ‘€ See #7846