Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Pass internal config paths in FileEnumerator default (fixes #13789) #13792

Merged
merged 2 commits into from Oct 27, 2020

Commits on Oct 26, 2020

  1. Chore: Repro FileEnumerator exception with default args (refs #13789)

    When `CLIEngine` instantiates `FileEnumerator`, it explicitly passes its
    own `CascadingConfigArrayFactory` instance, which now includes values
    for `builtInRules`, `loadRules`, `eslintRecommendedPath`, and
    `eslintAllPath`. This is the only place that ESLint core instantiates
    `FileEnumerator`, so core does not rely on the constructor's default
    value for `configArrayFactory`.
    
    After `CascadingConfigArrayFactory` was extracted into
    `@eslint/eslintrc`, it no longer assumed values for
    `eslintRecommendedPath` and `eslintAllPath`, which `CLIEngine` now
    provides. If those values are not passed, as is the case with the
    default `CascadingConfigArrayFactory` for `configArrayFactory`, file
    enumeration will encounter the exception that was reported in #13789.
    
    From the perspective of ESLint core, the default value for
    `configArrayFactory` is dead code. However, even though `FileEnumerator`
    is an undocumented API, it's called by `eslint-plugin-import`'s
    `no-unused-modules` rule, which hits the exception reproduced by this
    test.
    btmills committed Oct 26, 2020
    Copy the full SHA
    3147de3 View commit details
    Browse the repository at this point in the history
  2. Fix: Pass internal config paths in FileEnumerator default (fixes #13789)

    When `CLIEngine` instantiates `FileEnumerator`, it explicitly passes its
    own `CascadingConfigArrayFactory` instance, which now includes values
    for `builtInRules`, `loadRules`, `eslintRecommendedPath`, and
    `eslintAllPath`. This is the only place that ESLint core instantiates
    `FileEnumerator`, so core does not rely on the constructor's default
    value for `configArrayFactory`.
    
    After `CascadingConfigArrayFactory` was extracted into
    `@eslint/eslintrc`, it no longer assumed values for
    `eslintRecommendedPath` and `eslintAllPath`, which `CLIEngine` now
    provides. If those values are not passed, as is the case with the
    default `CascadingConfigArrayFactory` for `configArrayFactory`, file
    enumeration will encounter the exception that was reported in #13789.
    
    From the perspective of ESLint core, the default value for
    `configArrayFactory` is dead code. However, even though `FileEnumerator`
    is an undocumented API, it's called by `eslint-plugin-import`'s
    `no-unused-modules` rule, which hits the exception reproduced by this
    test.
    btmills committed Oct 26, 2020
    Copy the full SHA
    c9599b9 View commit details
    Browse the repository at this point in the history