microsoft / microsoft/fluentui

[Feature]: no-annotation lint rule

Open
#25,694 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: Build System Area: Linting Fluent UI react-components (v9) Package: eslint-plugin Resolution: Soft Close Type: Feature
Dominant language
TypeScript
Stars
20.3k
Forks
2.9k
Avg merge
2d 9h
Merged PRs (30d)
46

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the @fluentui/eslint-plugin entry point and compare the project’s existing lint-rule structure and tests. Use the proposed annotation configuration, IMPORT* exclusion, and examples as acceptance criteria; done means the rule reports configured JSDoc annotations on exported nodes while allowing the shown correct usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, react, typescript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.