monorepo: [bug] Unexpected end of JSON input when using `plugin-json`
Problem
Hi,
I can’t have the extension to work. Neither tootip nor commands are working.
I have this error:
My config:
Expected behavior
It should find the command and the extension should work
Reproduction
Install the extension inlang
inlang.config.js file
/**
* @type { import("@inlang/core/config").DefineConfig }
*/
export async function defineConfig(env) {
const { default: jsonPlugin } = await env.$import('https://cdn.jsdelivr.net/npm/@inlang/plugin-json@3/dist/index.js');
const { default: standardLintRules } = await env.$import('https://cdn.jsdelivr.net/npm/@inlang/plugin-standard-lint-rules@3/dist/index.js');
return {
referenceLanguage: 'en',
plugins: [
jsonPlugin({ pathPattern: 'client/locales/{language}.json' }),
standardLintRules(),
],
};
}
npx @inlang/cli config validate file
npx @inlang/cli config validate
ERROR (node:24388) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time 13:36:15
(Use `node --trace-warnings ...` to show where the warning was created)
files 13:36:16
files 13:36:16
files 13:36:16
files 13:36:16
ERROR The inlang.config.js is invalid. 13:36:16
# The following errors occurred during the setup of plugins:
None ✅
# The following errors occurred during the validation of the config:
Unexpected end of JSON input
---
If plugins return errors, chances are high that the plugin errors are the root cause
for the config errors. Try to fix the plugin errors first.
# The following errors occurred during the setup of plugins:
None ✅
# The following errors occurred during the validation of the config:
Unexpected end of JSON input
---
If plugins return errors, chances are high that the plugin errors are the root cause
for the config errors. Try to fix the plugin errors first.
at setupConfig (/xxxx/node_modules/@inlang/cli/dist/main.js:68914:11)
at async getConfig (/xxxx/node_modules/@inlang/cli/dist/main.js:69029:19)
at async Command2.validateCommandAction (/xxxx/node_modules/@inlang/cli/dist/main.js:70686:37)
Other information
Windows 11
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 21 (13 by maintainers)
Just for ypour information it was an issue I created some months ago here: https://github.com/inlang/inlang/issues/878
@NiklasBuchfink can you run this repo https://github.com/dalton5/proofError on your windows machine and try to reproduce the bug?
@dalton5 I recommend starting with the
npx @inlang/cli@latest config validatecommand. If that returns an error there should be either a setup problem betweeninlang.config.jsand your recourse files or a bug in the plugin.While this is not solved, you don’t need to look in the ide-extension.
Could you provide us with your folder structure? I’m especially interested in the nesting of your resource files.
en.json
@dalton5 It seems to me that your json file can’t be parsed correctly. Can you share your json? Or the structure of it?