-
-
Notifications
You must be signed in to change notification settings - Fork 885
Closed
Closed
Copy link
Labels
A-LinterArea: linterArea: linterL-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-EnhancementStatus: Improve an existing featureStatus: Improve an existing feature
Description
Environment information
CLI:
Version: 2.0.5
Color support: true
Platform:
CPU Architecture: x86_64
OS: windows
Environment:
BIOME_LOG_PATH: unset
BIOME_LOG_PREFIX_NAME: unset
BIOME_CONFIG_PATH: unset
BIOME_THREADS: unset
NO_COLOR: unset
TERM: xterm-256color
JS_RUNTIME_VERSION: v21.7.3
JS_RUNTIME_NAME: node
NODE_PACKAGE_MANAGER: yarn/4.0.2
Biome Configuration:
Status: Loaded successfully
Path: biome.json
Formatter enabled: true
Linter enabled: true
Assist enabled: true
VCS enabled: true
Linter:
JavaScript enabled: unset
JSON enabled: unset
CSS enabled: unset
GraphQL enabled: unset
Recommended: true
Enabled rules:
complexity/noAdjacentSpacesInRegex
complexity/noArguments
complexity/noBannedTypes
complexity/noCommaOperator
complexity/noEmptyTypeParameters
complexity/noExtraBooleanCast
complexity/noFlatMapIdentity
complexity/noStaticOnlyClass
complexity/noThisInStatic
complexity/noUselessCatch
complexity/noUselessConstructor
complexity/noUselessContinue
complexity/noUselessEmptyExport
complexity/noUselessEscapeInRegex
complexity/noUselessFragments
complexity/noUselessLabel
complexity/noUselessLoneBlockStatements
complexity/noUselessRename
complexity/noUselessStringRaw
complexity/noUselessSwitchCase
complexity/noUselessTernary
complexity/noUselessThisAlias
complexity/noUselessTypeConstraint
complexity/noUselessUndefinedInitialization
complexity/useArrowFunction
complexity/useDateNow
complexity/useFlatMap
complexity/useNumericLiterals
complexity/useOptionalChain
complexity/useRegexLiterals
complexity/useSimpleNumberKeys
correctness/noConstAssign
correctness/noConstantCondition
correctness/noConstantMathMinMaxClamp
correctness/noConstructorReturn
correctness/noEmptyCharacterClassInRegex
correctness/noEmptyPattern
correctness/noGlobalObjectCalls
correctness/noInnerDeclarations
correctness/noInvalidBuiltinInstantiation
correctness/noInvalidConstructorSuper
correctness/noInvalidDirectionInLinearGradient
correctness/noInvalidGridAreas
correctness/noInvalidPositionAtImportRule
correctness/noInvalidUseBeforeDeclaration
correctness/noMissingVarFunction
correctness/noNonoctalDecimalEscape
correctness/noPrecisionLoss
correctness/noSelfAssign
correctness/noSetterReturn
correctness/noStringCaseMismatch
correctness/noSwitchDeclarations
correctness/noUnknownFunction
correctness/noUnknownMediaFeatureName
correctness/noUnknownProperty
correctness/noUnknownPseudoClass
correctness/noUnknownPseudoElement
correctness/noUnknownTypeSelector
correctness/noUnknownUnit
correctness/noUnmatchableAnbSelector
correctness/noUnreachable
correctness/noUnreachableSuper
correctness/noUnsafeFinally
correctness/noUnsafeOptionalChaining
correctness/noUnusedFunctionParameters
correctness/noUnusedImports
correctness/noUnusedLabels
correctness/noUnusedPrivateClassMembers
correctness/noUnusedVariables
correctness/noVoidElementsWithChildren
correctness/noVoidTypeReturn
correctness/useExhaustiveDependencies
correctness/useIsNan
correctness/useValidForDirection
correctness/useValidTypeof
correctness/useYield
performance/noAccumulatingSpread
performance/noDynamicNamespaceImportAccess
security/noBlankTarget
security/noDangerouslySetInnerHtml
security/noDangerouslySetInnerHtmlWithChildren
security/noGlobalEval
style/noDescendingSpecificity
style/useArrayLiterals
style/useConst
style/useDeprecatedReason
style/useExponentiationOperator
style/useExportType
style/useImportType
style/useLiteralEnumMembers
style/useNodejsImportProtocol
style/useShorthandFunctionType
suspicious/noApproximativeNumericConstant
suspicious/noArrayIndexKey
suspicious/noAssignInExpressions
suspicious/noAsyncPromiseExecutor
suspicious/noCatchAssign
suspicious/noClassAssign
suspicious/noCommentText
suspicious/noCompareNegZero
suspicious/noConfusingLabels
suspicious/noConfusingVoidType
suspicious/noConsole
suspicious/noConstEnum
suspicious/noControlCharactersInRegex
suspicious/noDebugger
suspicious/noDocumentCookie
suspicious/noDoubleEquals
suspicious/noDuplicateAtImportRules
suspicious/noDuplicateCase
suspicious/noDuplicateClassMembers
suspicious/noDuplicateCustomProperties
suspicious/noDuplicateElseIf
suspicious/noDuplicateFields
suspicious/noDuplicateFontNames
suspicious/noDuplicateJsxProps
suspicious/noDuplicateObjectKeys
suspicious/noDuplicateParameters
suspicious/noDuplicateProperties
suspicious/noDuplicateSelectorsKeyframeBlock
suspicious/noEmptyBlock
suspicious/noEmptyInterface
suspicious/noExplicitAny
suspicious/noExtraNonNullAssertion
suspicious/noFallthroughSwitchClause
suspicious/noFunctionAssign
suspicious/noGlobalAssign
suspicious/noGlobalIsFinite
suspicious/noGlobalIsNan
suspicious/noImplicitAnyLet
suspicious/noImportAssign
suspicious/noImportantInKeyframe
suspicious/noIrregularWhitespace
suspicious/noLabelVar
suspicious/noMisleadingCharacterClass
suspicious/noMisleadingInstantiator
suspicious/noMisrefactoredShorthandAssign
suspicious/noOctalEscape
suspicious/noPrototypeBuiltins
suspicious/noRedeclare
suspicious/noRedundantUseStrict
suspicious/noSelfCompare
suspicious/noShadowRestrictedNames
suspicious/noShorthandPropertyOverrides
suspicious/noSparseArray
suspicious/noSuspiciousSemicolonInJsx
suspicious/noTemplateCurlyInString
suspicious/noThenProperty
suspicious/noUnsafeDeclarationMerging
suspicious/noUnsafeNegation
suspicious/noWith
suspicious/useAdjacentOverloadSignatures
suspicious/useDefaultSwitchClauseLast
suspicious/useGetterReturn
suspicious/useGoogleFontDisplay
suspicious/useIsArray
suspicious/useNamespaceKeyword
Workspace:
Open Documents: 0Rule name
useNamingConvention
Playground link
Expected result
ESLINT has the types property which Biome lacks, and it is very powerful.
"@typescript-eslint/naming-convention": [
"error",
{
selector: "variable",
modifiers: ["const", "global"],
types: ["boolean", "string", "number", "array"],
format: ["UPPER_CASE"],
},
{
selector: "variable",
modifiers: ["const", "global"],
types: ["function"],
format: ["camelCase", "PascalCase"],
},
{
selector: "variable",
modifiers: ["const"],
format: null,
},
],
I am a React (frontend) developer and below are some scenarios I need linting for my team:
export const foo = 1; // should be CONSTANT_CASE
export const bar = {a:1}; // should be CONSTANT_CASE
export const doStuff = () => {...} // // Valid function const name
// React-specific
export const useWhatever = () => { ... }; // Valid react hook const name ONLY if it starts with the word "use"
export const TestComponent = () => null; // Valid const name
export const Component = withModal(TestComponent); // Valid const name
The current way useNamingConvention is limiting in very common React projects and cannot work to enforce primitive (by type) global constants to be in CONSTANT_CASE, while enforcing other React specific naming conventions.
Code of Conduct
- I agree to follow Biome's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-LinterArea: linterArea: linterL-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-EnhancementStatus: Improve an existing featureStatus: Improve an existing feature