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

🐛 Plugin ignores overrides in config #2782

Closed
1 of 3 tasks
ska-kialo opened this issue Apr 25, 2024 · 3 comments · Fixed by #2936 or abdulrahman305/continue#2
Closed
1 of 3 tasks

🐛 Plugin ignores overrides in config #2782

ska-kialo opened this issue Apr 25, 2024 · 3 comments · Fixed by #2936 or abdulrahman305/continue#2
Labels
A-LSP Area: language server protocol S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@ska-kialo
Copy link

VS Code version

1.88.1

Extension version

2.2.2

Biome version

1.7.0

Operating system

  • Windows
  • macOS
  • Linux

Description

If a lint rule is enabled in the main "linter" property in biome.json and then overridden for some files in the overrides list, this override is ignored by the plugin.

Steps to reproduce

  1. Create a biome.json and enable an auto-fixable lint rule (e.g. style/useEnumInitializers).
  2. Create an overrides section and disable that same rule in there for some (or all) TypeScript files.
  3. Enable auto-fixing files with biome on explicit save in VSCode.
  4. Save a file with some code that violates the rule.
  5. Explicitly save the file.
  6. The file contents are modified with an auto-fix for the lint rule.

biome.json:

{
    "$schema": "https://biomejs.dev/schemas/1.7.0/schema.json",
    "organizeImports": { "enabled": false },
    "linter": {
        "enabled": true,
        "rules": {
            "recommended": false,
            "style": {
                "useEnumInitializers": "error"
            }
        }
    },
    "overrides": [
        {
            "include": ["*.ts", "*.tsx"],
            "linter": {
                "rules": {
                    "style": {
                        "useEnumInitializers": "off"
                    }
                }
            }
        }
    ]
}

VSCode config:

{
    "[typescript]": {
        "editor.codeActionsOnSave": {
            "quickfix.biome": "explicit",
        }
    }
}

TypeScript file test.ts:

enum X {
    A,
    B,
}

Expected behavior

The file is saved without modification.

Does this issue occur when using the CLI directly?

No

Logs

No response

@ematipico
Copy link
Member

Is the configuration file in the root directory of your project? Does the CLI give you the same result?

@ska-kialo
Copy link
Author

Yes, the config file is at the root directory. The CLI ignores the rule for the files specified in overrides as expected.

@nhedger
Copy link
Member

nhedger commented May 9, 2024

I'm able to reproduce the issue.

  • CLI does not report anything, as expected
  • LSP runs the rule, even though the overrides disable it
[Trace - 09:55:55] Received response 'textDocument/codeAction - (37)' in 3ms.
Result: [
    {
        "title": "Initialize all enum members.",
        "kind": "quickfix.biome.style.useEnumInitializers",
        "edit": {
            "changes": {
                "file:///Users/nicolas/code/repro/index.ts": [
                    {
                        "range": {
                            "start": {
                                "line": 1,
                                "character": 5
                            },
                            "end": {
                                "line": 1,
                                "character": 5
                            }
                        },
                        "newText": " = 0"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 2,
                                "character": 5
                            },
                            "end": {
                                "line": 2,
                                "character": 5
                            }
                        },
                        "newText": " = 1"
                    }
                ]
            }
        },
        "isPreferred": true
    }
]

I'm moving this to the main repo, because this is most likely an LSP issue.

@nhedger nhedger transferred this issue from biomejs/biome-vscode May 9, 2024
@nhedger nhedger added A-LSP Area: language server protocol S-Bug-confirmed Status: report has been confirmed as a valid bug labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LSP Area: language server protocol S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
3 participants