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

feat(config): show more clear error message when config is not found #1606

Merged
merged 1 commit into from
Apr 27, 2023

Conversation

thekip
Copy link
Collaborator

@thekip thekip commented Apr 19, 2023

Description

Discord conversation: https://discord.com/channels/974702239358783608/1088763465960787998/1089890861992661012

Currently, when lingui could not discover a config it just shows No locales defined, which is pretty confusing.
This PR brings "Config not found" error message.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Fixes # (issue)

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Apr 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
js-lingui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2023 8:39am

Comment on lines +23 to +44
const moduleName = "lingui"

const configExplorer = cosmiconfigSync(moduleName, {
searchPlaces: [
`${moduleName}.config.js`,
`${moduleName}.config.cjs`,
`${moduleName}.config.ts`,
`${moduleName}.config.mjs`,
"package.json",
`.${moduleName}rc`,
`.${moduleName}rc.json`,
`.${moduleName}rc.yaml`,
`.${moduleName}rc.yml`,
`.${moduleName}rc.ts`,
`.${moduleName}rc.js`,
],
loaders: {
".js": JitiLoader(),
".ts": JitiLoader(),
".mjs": JitiLoader(),
},
})
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i read in the cosmiconfig docs that hey have a cache on the configExplorer instacne. Pulling creating this explorer out of the getConfig function should help to leverage this cache.

@github-actions
Copy link

github-actions bot commented Apr 19, 2023

size-limit report 📦

Path Size
./packages/core/dist/index.mjs 1.44 KB (0%)
./packages/detect-locale/dist/index.mjs 721 B (0%)
./packages/react/dist/index.mjs 1.6 KB (0%)
./packages/remote-loader/dist/index.mjs 7.24 KB (0%)

@thekip

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.04 🎉

Comparison is base (dd40e7c) 75.40% compared to head (a4c98ad) 75.45%.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1606      +/-   ##
==========================================
+ Coverage   75.40%   75.45%   +0.04%     
==========================================
  Files          77       77              
  Lines        1988     1992       +4     
  Branches      519      520       +1     
==========================================
+ Hits         1499     1503       +4     
  Misses        375      375              
  Partials      114      114              
Impacted Files Coverage Δ
packages/conf/src/getConfig.ts 89.47% <100.00%> (+2.80%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@andrii-bodnar andrii-bodnar changed the base branch from next to main April 26, 2023 10:03
@andrii-bodnar andrii-bodnar merged commit d84bb8c into lingui:main Apr 27, 2023
16 checks passed
@thekip thekip deleted the no-config-error branch April 27, 2023 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants