Skip to content

Prettier error: Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? #258

Closed as not planned
@marekdedic

Description

@marekdedic

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

8.23.1

What version of eslint-plugin-svelte are you using?

2.8.0

What did you do?

Configuration
module.exports = {
  parserOptions: {
    parser: "@typescript-eslint/parser",
    project: "./tsconfig.json",
    sourceType: "script",
    extraFileExtensions: [".svelte"],
  },
  env: {
    browser: true,
    node: false,
  },
  plugins: ["@typescript-eslint"],
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:@typescript-eslint/recommended-requiring-type-checking",
    "plugin:svelte/recommended",
    "plugin:prettier/recommended",
    "plugin:svelte/prettier",
  ],
  overrides: [
    {
      files: ["*.svelte"],
      parser: "svelte-eslint-parser",
      parserOptions: {
        parser: "@typescript-eslint/parser",
      },
    },
  ],
};
<h2>
  {$_("steps." + step + ".header")}
</h2>

<script lang="ts">
  import {_} from "svelte-i18n";

  export let step: string;
</script>

<style lang="scss">
  @import "@material/typography/mdc-typography";
</style>

What did you expect to happen?

No prettier error

What actually happened?

I got Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? error from eslint-plugin-prettier

Link to Minimal Reproducible Example

I can't get eslint-plugin-prettier running in your playground. For a (non-minimal) repro, see skaut/shared-drive-mover@563b5a9

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions