microsoft / fluentui

Fluent UI web represents a collection of utilities, React components, and web components for building web applications.
https://react.fluentui.dev
Other
18.52k stars 2.73k forks source link

[Feature]: no-annotation lint rule #25694

Open Hotell opened 1 year ago

Hotell commented 1 year ago

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

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

msft-fluent-ui-bot commented 1 year ago

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 1 year ago

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

microsoft-github-policy-service[bot] commented 8 months ago

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.