biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
15.1k stars 471 forks source link

📝 New lines are added after formatting #2877

Closed MuhammadSawalhy closed 5 months ago

MuhammadSawalhy commented 5 months ago

Environment information

CLI:
  Version:                      1.7.1
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.12.2"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/9.1.0"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Formatter:
  Format with errors:           false
  Indent style:                 Tab
  Indent size:                  0
  Indent width:                 0
  Line ending:                  Crlf
  Line width:                   80
  Attribute position:           Auto
  Ignore:                       []
  Include:                      []

JavaScript Formatter:
  Enabled:                      true
  JSX quote style:              Double
  Quote properties:             AsNeeded
  Trailing comma:               All
  Semicolons:                   Always
  Arrow parentheses:            Always
  Bracket spacing:              true
  Bracket same line:            false
  Quote style:                  Double
  Indent style:                 unset
  Indent size:                  unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Attribute position:           Auto

JSON Formatter:
  Enabled:                      true
  Indent style:                 unset
  Indent width:                 unset
  Indent size:                  unset
  Line ending:                  unset
  Line width:                   unset
  Trailing Commas:              unset

Workspace:
  Open Documents:               0

Configuration

{
    "$schema": "https://biomejs.dev/schemas/1.7.1/schema.json",
    "vcs": {
        "enabled": true,
        "clientKind": "git",
        "defaultBranch": "main"
    },
    "organizeImports": {
        "enabled": true
    },
    "linter": {
        "enabled": true,
        "rules": {
            "recommended": true,
            "correctness": {
                "noUnusedVariables": "error",
                "noUnusedImports": "error"
            },
            "suspicious": {
                "noConsoleLog": "warn"
            }
        }
    },
    "formatter": {
        "enabled": true,
        "lineEnding": "crlf"
    },
    "overrides": [
        {
            "include": [
                "./packages/plate-editor/**/*.ts",
                "./packages/plate-editor/**/*.tsx"
            ],
            "linter": {
                "rules": {
                    "suspicious": {
                        "noExplicitAny": "off"
                    },
                    "a11y": {
                        "noSvgWithoutTitle": "off"
                    },
                    "style": {
                        "noNonNullAssertion": "off",
                        "useNamingConvention": {
                            "level": "error",
                            "options": {
                                "strictCase": false
                            }
                        }
                    }
                }
            }
        }
    ]
}

Playground link

https://codesandbox.io/p/sandbox/vigilant-hugle-97ykdp

Code of Conduct

MuhammadSawalhy commented 5 months ago

Run the following command multiple times and you will notice that each time new empty lines are adding the some of the className props multiline string. I think this error is related to use crlf as the line ending.

npx biome format src/index.js --write

msedge_GMx6VQrBR9