Replies: 4 comments 7 replies
-
We could address this when we will revamp our configuration #689. Notably if we associate the severity level to the group, a user could set the severity level of every group to |
Beta Was this translation helpful? Give feedback.
-
I also want this feature. I find "error"s in VS Code highly distracting when "errors" in the IDE usually mean "this will not compile" or "this has a bug and will not work". I would feel excellent about this being a fix for the VS Code extension side, though, since it's entirely about the editing experience for me and my team. |
Beta Was this translation helpful? Give feedback.
-
OK, I know this is definitely nothing more than an ugly temporary solution, but some might find it helpful: TL;DRCopy this to reduce severity of most of the rules as {
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"formatter": { "enabled": false },
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"complexity": {
"noUselessSwitchCase": "warn",
"noUselessFragments": "warn",
"noThisInStatic": "warn",
"useSimpleNumberKeys": "warn",
"noUselessCatch": "warn",
"noEmptyTypeParameters": "warn",
"noUselessThisAlias": "warn",
"noUselessConstructor": "warn",
"noUselessLoneBlockStatements": "warn",
"useFlatMap": "warn",
"useRegexLiterals": "warn",
"noStaticOnlyClass": "warn",
"useOptionalChain": "warn",
"noUselessEmptyExport": "warn",
"noExtraBooleanCast": "warn",
"noUselessTypeConstraint": "warn",
"noForEach": "warn",
"noBannedTypes": "warn",
"noMultipleSpacesInRegularExpressionLiterals": "warn",
"noWith": "warn",
"useLiteralKeys": "warn",
"noUselessTernary": "warn",
"noUselessRename": "warn",
"useArrowFunction": "warn",
"noExcessiveNestedTestSuites": "warn",
"noUselessLabel": "warn"
},
"correctness": {
"noUnreachable": "warn",
"noSetterReturn": "warn",
"useYield": "warn",
"noSwitchDeclarations": "warn",
"noUnusedLabels": "warn",
"noUnsafeFinally": "warn",
"noChildrenProp": "warn",
"useIsNan": "warn",
"noEmptyPattern": "warn",
"noInvalidConstructorSuper": "warn",
"noRenderReturnValue": "warn",
"noSelfAssign": "warn",
"noConstAssign": "warn",
"noFlatMapIdentity": "warn",
"noStringCaseMismatch": "warn",
"noPrecisionLoss": "warn",
"noGlobalObjectCalls": "warn",
"noUnreachableSuper": "warn",
"noConstructorReturn": "warn",
"noNonoctalDecimalEscape": "warn",
"useJsxKeyInIterable": "warn",
"noEmptyCharacterClassInRegex": "warn",
"noInnerDeclarations": "warn",
"noConstantCondition": "warn",
"noVoidElementsWithChildren": "warn",
"noUnsafeOptionalChaining": "warn",
"useExhaustiveDependencies": "warn",
"useValidForDirection": "warn",
"noInvalidUseBeforeDeclaration": "warn",
"noUnnecessaryContinue": "warn",
"noVoidTypeReturn": "warn"
},
"nursery": {},
"performance": { "noDelete": "warn", "noAccumulatingSpread": "warn" },
"security": {
"noDangerouslySetInnerHtmlWithChildren": "warn",
"noGlobalEval": "warn",
"noDangerouslySetInnerHtml": "warn"
},
"style": {
"useSelfClosingElements": "warn",
"noCommaOperator": "warn",
"noInferrableTypes": "warn",
"useConst": "warn",
"useShorthandFunctionType": "warn",
"noArguments": "warn",
"useDefaultParameterLast": "warn",
"noUnusedTemplateLiteral": "warn",
"useExponentiationOperator": "warn",
"useEnumInitializers": "warn",
"useAsConstAssertion": "warn",
"useNodejsImportProtocol": "warn",
"useNumberNamespace": "warn",
"noNonNullAssertion": "warn",
"useWhile": "warn",
"useLiteralEnumMembers": "warn",
"noUselessElse": "warn",
"useSingleVarDeclarator": "warn",
"noParameterAssign": "warn",
"useNumericLiterals": "warn",
"useExportType": "warn",
"useImportType": "warn",
"noVar": "warn",
"useTemplate": "warn"
},
"suspicious": {
"noAsyncPromiseExecutor": "warn",
"noLabelVar": "warn",
"noDuplicateObjectKeys": "warn",
"noUnsafeDeclarationMerging": "warn",
"noDoubleEquals": "warn",
"noDuplicateParameters": "warn",
"noFocusedTests": "warn",
"noFunctionAssign": "warn",
"noGlobalIsNan": "warn",
"noConfusingVoidType": "warn",
"useDefaultSwitchClauseLast": "warn",
"useIsArray": "warn",
"noImplicitAnyLet": "warn",
"noEmptyInterface": "warn",
"noExplicitAny": "warn",
"noAssignInExpressions": "warn",
"useGetterReturn": "warn",
"useValidTypeof": "warn",
"useNamespaceKeyword": "warn",
"noControlCharactersInRegex": "warn",
"noMisleadingCharacterClass": "warn",
"noImportAssign": "warn",
"noExtraNonNullAssertion": "warn",
"noCommentText": "warn",
"noFallthroughSwitchClause": "warn",
"noShadowRestrictedNames": "warn",
"noArrayIndexKey": "warn",
"noRedeclare": "warn",
"noConfusingLabels": "warn",
"noCompareNegZero": "warn",
"noConstEnum": "warn",
"noMisrefactoredShorthandAssign": "warn",
"noCatchAssign": "warn",
"noSelfCompare": "warn",
"noGlobalAssign": "warn",
"noPrototypeBuiltins": "warn",
"noClassAssign": "warn",
"noDuplicateCase": "warn",
"noApproximativeNumericConstant": "warn",
"noDebugger": "warn",
"noGlobalIsFinite": "warn",
"noDuplicateTestHooks": "warn",
"noMisleadingInstantiator": "warn",
"noRedundantUseStrict": "warn",
"noThenProperty": "warn",
"noDuplicateClassMembers": "warn",
"noSuspiciousSemicolonInJsx": "warn",
"noUnsafeNegation": "warn",
"noSparseArray": "warn",
"noDuplicateJsxProps": "warn",
"noExportsInTest": "warn"
}
}
}
} Complete but broken versionThis one is generated based on the ones already there on biomejs website. However, the server would complain that the json is misconfigured - some unknown keywords 🤷♀️ {
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"formatter": { "enabled": false },
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"accessibility": {
"useMediaCaption": "warn",
"noAutofocus": "warn",
"noRedundantAlt": "warn",
"noLabelWithoutControl": "warn",
"useHtmlLang": "warn",
"useAriaActivedescendantWithTabindex": "warn",
"noAriaHiddenOnFocusable": "warn",
"useIframeTitle": "warn",
"noAccessKey": "warn",
"noDistractingElements": "warn",
"noRedundantRoles": "warn",
"noNoninteractiveElementToInteractiveRole": "warn",
"useAriaPropsForRole": "warn",
"useGenericFontNames": "warn",
"useFocusableInteractive": "warn",
"noBlankTarget": "warn",
"useValidAnchor": "warn",
"noHeaderScope": "warn",
"useValidLang": "warn",
"useKeyWithMouseEvents": "warn",
"noNoninteractiveTabindex": "warn",
"useAltText": "warn",
"noSvgWithoutTitle": "warn",
"useHeadingContent": "warn",
"noPositiveTabindex": "warn",
"useAnchorContent": "warn",
"useValidAriaRole": "warn",
"useValidAriaValues": "warn",
"useSemanticElements": "warn",
"useButtonType": "warn",
"useValidAriaProps": "warn",
"useKeyWithClickEvents": "warn",
"noAriaUnsupportedElements": "warn",
"noInteractiveElementToNoninteractiveRole": "warn"
},
"complexity": {
"noUselessSwitchCase": "warn",
"noUselessFragments": "warn",
"noThisInStatic": "warn",
"noUselessUndefinedInitialization": "warn",
"useSimpleNumberKeys": "warn",
"noUselessCatch": "warn",
"noEmptyTypeParameters": "warn",
"noUselessThisAlias": "warn",
"noVoid": "warn",
"noUselessConstructor": "warn",
"noUselessLoneBlockStatements": "warn",
"useFlatMap": "warn",
"noExcessiveCognitiveComplexity": "warn",
"useRegexLiterals": "warn",
"useDateNow": "warn",
"noStaticOnlyClass": "warn",
"useOptionalChain": "warn",
"noUselessEmptyExport": "warn",
"noExtraBooleanCast": "warn",
"noUselessTypeConstraint": "warn",
"noForEach": "warn",
"noBannedTypes": "warn",
"noMultipleSpacesInRegularExpressionLiterals": "warn",
"noWith": "warn",
"useLiteralKeys": "warn",
"noUselessTernary": "warn",
"noUselessRename": "warn",
"noUselessStringConcat": "warn",
"useSimplifiedLogicExpression": "warn",
"useArrowFunction": "warn",
"noExcessiveNestedTestSuites": "warn",
"noUselessLabel": "warn"
},
"correctness": {
"noUnreachable": "warn",
"noInvalidBuiltinInstantiation": "warn",
"noUnknownMediaFeatureName": "warn",
"noNodejsModules": "warn",
"noUnknownUnit": "warn",
"noSetterReturn": "warn",
"useImportExtensions": "warn",
"noInvalidPositionAtImportRule": "warn",
"useYield": "warn",
"noSwitchDeclarations": "warn",
"noUnknownFunction": "warn",
"noUnusedLabels": "warn",
"noUnusedPrivateClassMembers": "warn",
"noUnsafeFinally": "warn",
"noChildrenProp": "warn",
"noInvalidNewBuiltin": "warn",
"useIsNan": "warn",
"noEmptyPattern": "warn",
"noInvalidConstructorSuper": "warn",
"noInvalidDirectionInLinearGradient": "warn",
"noRenderReturnValue": "warn",
"noUnknownProperty": "warn",
"noUnusedFunctionParameters": "warn",
"noInvalidGridAreas": "warn",
"noSelfAssign": "warn",
"useArrayLiterals": "warn",
"noConstAssign": "warn",
"noFlatMapIdentity": "warn",
"noStringCaseMismatch": "warn",
"noUnusedImports": "warn",
"noUndeclaredVariables": "warn",
"noPrecisionLoss": "warn",
"noGlobalObjectCalls": "warn",
"noUnreachableSuper": "warn",
"noConstructorReturn": "warn",
"noNonoctalDecimalEscape": "warn",
"useJsxKeyInIterable": "warn",
"noEmptyCharacterClassInRegex": "warn",
"noInnerDeclarations": "warn",
"noConstantCondition": "warn",
"noVoidElementsWithChildren": "warn",
"noUnsafeOptionalChaining": "warn",
"useExhaustiveDependencies": "warn",
"useValidForDirection": "warn",
"noUndeclaredDependencies": "warn",
"noInvalidUseBeforeDeclaration": "warn",
"noUnnecessaryContinue": "warn",
"useHookAtTopLevel": "warn",
"noVoidTypeReturn": "warn",
"noUnmatchableAnbSelector": "warn",
"noUnusedVariables": "warn",
"noNewSymbol": "warn",
"noConstantMathMinMaxClamp": "warn"
},
"nursery": {
"useValidAutocomplete": "warn",
"useAdjacentOverloadSignatures": "warn",
"useDeprecatedReason": "warn",
"noUnknownPseudoClass": "warn",
"useStrictMode": "warn",
"noUselessEscapeInRegex": "warn",
"useConsistentCurlyBraces": "warn",
"noDuplicatedFields": "warn",
"noUnknownPseudoElement": "warn",
"noExportedImports": "warn",
"useSortedClasses": "warn",
"noIrregularWhitespace": "warn",
"noValueAtRule": "warn",
"noRestrictedImports": "warn",
"noProcessEnv": "warn",
"noSecrets": "warn",
"useConsistentMemberAccessibility": "warn",
"useTrimStartEnd": "warn",
"noCommonJs": "warn",
"useAriaPropsSupportedByRole": "warn",
"noDynamicNamespaceImportAccess": "warn",
"noDuplicateCustomProperties": "warn",
"noStaticElementInteractions": "warn",
"noRestrictedTypes": "warn",
"noDuplicateElseIf": "warn",
"noEnum": "warn",
"useImportRestrictions": "warn",
"noSubstr": "warn"
},
"performance": {
"noBarrelFile": "warn",
"useTopLevelRegex": "warn",
"noDelete": "warn",
"noAccumulatingSpread": "warn",
"noReExportAll": "warn"
},
"security": {
"noDangerouslySetInnerHtmlWithChildren": "warn",
"noGlobalEval": "warn",
"noDangerouslySetInnerHtml": "warn"
},
"style": {
"useSelfClosingElements": "warn",
"noRestrictedGlobals": "warn",
"useConsistentBuiltinInstantiation": "warn",
"noCommaOperator": "warn",
"noInferrableTypes": "warn",
"noNamespaceImport": "warn",
"useExplicitLengthCheck": "warn",
"useFilenamingConvention": "warn",
"useConst": "warn",
"useShorthandFunctionType": "warn",
"noArguments": "warn",
"useDefaultParameterLast": "warn",
"useFragmentSyntax": "warn",
"noUnusedTemplateLiteral": "warn",
"useExponentiationOperator": "warn",
"useEnumInitializers": "warn",
"useAsConstAssertion": "warn",
"useNamingConvention": "warn",
"noDoneCallback": "warn",
"useNodejsImportProtocol": "warn",
"useThrowNewError": "warn",
"noNamespace": "warn",
"noShoutyConstants": "warn",
"useNumberNamespace": "warn",
"noNonNullAssertion": "warn",
"useForOf": "warn",
"useBlockStatements": "warn",
"noYodaExpression": "warn",
"useCollapsedElseIf": "warn",
"useDefaultSwitchClause": "warn",
"useShorthandAssign": "warn",
"useWhile": "warn",
"useLiteralEnumMembers": "warn",
"useShorthandArrayType": "warn",
"noUselessElse": "warn",
"noImplicitBoolean": "warn",
"useNodeAssertStrict": "warn",
"useThrowOnlyError": "warn",
"useSingleVarDeclarator": "warn",
"useSingleCaseStatement": "warn",
"noParameterAssign": "warn",
"noParameterProperties": "warn",
"useNumericLiterals": "warn",
"useExportType": "warn",
"useImportType": "warn",
"noVar": "warn",
"useConsistentArrayType": "warn",
"useTemplate": "warn",
"noNegationElse": "warn",
"noDefaultExport": "warn"
},
"suspicious": {
"noAsyncPromiseExecutor": "warn",
"noLabelVar": "warn",
"noDuplicateAtImportRules": "warn",
"noDuplicateObjectKeys": "warn",
"noUnsafeDeclarationMerging": "warn",
"noConsole": "warn",
"noDoubleEquals": "warn",
"noDuplicateParameters": "warn",
"noFocusedTests": "warn",
"noFunctionAssign": "warn",
"noGlobalIsNan": "warn",
"noSkippedTests": "warn",
"noConfusingVoidType": "warn",
"useAwait": "warn",
"useDefaultSwitchClauseLast": "warn",
"useIsArray": "warn",
"noDuplicateSelectorsKeyframeBlock": "warn",
"noConsoleLog": "warn",
"noImplicitAnyLet": "warn",
"noEmptyInterface": "warn",
"noExplicitAny": "warn",
"noAssignInExpressions": "warn",
"noMisplacedAssertion": "warn",
"useGetterReturn": "warn",
"useValidTypeof": "warn",
"useNamespaceKeyword": "warn",
"useErrorMessage": "warn",
"noControlCharactersInRegex": "warn",
"noMisleadingCharacterClass": "warn",
"useNumberToFixedDigitsArgument": "warn",
"noImportAssign": "warn",
"noExtraNonNullAssertion": "warn",
"noImportantInKeyframe": "warn",
"noCommentText": "warn",
"noFallthroughSwitchClause": "warn",
"noShadowRestrictedNames": "warn",
"noArrayIndexKey": "warn",
"noRedeclare": "warn",
"noConfusingLabels": "warn",
"noCompareNegZero": "warn",
"noConstEnum": "warn",
"noMisrefactoredShorthandAssign": "warn",
"noCatchAssign": "warn",
"noSelfCompare": "warn",
"noEmptyBlockStatements": "warn",
"noGlobalAssign": "warn",
"noPrototypeBuiltins": "warn",
"noClassAssign": "warn",
"noDuplicateCase": "warn",
"noApproximativeNumericConstant": "warn",
"noDebugger": "warn",
"noGlobalIsFinite": "warn",
"noDuplicateTestHooks": "warn",
"noMisleadingInstantiator": "warn",
"noEvolvingTypes": "warn",
"noRedundantUseStrict": "warn",
"noThenProperty": "warn",
"noDuplicateClassMembers": "warn",
"noEmptyBlock": "warn",
"noReactSpecificProps": "warn",
"noSuspiciousSemicolonInJsx": "warn",
"noUnsafeNegation": "warn",
"noDuplicateFontNames": "warn",
"noSparseArray": "warn",
"noDuplicateJsxProps": "warn",
"noExportsInTest": "warn",
"noShorthandPropertyOverrides": "warn"
}
}
}
}
How?Use the following python code to generate the list yourselves - it needs beautiful soup 4 as a dependency: from bs4 import BeautifulSoup
import requests as rq
request = rq.get("https://biomejs.dev/linter/rules/")
page = BeautifulSoup(request.content)
def rules_set(name: str):
rules = page.find(id=name).parent.find_next_sibling("table")
return set([item.text for item in rules.find_all("td")][::3])
rule_groups = ["accessibility", "complexity", "correctness", "nursery", "performance", "security", "style", "suspicious"]
recommended_rules = page.find(id="recommended-rules").parent.find_next_sibling("ul")
recommended_rules_set = set(item.text for item in recommended_rules)
recommended_rules_dict = {r: {s: "warn" for s in rules_set(r) if s in recommended_rules_set} for r in rule_groups}
# Only recommended rules
import json
print(json.dumps(recommended_rules_dict, indent=2))
## If you want to see all the rules
everything = {r: {s: "warn" for s in rules_set(r)} for r in rule_groups}
print(json.dumps(everything, indent=2)) |
Beta Was this translation helpful? Give feedback.
-
big +1! I'd like to configure these stylistic rules as warnings so that they appear as friendly yellow squigglies I know I can ignore during development and can defer fixing until commit time. I end up wasting time fixing stylistic issues during development instead of building something functional because my legitimate program-breaking bugs are mixed up with red stylistic errors. I forbid warnings in my codebase at commit time and that's the only time I care about style. |
Beta Was this translation helpful? Give feedback.
-
It would be great if we could set the linter to treat everything as warning. I can set all my rules to "warn" instead "error". But this is not possible with
recommended
rules. Otherwise I have to declare every recommended rule again, which makes no sense.Why only warn?
Don't waste time thinking or discussing about if it should be an error or a warning, focus on enabling of disabling a rule.
Warnings look different in editors, this allows you to quickly see that some tweaking is required, but your code still runs (eslint rules generally don't block the code from executing and fatal errors are still reported as error). Often you play with code for debugging etc. Prototyping etc. Blocked by linter is annyoing. Only warn which should be fixed convention.
Later on Git hook and/or CI pipelines we use
--error-on-warnings
(eslint:--max-warnings=0
) because we don't want linter warnings remain. I think this is a good way how to use a linter. The developer is not blocked during coding, but forced to fix the warning before commit.https://www.npmjs.com/package/eslint-plugin-only-warn
Implementation:
biome.json
Beta Was this translation helpful? Give feedback.
All reactions