Skip to content

[no-use-before-define] Missing allowNamedExports option from base rule #5324

@scottohara

Description

@scottohara

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

In eslint@8.17.0, the no-use-before-define rule learned a new allowNamedExports option.

The docs for the extension rule indicates additional options that extend the base rule options.

However when setting this option on the extention rule, as follows:

"@typescript-eslint/no-use-before-define": ["error", { "allowNamedExports": false }]

...the following runtime error is thrown:

Oops! Something went wrong! :(

ESLint: 8.19.0

Error: .eslintrc.json:
        Configuration for rule "@typescript-eslint/no-use-before-define" is invalid:
        Value {"allowNamedExports":false} should be equal to one of the allowed values.
        Value {"allowNamedExports":false} should NOT have additional properties.
        Value {"allowNamedExports":false} should match exactly one schema in oneOf.

On inspection, it appears that the extension rule defines all options itself, rather than other extension rules that typically use the getESLintCoreRule() machinery to import & extend the schema of the base rule.

I'm not sure if this was intentional, or an oversight.

Reproduction Repository Link

https://github.com/scottohara/repro-typescript-eslint-no-use-before-define

Repro Steps

  1. clone the repo
  2. yarn install
  3. eslint test.ts

Versions

package version
@typescript-eslint/eslint-plugin 5.30.5
@typescript-eslint/parser 5.30.5
TypeScript 4.7.4
ESLint 8.19.0
node 18.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancement: plugin rule optionNew rule option for an existing eslint-plugin rulegood first issueGood for newcomerspackage: 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