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

πŸ“ disabling formatter doesn't work #2924

Closed
1 task done
anonrig opened this issue May 20, 2024 · 9 comments Β· Fixed by #2957
Closed
1 task done

πŸ“ disabling formatter doesn't work #2924

anonrig opened this issue May 20, 2024 · 9 comments Β· Fixed by #2957
Assignees
Labels
A-Formatter Area: formatter A-Project Area: project S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@anonrig
Copy link
Contributor

anonrig commented May 20, 2024

Environment information

❯ yarn biome rage --formatter
yarn run v1.22.22
$ /Users/yagiz/coding/sentry/node_modules/.bin/biome rage --formatter
CLI:
  Version:                      1.7.3
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-ghostty"
  JS_RUNTIME_VERSION:           "v20.13.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "yarn/1.22.22"

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

Formatter:
  Format with errors:           true
  Indent style:                 Space
  Indent size:                  0
  Indent width:                 2
  Line ending:                  Lf
  Line width:                   80
  Attribute position:           Auto
  Ignore:                       ["tests/**/*.json"]
  Include:                      []

JavaScript Formatter:
  Enabled:                      false
  JSX quote style:              Double
  Quote properties:             AsNeeded
  Trailing comma:               Es5
  Semicolons:                   Always
  Arrow parentheses:            AsNeeded
  Bracket spacing:              false
  Bracket same line:            false
  Quote style:                  Single
  Indent style:                 unset
  Indent size:                  unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   90
  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

{
  "formatter": {
    "enabled": true,
    "formatWithErrors": true,
    "indentStyle": "space",
    "indentWidth": 2,
    "lineEnding": "lf",
    "ignore": ["tests/**/*.json"]
  },
  "javascript": {
    "formatter": {
      "enabled": false,
      "lineWidth": 90,
      "quoteStyle": "single",
      "jsxQuoteStyle": "double",
      "quoteProperties": "asNeeded",
      "trailingComma": "es5",
      "semicolons": "always",
      "arrowParentheses": "asNeeded",
      "bracketSpacing": false,
      "bracketSameLine": false
    }
  },
  "json": {
    "formatter": {
      "enabled": true
    }
  },
}

Playground link

getsentry/sentry#71157

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@anonrig
Copy link
Contributor Author

anonrig commented May 20, 2024

Disabling javascript formatter still proposes the following change:

./static/app/utils/queryClient.tsx format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  βœ– Formatter would have printed the following content:

    290 290 β”‚   }
    291 291 β”‚
    292     β”‚ - typeΒ·ApiMutationVariables<
    293     β”‚ - Β·Β·HeadersΒ·=Β·Record<string,Β·string>,
    294     β”‚ - Β·Β·QueryΒ·=Β·Record<string,Β·any>,
    295     β”‚ - >Β·=
        292 β”‚ + typeΒ·ApiMutationVariables<HeadersΒ·=Β·Record<string,Β·string>,Β·QueryΒ·=Β·Record<string,Β·any>>Β·=
    296 293 β”‚     | ['PUT' | 'POST' | 'DELETE', string]
    297 294 β”‚     | ['PUT' | 'POST' | 'DELETE', string, QueryKeyEndpointOptions<Headers, Query>]

@ematipico ematipico added A-Project Area: project A-Formatter Area: formatter S-Bug-confirmed Status: report has been confirmed as a valid bug labels May 20, 2024
@dyc3
Copy link
Contributor

dyc3 commented May 20, 2024

I think I can pick this one up.

@dyc3
Copy link
Contributor

dyc3 commented May 21, 2024

It appears that the file capabilities are generally being set correctly for javascript files

  2024-05-21T13:05:54.598320Z DEBUG  File capabilities: Js(JsFileSource { language: TypeScript { definition_file: false }, variant: Jsx, module_kind: Module, version: ES2022, embedding_kind: None }) BiomePath { path: "/home/carson/Documents/code/other/sentry/static/app/views/performance/styles.tsx" }
    at crates/biome_service/src/workspace/server.rs:114 on biome::worker_4

[crates/biome_service/src/workspace.rs:159:9] file_source.is_javascript_like() = true
[crates/biome_service/src/workspace.rs:159:9] settings.formatter().enabled = true
[crates/biome_service/src/workspace.rs:159:9] settings.javascript_formatter_disabled() = true
  2024-05-21T13:05:54.598829Z DEBUG  The file has the following feature sets:
{Lint: Supported, Format: FeatureNotEnabled, OrganizeImports: FeatureNotEnabled, Search: FileNotSupported}
    at crates/biome_service/src/workspace.rs:207 on biome::worker_4

But not this one specifically?

../biome/target/debug/biome format --log-level debug ./static/app/utils/queryClient.tsx

output:

  2024-05-21T13:09:57.576811Z DEBUG  File capabilities: Js(JsFileSource { language: TypeScript { definition_file: false }, variant: Jsx, module_kind: Module, version: ES2022, embedding_kind: None }) BiomePath { path: "./static/app/utils/queryClient.tsx" }
    at crates/biome_service/src/workspace/server.rs:114 on biome::worker_1

[crates/biome_service/src/workspace.rs:159:9] file_source.is_javascript_like() = true
[crates/biome_service/src/workspace.rs:159:9] settings.formatter().enabled = true
[crates/biome_service/src/workspace.rs:159:9] settings.javascript_formatter_disabled() = true
  2024-05-21T13:09:57.577124Z DEBUG  The file has the following feature sets:
{Search: FileNotSupported, Lint: Supported, OrganizeImports: FeatureNotEnabled, Format: Supported}
    at crates/biome_service/src/workspace.rs:207 on biome::worker_1

@dyc3
Copy link
Contributor

dyc3 commented May 21, 2024

Ah I think I figured it out. There's an override set for that specific file, and that override is somehow enabling the formatter.

{
      "include": [
        "static/app/utils/replays/types.tsx",
        "static/app/utils/queryClient.tsx", // <-- the file
        "static/app/views/performance/traceDetails/styles.tsx",
        "static/app/icons/index.tsx",
        "static/app/components/tabs/index.tsx",
        "static/app/components/sparklines/line.tsx",
        "static/app/types/index.tsx",
        "tests/js/sentry-test/reactTestingLibrary.tsx",
        "tests/js/sentry-test/index.tsx"
      ],
      "linter": {
        "rules": {
          "performance": {
            "noBarrelFile": "off"
          }
        }
      }
    }

@anonrig
Copy link
Contributor Author

anonrig commented May 21, 2024

Nice catch @dyc3

@ematipico
Copy link
Member

So it's not a Biome bug?

@Sec-ant
Copy link
Member

Sec-ant commented May 21, 2024

So it's not a Biome bug?

I think it's still a Biome bug because that override entry didn't enable the js formatter, so it should be kept disabled?

@ematipico
Copy link
Member

I'm still waiting for a minimal reproduction, though.

@dyc3
Copy link
Contributor

dyc3 commented May 23, 2024

Repro will be in a test in my PR when I post it. Been busy with IRL stuff, should be up by end of my day (tomorrow morning for you @ematipico probably)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Formatter Area: formatter A-Project Area: project S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants