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

🐛 File corrupted on save after adding import with quickfix #442

Open
1 of 3 tasks
leemhenson opened this issue Dec 10, 2024 · 2 comments
Open
1 of 3 tasks

🐛 File corrupted on save after adding import with quickfix #442

leemhenson opened this issue Dec 10, 2024 · 2 comments
Labels

Comments

@leemhenson
Copy link

VS Code version

1.95.3

Extension version

2.3.0

Biome version

1.9.4

Operating system

  • Windows
  • macOS
  • Linux

Description

Occasionally, I will add some code that requires an import adding. I use the quickfix to automatically add the import, and when it hit Cmd+S to format and save the file the imports get corrupted.

Steps to reproduce

biomebug.mp4

Expected behavior

I don't want my imports mangled 😁

Does this issue occur when using the CLI directly?

No

Link to a minimal reproduction

No response

Logs

No response

@leemhenson
Copy link
Author

biome.json

{
  "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
  "files": {
    "ignore": [
      "**/animations/*.json",
      "**/assets/*",
      "**/build/**/*",
      "**/dist/**/*",
      "**/isolate/**/*",
      "**/native-app/android/**/*",
      "**/native-app/ios/**/*",
      "**/node_modules/**/*",
      "**/.emulator-data/**/*"
    ],
    "ignoreUnknown": false
  },
  "formatter": {
    "enabled": true,
    "indentStyle": "space"
  },
  "javascript": {
    "formatter": {
      "arrowParentheses": "asNeeded",
      "quoteStyle": "double"
    }
  },
  "linter": {
    "enabled": true,
    "rules": {
      "complexity": {
        "noBannedTypes": "error",
        "noExtraBooleanCast": "error",
        "noForEach": "off",
        "noMultipleSpacesInRegularExpressionLiterals": "error",
        "noUselessCatch": "error",
        "noUselessThisAlias": "error",
        "noUselessTypeConstraint": "error",
        "noWith": "error"
      },
      "correctness": {
        "noConstAssign": "error",
        "noConstantCondition": "error",
        "noEmptyCharacterClassInRegex": "error",
        "noEmptyPattern": "error",
        "noGlobalObjectCalls": "error",
        "noInnerDeclarations": "error",
        "noInvalidConstructorSuper": "error",
        "noNewSymbol": "error",
        "noNonoctalDecimalEscape": "error",
        "noPrecisionLoss": "error",
        "noSelfAssign": "error",
        "noSetterReturn": "error",
        "noSwitchDeclarations": "error",
        "noUndeclaredVariables": "error",
        "noUnreachable": "error",
        "noUnreachableSuper": "error",
        "noUnsafeFinally": "error",
        "noUnsafeOptionalChaining": "error",
        "noUnusedLabels": "error",
        "noUnusedVariables": "error",
        "useArrayLiterals": "off",
        "useHookAtTopLevel": "error",
        "useIsNan": "error",
        "useValidForDirection": "error",
        "useYield": "error"
      },
      "nursery": {
        "useSortedClasses": {
          "fix": "safe",
          "level": "warn",
          "options": {
            "attributes": [
              "class",
              "className",
              "containerStyle",
              "contentContainerStyle",
              "contentStyle",
              "ngClass",
              "style",
              "titleClassName"
            ],
            "functions": ["clsx", "cva", "tw", "tw.style"]
          }
        }
      },
      "recommended": true,
      "style": {
        "noNamespace": "error",
        "noNonNullAssertion": "off",
        "noParameterAssign": "off",
        "useAsConstAssertion": "error",
        "useBlockStatements": "off",
        "useImportType": "off",
        "useNodejsImportProtocol": "off"
      },
      "suspicious": {
        "noAssignInExpressions": "error",
        "noAsyncPromiseExecutor": "error",
        "noCatchAssign": "error",
        "noClassAssign": "error",
        "noCompareNegZero": "error",
        "noConsole": {
          "level": "warn",
          "options": {
            "allow": ["error"]
          }
        },
        "noControlCharactersInRegex": "error",
        "noDebugger": "error",
        "noDuplicateCase": "error",
        "noDuplicateClassMembers": "error",
        "noDuplicateObjectKeys": "error",
        "noDuplicateParameters": "error",
        "noEmptyBlockStatements": "error",
        "noExplicitAny": "error",
        "noExtraNonNullAssertion": "error",
        "noFallthroughSwitchClause": "error",
        "noFunctionAssign": "error",
        "noGlobalAssign": "error",
        "noImportAssign": "error",
        "noMisleadingCharacterClass": "error",
        "noMisleadingInstantiator": "error",
        "noPrototypeBuiltins": "error",
        "noRedeclare": "error",
        "noShadowRestrictedNames": "error",
        "noSparseArray": "error",
        "noUnsafeDeclarationMerging": "error",
        "noUnsafeNegation": "error",
        "useGetterReturn": "error",
        "useValidTypeof": "error"
      }
    }
  },
  "organizeImports": {
    "enabled": true
  },
  "overrides": [
    {
      "include": [
        "**/*.stories.tsx",
        "scripts/*.ts",
        "packages/*/scripts/*.js",
        "packages/*/scripts/*.ts"
      ],
      "linter": {
        "rules": {
          "suspicious": {
            "noConsole": "off"
          }
        }
      }
    },
    {
      "include": ["*.ts", "*.tsx", "*.mts", "*.cts"],
      "linter": {
        "rules": {
          "correctness": {
            "noConstAssign": "off",
            "noGlobalObjectCalls": "off",
            "noInvalidConstructorSuper": "off",
            "noNewSymbol": "off",
            "noSetterReturn": "off",
            "noUndeclaredVariables": "off",
            "noUnreachable": "off",
            "noUnreachableSuper": "off"
          },
          "style": {
            "noArguments": "error",
            "noVar": "error",
            "useConst": "error"
          },
          "suspicious": {
            "noDuplicateClassMembers": "off",
            "noDuplicateObjectKeys": "off",
            "noDuplicateParameters": "off",
            "noFunctionAssign": "off",
            "noImportAssign": "off",
            "noRedeclare": "off",
            "noUnsafeNegation": "off",
            "useGetterReturn": "off"
          }
        }
      }
    },
    {
      "formatter": {
        "enabled": false
      },
      "include": [
        "someLongPath/animations/*.json",
        "someLongPath/animations/*.ts"
      ],
      "linter": {
        "enabled": false
      },
      "organizeImports": {
        "enabled": false
      }
    },
    {
      "formatter": {
        "enabled": false
      },
      "include": ["**/storybook.requires.ts"],
      "linter": {
        "enabled": false
      }
    }
  ],
  "vcs": {
    "clientKind": "git",
    "enabled": false,
    "useIgnoreFile": false
  }
}

@zommerberg
Copy link

zommerberg commented Dec 10, 2024

Same issue, some ppl say to switch to the pre-release version but that breaks the extension even more to the point where it cant edit .tsx files...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants