Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 Formater reports file as to be formatted but formatter does nothing #5087

Closed
1 task done
domiSchenk opened this issue Feb 11, 2025 · 9 comments
Closed
1 task done
Labels
S-Needs repro Status: needs a reproduction S-Needs response Status: await response from OP

Comments

@domiSchenk
Copy link

Environment information

CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           "v20.12.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

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:                 Space
  Indent width:                 4
  Line ending:                  Lf
  Line width:                   140
  Attribute position:           Auto
  Bracket spacing:              BracketSpacing(true)
  Ignore:                       []
  Include:                      []

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

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

CSS Formatter:
  Enabled:                      true
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Quote style:                  Double

GraphQL Formatter:
  Enabled:                      false
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Bracket spacing:              unset
  Quote style:                  unset

Workspace:
  Open Documents:               0

Configuration

{
    "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
    "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true, "defaultBranch": "main" },
    "files": {
        "ignoreUnknown": false,
        "ignore": [
            "**/*generated*",
            "./dist",
            "./coverage",
            "**/node_modules",
            "**/package.json",
            "**/package-lock.json",
            "**/.angular",
            "**/dx.generic.*-scheme.*",
            "**/.vs",
            "./.postcssrc.json",
            "./add-devextreme-license.js",
            "./angular.json",
            "./aspnetcore-https.js",
            "./db.json",
            "./devextreme.json",
            "./karma.conf.js",
            "./proxy.conf.js",
            "./routes.json",
            "./tailwind.config.js",
            "./tets.json",
            "./tsconfig.app.json",
            "./tsconfig.json",
            "./tsconfig.spec.json"
        ]
    },
    "formatter": {
        "enabled": true,
        "useEditorconfig": true,
        "formatWithErrors": false,
        "indentStyle": "space",
        "indentWidth": 4,
        "lineEnding": "lf",
        "lineWidth": 140,
        "attributePosition": "auto",
        "bracketSpacing": true,
        "ignore": []
    },
    "organizeImports": { "enabled": true },
    "linter": { "enabled": true, "rules": { "recommended": true } },
    "javascript": {
        "formatter": {
            "jsxQuoteStyle": "double",
            "quoteProperties": "asNeeded",
            "trailingCommas": "all",
            "semicolons": "always",
            "arrowParentheses": "always",
            "bracketSameLine": false,
            "quoteStyle": "single",
            "attributePosition": "auto",
            "bracketSpacing": true
        }
    },
    "overrides": [{ "include": ["*.html"] }]
}

Playground link

https://biomejs.dev/playground/?lineWidth=140&indentStyle=space&quoteStyle=single&indentWidth=4&code=LwAvACAAIgBUAGgAaQBzACAAaQBzACAAYQAgAFQAZQBzAHQAIABUAGkAdABsAGUAIQAgAEkAdAAnAHMAIABxAHUAaQB0AGUAIABpAG4AdABlAHIAZQBzAHQAaQBuAGcALgAiAAoALwAvACAATwB1AHQAcAB1AHQAOgAgACIAdABoAGkAcwAtAGkAcwAtAGEALQB0AGUAcwB0AC0AdABpA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wAdABpAHAAbABlACAAcwBlAHAAYQByAGEAdABvAHIAcwAKACAAIAAgACAAYwBvAG4AcwB0ACAAbQB1AGwAdABpAHAAbABlAFMAZQBwAGEAcgBhAHQAbwByAFIAZQBnAGUAeAAgAD0AIABuAGUAdwAgAFIAZQBnAEUAeABwACgAYAAkAHsAcwBlAHAAYQByAGEAdABvAHIAfQArAGAALAAgACcAZwAnACkAOwAKACAAIAAgACAAcwBsAHUAZwAgAD0AIABzAGwAdQBnAC4AcgBlAHAAbABhAGMAZQAoAG0AdQBsAHQAaQBwAGwAZQBTAGUAcABhAHIAYQB0AG8AcgBSAGUAZwBlAHgALAAgAHMAZQBwAGEAcgBhAHQAbwByACkAOwAKAAoAIAAgACAAIAAvAC8AIABUAHIAaQBtACAAbABlAGEAZABpAG4AZwAgAGEAbgBkACAAdAByAGEAaQBsAGkAbgBnACAAcwBlAHAAYQByAGEAdABvAHIAcwAKACAAIAAgACAAYwBvAG4AcwB0ACAAdAByAGkAbQBTAGUAcABhAHIAYQB0AG8AcgBSAGUAZwBlAHgAIAA9ACAAbgBlAHcAIABSAGUAZwBFAHgAcAAoAGAAXgAkAHsAcwBlAHAAYQByAGEAdABvAHIAfQArAHwAJAB7AHMAZQBwAGEAcgBhAHQAbwByAH0AKwAkAGAALAAgACcAZwAnACkAOwAKACAAIAAgACAAcwBsAHUAZwAgAD0AIABzAGwAdQBnAC4AcgBlAHAAbABhAGMAZQAoAHQAcgBpAG0AUwBlAHAAYQByAGEAdABvAHIAUgBlAGcAZQB4ACwAIAAnACcAKQA7AAoACgAgACAAIAAgAHIAZQB0AHUAcgBuACAAcwBsAHUAZwA7AAoAfQAKAA%3D%3D

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@domiSchenk domiSchenk added the S-Needs triage Status: this issue needs to be triaged label Feb 11, 2025
@ematipico
Copy link
Member

@domiSchenk you'll have to provide more information to us. The title is very cryptic and the playground doesn't show any additional information.

@ematipico ematipico added S-Needs repro Status: needs a reproduction S-Needs response Status: await response from OP labels Feb 11, 2025
Copy link
Contributor

Hello @domiSchenk, please provide a minimal reproduction. You can use one of the following options:

  • Provide a link to our playground, if it's applicable.
  • Provide a link to GitHub repository. To easily create a reproduction, you can use our interactive CLI via npm create @biomejs/biome-reproduction

Issues marked with S-Needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Feb 11, 2025
@domiSchenk
Copy link
Author

domiSchenk commented Feb 11, 2025

@ematipico omg you are fast :-D

here a repo that shows the problem:
https://github.com/domiSchenk/biome-repro-1739267746150

test.ts has a formatter error. interestingly the error does not show up on index.ts.

i how this helps find out whats the probelm

here a image of the output i get
Image

@ematipico
Copy link
Member

The original file has carriage returns as newlines cr, and Biome replaces them with line feed lf because it is its default. It's working as expected as per your configuration.

@domiSchenk
Copy link
Author

ahh looks like the VS code extension formatter doesn't do it.

biome check --write
fixes the file but vs code formatter (its biome) doesn't.

in the test repo does the vs code formatter replace the CR with the LF?

@ematipico
Copy link
Member

The test repo doesn't contain any VSCode settings, which means that the editor will use the user settings. Those settings differ from machine to machine, from user to user.

The result I will get from my machine will be different from yours.

I am closing the issue as it's not a Biome issue, and it's probably a VSCode settings issue.

@ematipico ematipico closed this as not planned Won't fix, can't repro, duplicate, stale Feb 11, 2025
@domiSchenk
Copy link
Author

so the biomejs.biome formattor does not use boime.json file to format the files?
if it would, should it replace the endings according to the config file?

 "[typescript]": {
        "editor.defaultFormatter": "biomejs.biome"
    },

@lveillard
Copy link

I have a similar issue so easy to reproduce.

I just have a test.json with the content {"A": 'a'} it formats correctly the spaces but not the double quoites, it just reports as an error.

Doing Format Document (Forced) does work like prettier/eslint, but

biome check --write test.json

Throws an error but does not format it.

I added {formatter.formatWithErrors: true} and still not working.

Same when the keys are stated without the quotes, i would expect automatic correction but the formatter does nothing unless using the forced option

@ematipico
Copy link
Member

@lveillard why would you expect correct formatting? Single quotes in JSON files aren't valid by spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Needs repro Status: needs a reproduction S-Needs response Status: await response from OP
Projects
None yet
Development

No branches or pull requests

3 participants