Repository: biomejs/biome (language: rust)

Issue:
💅 Private class properties (#) cause errors when using accessibility explicit
### Environment information

```bash
CLI:
  Version:                      1.9.3
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           "v21.6.2"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "yarn/1.22.21"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Linter:
  JavaScript enabled:           true
  JSON enabled:                 true
  CSS enabled:                  true
  GraphQL enabled:              false
  Recommended:                  false
  All:                          true
  Enabled rules:
  suspicious/noCatchAssign
  complexity/useLiteralKeys
  complexity/noMultipleSpacesInRegularExpressionLiterals
  suspicious/useNamespaceKeyword
  complexity/noUselessEmptyExport
  nursery/useConsistentMemberAccessibility
  suspicious/noAssignInExpressions
  suspicious/noDuplicateSelectorsKeyframeBlock
  suspicious/noDuplicateParameters
  correctness/noConstructorReturn
  style/useSelfClosingElements
  suspicious/noMisplacedAssertion
  style/useTemplate
  correctness/noUnusedLabels
  correctness/noUnreachableSuper
  suspicious/noCompareNegZero
  a11y/noAutofocus
  correctness/noUnsafeOptionalChaining
  correctness/noConstAssign
  suspicious/noControlCharactersInRegex
  style/noVar
  suspicious/noDoubleEquals
  suspicious/noEmptyInterface
  suspicious/noConstEnum
  nursery/noDuplicateElseIf
  correctness/noPrecisionLoss
  correctness/noSetterReturn
  correctness/noInvalidConstructorSuper
  suspicious/noImplicitAnyLet
  a11y/useKeyWithClickEvents
  suspicious/noDuplicateObjectKeys
  suspicious/noUnsafeDeclarationMerging
  correctness/noInnerDeclarations
  correctness/useArrayLiterals
  style/noUselessElse
  correctness/noInvalidDirectionInLinearGradient
  nursery/noMissingVarFunction
  suspicious/noImportantInKeyframe
  complexity/noUselessLabel
  complexity/noUselessCatch
  a11y/useAriaPropsForRole
  style/useCollapsedElseIf
  nursery/noOctalEscape
  correctness/noNonoctalDecimalEscape
  suspicious/noDuplicateTestHooks
  style/noDoneCallback
  complexity/noStaticOnlyClass
  complexity/noUselessUndefinedInitialization
  nursery/noNestedTernary
  a11y/noInteractiveElementToNoninteractiveRole
  correctness/noNodejsModules
  correctness/noUnnecessaryContinue
  suspicious/noApproximativeNumericConstant
  suspicious/noLabelVar
  nursery/noDuplicateCustomProperties
  correctness/noUnknownUnit
  correctness/noEmptyCharacterClassInRegex
  correctness/useImportExtensions
  suspicious/noSparseArray
  a11y/useIframeTitle
  nursery/noExportedImports
  a11y/noSvgWithoutTitle
  correctness/noVoidElementsWithChildren
  correctness/useJsxKeyInIterable
  style/useExportType
  complexity/noUselessLoneBlockStatements
  style/noArguments
  a11y/useValidAriaValues
  suspicious/noGlobalAssign
  suspicious/noCommentText
  suspicious/noThenProperty
  suspicious/useGetterReturn
  style/useFragmentSyntax
  a11y/noPositiveTabindex
  style/useNamingConvention
  correctness/noRenderReturnValue
  correctness/useExhaustiveDependencies
  nursery/noSecrets
  security/noGlobalEval
  a11y/noRedundantRoles
  correctness/noUnusedVariables
  style/noYodaExpression
  suspicious/noSelfCompare
  suspicious/noAsyncPromiseExecutor
  nursery/noDescendingSpecificity
  nursery/noIrregularWhitespace
  security/noDangerouslySetInnerHtml
  style/useNodejsImportProtocol
  suspicious/noArrayIndexKey
  complexity/noWith
  suspicious/noDuplicateClassMembers
  complexity/noExtraBooleanCast
  performance/noAccumulatingSpread
  suspicious/noConfusingLabels
  correctness/noChildrenProp
  correctness/noUnknownFunction
  correctness/noInvalidPositionAtImportRule
  style/noShoutyConstants
  a11y/noAriaUnsupportedElements
  nursery/noCommonJs
  correctness/noFlatMapIdentity
  a11y/noBlankTarget
  a11y/useHeadingContent
  nursery/noDynamicNamespaceImportAccess
  correctness/useValidForDirection
  correctness/noInvalidUseBeforeDeclaration
  a11y/noAriaHiddenOnFocusable
  a11y/useGenericFontNames
  style/useBlockStatements
  correctness/noInvalidNewBuiltin
  style/noNegationElse
  complexity/useSimplifiedLogicExpression
  correctness/noUnusedFunctionParameters
  nursery/useSortedClasses
  style/noNamespaceImport
  style/noRestrictedGlobals
  correctness/noUndeclaredVariables
  nursery/noStaticElementInteractions
  nursery/useAriaPropsSupportedByRole
  nursery/useAdjacentOverloadSignatures
  style/noUnusedTemplateLiteral
  style/useExponentiationOperator
  suspicious/useAwait
  style/noNamespace
  suspicious/noDuplicateAtImportRules
  complexity/noUselessFragments
  performance/useTopLevelRegex
  complexity/noUselessStringConcat
  correctness/noUnusedImports
  suspicious/noEmptyBlock
  suspicious/noFunctionAssign
  performance/noDelete
  suspicious/noUnsafeNegation
  a11y/useValidLang
  suspicious/useValidTypeof
  a11y/useValidAriaRole
  correctness/noConstantCondition
  a11y/useAriaActivedescendantWithTabindex
  style/useExplicitLengthCheck
  style/useDefaultParameterLast
  complexity/noEmptyTypeParameters
  nursery/useComponentExportOnlyModules
  correctness/noUnknownProperty
  nursery/useTrimStartEnd
  complexity/noUselessTernary
  suspicious/noExplicitAny
  correctness/noSwitchDeclarations
  complexity/noUselessTypeConstraint
  suspicious/noRedundantUseStrict
  style/useLiteralEnumMembers
  suspicious/noGlobalIsNan
  suspicious/noSkippedTests
  suspicious/noMisleadingCharacterClass
  a11y/noLabelWithoutControl
  style/useDefaultSwitchClause
  correctness/noStringCaseMismatch
  suspicious/noRedeclare
  suspicious/noFallthroughSwitchClause
  complexity/noUselessThisAlias
  correctness/noUnreachable
  complexity/noThisInStatic
  complexity/useOptionalChain
  suspicious/noDuplicateCase
  style/noParameterAssign
  a11y/useValidAnchor
  complexity/useRegexLiterals
  correctness/noSelfAssign
  correctness/noInvalidBuiltinInstantiation
  nursery/noProcessEnv
  style/useShorthandFunctionType
  style/useSingleCaseStatement
  style/useThrowNewError
  suspicious/noEmptyBlockStatements
  suspicious/noShadowRestrictedNames
  a11y/useMediaCaption
  correctness/noUnsafeFinally
  style/useNodeAssertStrict
  style/useEnumInitializers
  a11y/useHtmlLang
  correctness/noUndeclaredDependencies
  suspicious/noEvolvingTypes
  style/useWhile
  suspicious/noConsole
  complexity/useArrowFunction
  style/noInferrableTypes
  a11y/noNoninteractiveTabindex
  complexity/useSimpleNumberKeys
  correctness/useYield
  style/useNumericLiterals
  suspicious/noImportAssign
  suspicious/useDefaultSwitchClauseLast
  correctness/noGlobalObjectCalls
  style/noParameterProperties
  a11y/useAltText
  performance/noBarrelFile
  suspicious/noSuspiciousSemicolonInJsx
  complexity/noBannedTypes
  suspicious/noPrototypeBuiltins
  style/useThrowOnlyError
  style/useAsConstAssertion
  suspicious/noDebugger
  suspicious/noMisleadingInstantiator
  complexity/noVoid
  nursery/noUnknownPseudoClass
  a11y/useFocusableInteractive
  correctness/noUnmatchableAnbSelector
  suspicious/noDuplicateJsxProps
  correctness/noEmptyPattern
  complexity/noExcessiveNestedTestSuites
  performance/noReExportAll
  a11y/useKeyWithMouseEvents
  security/noDangerouslySetInnerHtmlWithChildren
  suspicious/noExtraNonNullAssertion
  nursery/noUnknownPseudoElement
  suspicious/noShorthandPropertyOverrides
  style/useConst
  style/noNonNullAssertion
  complexity/useFlatMap
  correctness/useHookAtTopLevel
  correctness/useIsNan
  suspicious/noGlobalIsFinite
  style/useConsistentBuiltinInstantiation
  suspicious/noDuplicateFontNames
  complexity/noExcessiveCognitiveComplexity
  a11y/noDistractingElements
  nursery/useValidAutocomplete
  style/useConsistentArrayType
  style/useForOf
  nursery/useImportRestrictions
  nursery/useStrictMode
  a11y/useValidAriaProps
  a11y/noRedundantAlt
  complexity/useDateNow
  suspicious/noConfusingVoidType
  suspicious/noFocusedTests
  a11y/useButtonType
  a11y/useSemanticElements
  correctness/noInvalidGridAreas
  style/useFilenamingConvention
  style/useShorthandArrayType
  style/useShorthandAssign
  suspicious/useErrorMessage
  correctness/noConstantMathMinMaxClamp
  correctness/noUnusedPrivateClassMembers
  correctness/noVoidTypeReturn
  correctness/noUnknownMediaFeatureName
  nursery/noUselessEscapeInRegex
  a11y/useAnchorContent
  complexity/noUselessRename
  nursery/noSubstr
  style/useNumberNamespace
  complexity/noUselessConstructor
  a11y/noAccessKey
  complexity/noUselessSwitchCase
  style/noDefaultExport
  style/useSingleVarDeclarator
  suspicious/noExportsInTest
  suspicious/useNumberToFixedDigitsArgument
  a11y/noNoninteractiveElementToInteractiveRole
  nursery/noTemplateCurlyInString
  style/noCommaOperator
  suspicious/useIsArray
  nursery/useConsistentCurlyBraces
  correctness/noNewSymbol
  a11y/noHeaderScope
  suspicious/noMisrefactoredShorthandAssign
  complexity/noForEach
  suspicious/noClassAssign
  style/useImportType

Workspace:
  Open Documents:               0

Done in 0.32s.
```


### Rule name

useConsistentMemberAccessibility

### Playground link

https://biomejs.dev/playground/?indentStyle=space&quoteStyle=single&jsxQuoteStyle=single&lintRules=all&code=YwBsAGEAcwBzACAAQQBiAGMAIAB7AAoAIAAgAC8ALwAgACIATQBpAHMAcwBpAG4AZwAgAGEAYwBjAGUAcwBzAGkAYgBpAGwAaQB0AHkAIABtAG8AZABpAGYAaQBlAHIAIABvAG4AIAB0AGgAaQBzACAAbQBlAG0AYgBlAHIALgAiAAoAIAAgACMAcAByAGkAdgBhAHQAZQBfAHYAYQByAGkAYQBiAGwAZQA6ACAAcwB0AHIAaQBuAGcAOwAKAH0ACgAKAG4AZQB3ACAAQQBiAGMAKAApADsA

### Expected result

Either `#` should be recognized as equivalent to `private` or there should be a way to skip the requirement for members with the `#` prefix.

This configuration can be used to trigger the issue.
```
{
  "linter": {
    "rules": {
      "nursery": {
        "useConsistentMemberAccessibility": {
          "level": "error",
          "options": {
              "accessibility": "explicit"
          }
        }
      }
    }
  }
}
```

### Code of Conduct

- [X] I agree to follow Biome's Code of Conduct


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bad7a4598a66..1fca254d9dc9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -156,6 +156,8 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
 
   Contributed by @Conaclos
 
+- [useConsistentMemberAccessibility](https://biomejs.dev/linter/rules/use-consistent-member-accessibility/) now ignore private class members such as `#property` ([#4276](https://github.com/biomejs/biome/issues/4276)). Contributed by @Conaclos
+
 - [noUnknownFunction](https://biomejs.dev/linter/rules/no-unknown-function/) correctly handles `calc-size` function ([#4212](https://github.com/biomejs/biome/issues/4212)).
 
  The following code `calc-size` is no longer reported as unknown:
diff --git a/crates/biome_js_analyze/src/lint/nursery/use_consistent_member_accessibility.rs b/crates/biome_js_analyze/src/lint/nursery/use_consistent_member_accessibility.rs
index 5df90b9537a2..8945dd5dcc1c 100644
--- a/crates/biome_js_analyze/src/lint/nursery/use_consistent_member_accessibility.rs
+++ b/crates/biome_js_analyze/src/lint/nursery/use_consistent_member_accessibility.rs
@@ -4,10 +4,10 @@ use biome_analyze::{
 use biome_console::markup;
 use biome_deserialize_macros::Deserializable;
 use biome_js_syntax::{
-    JsConstructorClassMember, JsGetterClassMember, JsMethodClassMember, JsPropertyClassMember,
-    JsSetterClassMember, TsAccessibilityModifier, TsConstructorSignatureClassMember,
-    TsGetterSignatureClassMember, TsMethodSignatureClassMember, TsPropertyParameter,
-    TsPropertySignatureClassMember, TsSetterSignatureClassMember,
+    AnyJsClassMemberName, JsConstructorClassMember, JsGetterClassMember, JsMethodClassMember,
+    JsPropertyClassMember, JsSetterClassMember, TsAccessibilityModifier,
+    TsConstructorSignatureClassMember, TsGetterSignatureClassMember, TsMethodSignatureClassMember,
+    TsPropertyParameter, TsPropertySignatureClassMember, TsSetterSignatureClassMember,
 };
 use biome_rowan::{declare_node_union, AstNode, TextRange};
 use serde::{Deserialize, Serialize};
@@ -246,6 +246,10 @@ impl Rule for UseConsistentMemberAccessibility {
 
     fn run(ctx: &RuleContext<Self>) -> Self::Signals {
         let node = ctx.query();
+        // Ignore private class members such as `#property`
+        if node.has_private_class_member_name() {
+            return None;
+        }
         let accessibility = node.accessibility_modifier();
         let options = ctx.options();
         match &options.accessibility {
@@ -304,6 +308,25 @@ declare_node_union! {
 }
 
 impl AnyJsMemberWithAccessibility {
+    fn has_private_class_member_name(&self) -> bool {
+        let name = match self {
+            Self::JsConstructorClassMember(_)
+            | Self::TsConstructorSignatureClassMember(_)
+            | Self::TsPropertyParameter(_) => {
+                return false;
+            }
+            Self::JsPropertyClassMember(member) => member.name(),
+            Self::JsMethodClassMember(member) => member.name(),
+            Self::JsGetterClassMember(member) => member.name(),
+            Self::JsSetterClassMember(member) => member.name(),
+            Self::TsMethodSignatureClassMember(member) => member.name(),
+            Self::TsPropertySignatureClassMember(member) => member.name(),
+            Self::TsGetterSignatureClassMember(member) => member.name(),
+            Self::TsSetterSignatureClassMember(member) => member.name(),
+        };
+        matches!(name, Ok(AnyJsClassMemberName::JsPrivateClassMemberName(_)))
+    }
+
     fn accessibility_modifier(&self) -> Option<TsAccessibilityModifier> {
         match self {
             Self::JsConstructorClassMember(member) => member


Test patch:
diff --git a/crates/biome_js_analyze/tests/specs/nursery/useConsistentMemberAccessibility/validExplicit.ts.snap b/crates/biome_js_analyze/tests/specs/nursery/useConsistentMemberAccessibility/validExplicit.ts.snap
index dbf3eae37529..08695aa25988 100644
--- a/crates/biome_js_analyze/tests/specs/nursery/useConsistentMemberAccessibility/validExplicit.ts.snap
+++ b/crates/biome_js_analyze/tests/specs/nursery/useConsistentMemberAccessibility/validExplicit.ts.snap
@@ -52,37 +52,3 @@ class ValidExplicit9 {
 }
 
 ```
-
-# Diagnostics
-```
-validExplicit.ts:44:3 lint/nursery/useConsistentMemberAccessibility ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
-
-  ! Missing accessibility modifier on this member.
-  
-    43 │ class ValidExplicit9 {
-  > 44 │   #foo = 1;
-       │   ^^^^^^^^^
-    45 │   #bar() {}
-    46 │ }
-  
-  i Use public to explicitly make a member public.
-  
-
-```
-
-```
-validExplicit.ts:45:3 lint/nursery/useConsistentMemberAccessibility ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
-
-  ! Missing accessibility modifier on this member.
-  
-    43 │ class ValidExplicit9 {
-    44 │   #foo = 1;
-  > 45 │   #bar() {}
-       │   ^^^^^^^^^
-    46 │ }
-    47 │ 
-  
-  i Use public to explicitly make a member public.
-  
-
-```