-
Hi, I'm experiencing an issue that might be a bug, but I suspect it's related to configuration. In my VS Code, the "fix-on-save" option for rules like "useSelfClosingElements" and "useTemplate" only works if I explicitly set {"fix": "safe"} in the linter rule options: {
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noNonNullAssertion": "warn",
"useNamingConvention": {
"level": "warn",
"options": {
"enumMemberCase": "CONSTANT_CASE",
"strictCase": false
}
},
"useSelfClosingElements": {
"level": "warn",
"fix": "safe"
},
"useTemplate": {
"level": "warn",
"fix": "safe"
}
},
"suspicious": {
"noExplicitAny": "off"
},
"complexity": {
"noForEach": "off"
},
"correctness": {
"useExhaustiveDependencies": "off",
"noUnusedImports": "warn",
"noUnusedVariables": "warn",
"noInvalidUseBeforeDeclaration": "warn"
}
}
},
"formatter": {
"formatWithErrors": true
},
"javascript": {
"formatter": {
"arrowParentheses": "always",
"jsxQuoteStyle": "double",
"semicolons": "asNeeded",
"trailingCommas": "es5",
"quoteStyle": "single",
"indentStyle": "space"
}
},
"json": {
"formatter": {
"enabled": true
},
"parser": {
"allowComments": true,
"allowTrailingCommas": true
}
}
}
Is this the intended behavior? Can I set all recommended rules to {"fix": "safe"} globally, or do I need to specify this option for each rule individually? Thank you for your assistance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Biome has the concept of safe fixes and unsafe fixes. Fix-on-save applies only safe fixes. As you figured out, you can change the safety of a fix. By marking it as
It is not possible to mark all fixes as safe for now. Fixes of some rules could be reworked |
Beta Was this translation helpful? Give feedback.
Biome has the concept of safe fixes and unsafe fixes. Fix-on-save applies only safe fixes. As you figured out, you can change the safety of a fix. By marking it as
safe
you allows them to be fixed-on-save.It is not possible to mark all fixes as safe for now.
Thus, you have to set them for every rule you want to fix-on-save.
This avoids bad surprises and requires you to think carefully each time you want to apply automatically some fixes.
Fixes of some rules could be reworked