Skip to content

[Feature]: no-annotation lint rule #25694

@Hotell

Description

@Hotell

Library

React Components / v9 (@fluentui/react-components)

Describe the feature that you would like added

To be able to automate api-access modifiers restrictions we need to create new lint rule.

Previous attempts

We tried to use api-extraction api stripping on Type Level which doesn't work how we want and adds non trivial processing during build time and not very good DX.

Implementation proposal

  • should be configurable to accommodate any kind of JSDoc tag ( in RFC we agreed on @internal , @stable , @unstable for now ).
  • should check any node types except IMPORT*

Rule configuration

{
  "overrides": [
    {
      "files": "**/src/index.{ts,tsx,js}",
      "@fluentui/eslint-plugin/no-annotation": [
        "error",
        {
          "annotations": [
            {
              "tag": "internal"
            }
          ]
        }
      ]
    }
  ]
}

Rule Usage Example

❌ Incorect

// @filename  utils.ts

/**
* @internal
*/
export const notPublicGreeting = 'hello';


// @filename  index.ts

/** @internal **/
export function notPublic(){ }

export {notPublicGreeting} from './utils'

✅ Correct

// @filename  utils.ts

/**
* @internal
*/
export const notPublicGreeting = 'hello';

export function whoAmI(){ return notPublicGreeting }

export function greet(){}


// @filename  index.ts

export { whoAmI } from './utils';
export { greet } from './utils';

Have you discussed this feature with our team

core team

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions