[Bug] When dts-gen is run, ESLint can't find config file and error
Closed this issue · 5 comments
Summary
Please refer to the Reproduction for error details.
Here is the code in issue.
js-sdk/packages/dts-gen/src/templates/template.ts
Lines 20 to 32 in 3e96baf
https://eslint.org/docs/latest/integrate/nodejs-api#-new-eslintoptions
https://github.com/eslint/eslint/blob/0da3f732fe1776f8f79dac829b2cab4cedd4b6d8/lib/eslint/eslint-helpers.js#L853-L854
Without overrideConfigFile: true
, it seems to try to read eslint.config.js
. I actually added overrideConfigFile: true
and the error went away.
Target Package
@kintone/dts-gen
Target Version
8.1.0
Reproduction
- Install
$ yarn add @kintone/dts-gen
...
info Direct dependencies
└─ @kintone/dts-gen@8.1.0
info All dependencies
└─ @kintone/dts-gen@8.1.0
Done in 3.56s.
- Run
$ direnv exec . yarn kintone-dts-gen --app-id 4 --type-name App顧客リストFields -o common/types/4.d.ts
direnv: loading ~/src/internal-system/kintone/.envrc
yarn run v1.22.22
$ /home/uchida/src/internal-system/kintone/node_modules/.bin/kintone-dts-gen --app-id 4 --type-name App顧客リストFields -o common/types/4.d.ts
Error: Could not find config file.
at assertConfigurationExists (/home/uchida/src/internal-system/kintone/node_modules/@kintone/dts-gen/node_modules/eslint/lib/config/config-loader.js:83:23)
at LegacyConfigLoader.loadConfigArrayForFile (/home/uchida/src/internal-system/kintone/node_modules/@kintone/dts-gen/node_modules/eslint/lib/config/config-loader.js:340:9)
at async ESLint.lintText (/home/uchida/src/internal-system/kintone/node_modules/@kintone/dts-gen/node_modules/eslint/lib/eslint/eslint.js:914:25) {
messageTemplate: 'config-file-missing'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected Behavior
No errors.
Actual Behavior
I get an error Error: Could not find config file.
.
Environment
$ uname -a
Linux uchida-LM-iG440 6.8.0-47-generic #47~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Oct 2 16:16:55 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
$ node -v
v20.17.0
$ yarn -v
1.22.22
This will still reproduce.
$ git clone git@github.com:kintone/js-sdk.git
$ cd js-sdk/packages/dts-gen
js-sdk/packages/dts-gen$ pnpm install
js-sdk/packages/dts-gen$ pnpm build
js-sdk/packages/dts-gen$ rm eslint.config.mjs
js-sdk/packages/dts-gen$ rm ../../eslint.config.mjs
js-sdk/packages/dts-gen$ node dist/index.js --app-id 4 --type-name App顧客リストFields --base-url=http://localhost --username=username --password=password
@tuchida
Thank you!
If you don't mind, could you please make a pull request?
I can fix it, but I don't know how to write a test.
@tuchida
Manual testing is also OK.
Please include the details of the testing and the results in your PR.
Thanks for merged!