Skip to content

Template literal indentation #1890

@anthonator

Description

@anthonator

I imagine this is a common enough issue that it's been reported before but I wasn't able to find anything in the open or closed issue log. Apologies if this is a duplicate.

Lines 7-13 in the snippet below throw an indent error. I can "fix" the issue by adding TemplateLiteral to indent's ignoredNodes option. I'd ask that this fix be added unless there's a fundamental reason why this is a bad idea.

const build = font => `
  @font-face {
    font-display: ${font.display || 'swap'};
    font-family: ${font.family};
    font-style: ${font.style || 'normal'};
    font-weight: ${font.weight};
    src: ${
      font.formats.map(
        format => (
          `url("${format.file}") format("${format.type}")`
        ),
      )
    }
  }
`;

export default fonts => fonts.map(font => build(font));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions