Skip to content

Bug: [no-deprecated] doesn't work on export/re-export statements #11197

Open
microsoft/fluentui
#34443
@Hotell

Description

@Hotell

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Issue Description

no-deprecate won't process re-exports and ignores them completely.

Our barrel file contains re-exports from sub-packages, which some are deprecated and thus need to be disabled inline ( e.g. https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-components/src/index.ts#L106 )

Recently we migrated from https://github.com/gund/eslint-plugin-deprecation to official no-deprecate rule, but it appears the feature parity is not 100%.

Example 1:

All following APIs contain @deprecated pragma but nothing is being reported

// @filename react-components/src/index.ts

export {
  InfoButton,
  infoButtonClassNames,
  renderInfoButton_unstable,
  useInfoButtonStyles_unstable,
  useInfoButton_unstable,
} from '@fluentui/react-infobutton';
export type { InfoButtonProps, InfoButtonSlots, InfoButtonState } from '@fluentui/react-infobutton';
showcase of re-exported apis containing @deprecated jsdoc pragma

Example 2:

Wrong report for implicit inline no-deprecate

/Users/fluentui/packages/react-components/react-components/src/index.ts
  106:3   warning  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-deprecated')
  111:3   warning  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-deprecated')
  118:3   warning  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-deprecated')
  137:3   warning  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-deprecated')
  140:3   warning  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-deprecated')
  244:3   warning  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-deprecated')
  377:3   warning  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-deprecated')
  565:3   warning  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-deprecated')
  581:3   warning  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-deprecated')
  633:34  warning  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-deprecated')

Reproduction Repository Link

https://github.com/microsoft/fluentui

Repro Steps

  1. clone the repo
  2. yarn install
  3. yarn nx run react-components:lint

NOTE: we use ESLINT_USE_FLAT_CONFIG=false under the hood

Versions

package version
@typescript-eslint/eslint-plugin 8.32.0
@typescript-eslint/parser 8.32.0
@typescript-eslint/scope-manager 8.32.0
@typescript-eslint/typescript-estree 8.32.0
@typescript-eslint/type-utils 8.32.0
@typescript-eslint/utils 8.32.0
TypeScript 5.3.3
ESLint 9.17.0
node 20

Related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions