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

Bug: sharable configs not loaded through CLI #15697

Closed
1 task
fedeci opened this issue Mar 12, 2022 · 3 comments
Closed
1 task

Bug: sharable configs not loaded through CLI #15697

fedeci opened this issue Mar 12, 2022 · 3 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion works as intended The behavior described in this issue is working correctly
Projects

Comments

@fedeci
Copy link

fedeci commented Mar 12, 2022

Environment

Node version: v16.13.1
npm version: v8.4.1
Local ESLint version: v8.11.0 (Currently used)
Global ESLint version: Not found
Operating System: darwin 21.2.0

What parser are you using?

@typescript-eslint/parser

What did you do?

Run:
npm i @fig/eslint-config-autocomplete
npx eslint -c @fig/autocomplete --fix ..

What did you expect to happen?

I expect to correctly load the sharable config using the --config (-c) flag from the CLI.

What actually happened?

Error: Cannot read config file: /Users/federico/Documents/withfig.nosync/autocomplete/@fig/autocomplete
Error: ENOENT: no such file or directory, open '/Users/federico/Documents/withfig.nosync/autocomplete/@fig/autocomplete'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at readFile (/Users/federico/Documents/withfig.nosync/autocomplete/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2476:35)
    at loadLegacyConfigFile (/Users/federico/Documents/withfig.nosync/autocomplete/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2541:60)
    at loadConfigFile (/Users/federico/Documents/withfig.nosync/autocomplete/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2656:20)
    at ConfigArrayFactory._loadConfigData (/Users/federico/Documents/withfig.nosync/autocomplete/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2947:42)
    at ConfigArrayFactory.loadFile (/Users/federico/Documents/withfig.nosync/autocomplete/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2813:40)
    at createCLIConfigArray (/Users/federico/Documents/withfig.nosync/autocomplete/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3621:35)
    at new CascadingConfigArrayFactory (/Users/federico/Documents/withfig.nosync/autocomplete/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3697:29)
    at new CLIEngine (/Users/federico/Documents/withfig.nosync/autocomplete/node_modules/eslint/lib/cli-engine/cli-engine.js:607:36)

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

Also npx eslint -c "@fig/autocomplete" --fix . and npx eslint -c @fig/eslint-config-autocomplete --fix . don't work.

@fedeci fedeci added bug ESLint is working incorrectly repro:needed labels Mar 12, 2022
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Mar 12, 2022
@mdjermanovic mdjermanovic moved this from Needs Triage to Triaging in Triage Mar 12, 2022
@mdjermanovic mdjermanovic added works as intended The behavior described in this issue is working correctly and removed bug ESLint is working incorrectly repro:needed labels Mar 12, 2022
@mdjermanovic
Copy link
Member

mdjermanovic commented Mar 12, 2022

Hi @fedeci, thanks for the issue!

This works as intended, the -c option expects a file path to a configuration file. This option isn't designed to support package names and config specifiers.

Shareable configs are designed to work with the extends feature of configuration files. You can make an eslint config file in your project and add shareable configs to extends:

//---------- .eslintrc.js -------------

module.exports = {
    extends: ["@fig/eslint-config-autocomplete"]
};

Since this is not a bug, and there's already an open issue with a request to support loading shareable configs from the command line, I'm closing this issue as a duplicate of #14574.

Triage automation moved this from Triaging to Complete Mar 12, 2022
@fedeci
Copy link
Author

fedeci commented Mar 13, 2022

Thanks for the prompt response @mdjermanovic! Is there any proposal to add back the possibility to specify an extends from the CLI?

@mdjermanovic
Copy link
Member

Is there any proposal to add back the possibility to specify an extends from the CLI?

I think not, and we wouldn't be able to accept that proposal because the current eslintrc config system is frozen as we are working on the new flat config system (#13481), which doesn't have the extends concept. We can only evaluate loading shareable configs from CLI in the context of the new config system (#14574).

@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Sep 9, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Sep 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion works as intended The behavior described in this issue is working correctly
Projects
Archived in project
Triage
Complete
Development

No branches or pull requests

2 participants