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:

image

My config:

image

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

image

Windows 11

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 21 (13 by maintainers)

Most upvoted comments

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 validate command. If that returns an error there should be either a setup problem between inlang.config.js and 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

{
  "home": "Home",
  "an-error-has-happened-during-the-launch": "An error has happened during the launch",
  "our-villas": "Our lodges",
  "your-journey": "Your journey",
  "local-advices": "Local Advices",
  "gallery": "Gallery",
  "contact": "Contact",
  "booking": "Booking",
  "from": "from",
  "night": "$ / Night",
  "room-facilities": "Room Facilities",
  "services": "Services",
  "we-are": "Services at",
  "citronelles": "Citronnelles",
  "choose-room": "Discover our lodges",
  "hotel-facilities": "Proposed Facilities",
  "latest": "Latest",
  "discover": "Discover",
  "our-gallery": "our Gallery",
  "book-now": "Book Now",
  "french": "French",
  "english": "English",
  "guided-tour": "Guided tour",
  "room-overview": "room overview",
  "select": "Select",
  "rooms": "Rooms",
  "relax-and-choose": "relax and choose",
  "visit": "Visit",
  "guests": "Guests",
  "sqm": "sqm",
  "send-us-message": "Send Us Message",
  "please-enter-your-name": "Please enter your name.",
  "please-enter-your-valid-e-mail-id": "Please enter your valid E-mail.",
  "make-a": "Make a",
  "address": "Address",
  "your-name": "Your Name",
  "your-email": "Your Email",
  "please-enter-your-phone-number": "Please enter your phone number.",
  "your-phone": "Your Phone",
  "please-enter-your-message": "Please enter your message.",
  "your-message": "Your Message",
  "your-message-has-been-sent-successfully": "Your message has been sent successfully.",
  "sorry-error-occured-this-time-sending-your-message": "Sorry, an error occured this time sending your message.",
  "your-message-has-been-sent-successfully-refresh-this-page-if-you-want-to-send-more-messages": "Your message has been sent successfully.",
  "sorry-there-was-an-error-sending-your-form": "Sorry there was an error sending your form.",
  "your-reservation-has-been-sent-successfully": "Your reservation has been sent successfully.",
  "send": "Send"
}

@dalton5 It seems to me that your json file can’t be parsed correctly. Can you share your json? Or the structure of it?