Typescript raises a error notification regarding the absence of a semicolon when importing a JSON module

Attempting to import a local JSON object into my Vuex store using

const tree = import('@/articles/tree.json');
. The setting "resolveJsonModule": true, has been enabled in my tsconfig.json and it loads successfully, however NPM is flooding the output with warnings like:

WARNING in /home/benjamin/dev/learn-wgpu2/src/articles/tree.json(1,8654):
1:8654 Missing semicolon

It appears that Webpack is treating the JSON file as if it were TypeScript. How can this behavior be stopped?

Here's the specific json file.

{"path":"src/articles/","name":"articles","display":"","type":"folder","children":[{"path":"src/articles//about.md","name":"about.md","display":"/about.md","type":"file"},{"path":"src/articles//beginner","name":"beginner","display":"/beginner","type":"folder","children":[...]}]}

This data is being used to update my tutorial/blog on sotrh.github.io/learn-wgpu.

Answer №1

If you want to avoid linting all json files in your project, make sure to add the following code snippet to your tslint.json:

{
  "linterOptions": {
    "exclude": [
      "*.json",
      "**/*.json"
    ]
  }
}

For additional details, you can check out this GitHub issue.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Combining arrays of objects based on a common key

Issue at Hand: Having multiple arrays of objects with the same key and wanting to merge them using jq. Here is an example to illustrate the problem: Original Data [ { "google.com": { "http": { "dest_url": "http://stackoverflow.com" ...

Retrieving information from a table row and using it as a parameter in the URL for an AJAX request

New to implementing ajax, JQuery, and Json in my strut2 web application. I have a table on one web page with records displayed, and the last column contains an image as shown below. Currently using an anchor tag with an image for the last column with an ac ...

When working with Typescript and React, you may encounter an issue where an element implicitly has an 'any' type because the type 'State' has no index signature. This can lead to

In my current mini project, I am using Typescript and React. As someone new to Typescript, I am currently in the process of learning it. Within the project, I have a state defined as follows: type State = { field1: string, field2: string, field3: n ...

A step-by-step guide on making a list item clickable and redirecting to a URL using Vue.js

Utilizing vue.js, I have successfully configured a navigation bar with multiple list elements. However, I am seeking guidance on how to redirect one of the list elements to an external website, such as https://www.google.com/. Within my router file, each e ...

Upon completion of a promise in an express middleware and breaking out of a loop, a 404 error is returned

In my efforts to retrieve an array of object (car) from express using database functions in conjunction with the stolenCarDb object, everything seems to be working fine. However, when attempting the following code snippet, it results in a 404 error w ...

Creating a Higher Order Component (HOC) for your Next.js page

Upon running the following code, I encountered an error message Error: The default export is not a React Component in page: "/" pages/index.tsx import React, { useState, useRef } from "react"; import type { NextPage } from "next&q ...

Karma encountered an error while trying to resolve the file path for "../../services/service.ts" in the preprocessor.rollup

Currently, I am facing an issue while trying to test a testsuite using CI (Bamboo). The problem arises when deploying the fully functional application from my local system to the Bamboo server (which I do not have configuration access to). The call npm -- ...

VS Code sees JavaScript files as if they were Typescript

I have recently delved into the world of Typescript and have been using it for a few days now. Everything seems to be working smoothly - Emmet, linting, etc. However, I've encountered an issue when trying to open my older JavaScript projects in VS Cod ...

Just a straightforward Minimum Working Example, encountering a TypeScript error TS2322 that states the object is not compatible with the type 'IntrinsicAttributes & Props & { children?: ReactNode; }'

Currently, I am immersed in a project involving React and Typescript. I am grappling with error code TS2322 and attempting to resolve it. Error: Type '{ submissionsArray: SubmissionProps[]; }' is not assignable to type 'IntrinsicAttributes ...

Python and Scrapy encounter issues with locating website links

I've been searching for the URLs of all events listed on this page: https://www.eventshigh.com/delhi/food?src=exp However, I can only locate the URL in JSON format: { "@context":"http://schema.org", "@type":"Event", "name":"DANDIYA NIG ...

Guide on how to conditionally render `<tr>` elements in a table using Vue

Check out my demo sample here: enter link description here I am looking to display data in 3 rows per column, like the following: <tr> <td> <strong class="blue">[{{item.orderId}}]</strong><br> {{item. ...

Having trouble installing npm on Debian? If you're seeing the error message "Unable to correct problems, you have held broken packages

Having a challenge with installing npm on my debian VM: sudo apt-get install -y npm Encountering an error message, seeking solutions. Here's the error log: Reading package lists... Done Building dependency tree Reading state information... Don ...

I need help with querying the date format in Mongoose and MongoDB. The specific date I am trying to query is stored in the field "ticketTimeStartDate" and is in the format: "Mon Oct 18 2021 12:28:59 GMT+0000 (

Can anyone provide guidance on querying this specific date format in moongose and MongoDB? The date field is as follows: "ticketTimeStartDate": "Mon Oct 18 2021 12:28:59 GMT+0000 (Coordinated Universal Time)", ...

I am unable to get console.log to function within my Vue.js script code

I am relatively new to using vue.js, and I'm currently working on a simple application that retrieves data from an API. I'm facing an issue where I can't use console.log within my scripts: <script> import Header from './com ...

How can I integrate keydown.control with a unique click function in Angular?

Is there a way to choose multiple number elements in random order and save them to an array by holding down the control key (CTRL) and clicking on the element? For example, selecting 2 and 4 out of 5. I tried different methods but couldn't figure out ...

Issue with Angular 2 Observable testing: Trying to use setInterval in an async zone test is not allowed

I am currently in the process of testing a component that relies on a service for making asynchronous HTTP calls. The service returns an Observable, which is then subscribed to by the component. Snippet from the service code: getRecentMachineTemperatures ...

When attempting to integrate a custom Plugin into Phonegap 3.0, an error stating "The arguments passed to path.join must be strings" occurred

I have successfully ported an older Twitter plugin to work with PG > 3.0, and it functions properly in my IDE. However, when I try to install it via NPM, I encounter errors. I have double-checked the file system structure and plugin.xml specification for a ...

Error: node-sass setup is unable to locate the installed msvs_version

Attempting to npm install node-sass with the command >> npm install node-sass. Having Visual Studio 2010 on my system (for certain reasons), I have discovered that I require C++ compilers from Visual Studio 2013 or newer. I attempted to install the ...

Tips for sending an array containing objects with an ID using Angular

Can you give me your thoughts on how to post an array with some object? This is the code I am working with: const selectedJobs = this.ms.selectedItems; if (!selectedJobs) { return; } const selectedJobsId = selectedJobs.map((jobsId) => ...

Utilizing Django fixtures: Importing HTML content as JSON into a Text Field

Currently in the process of transitioning my website to Django from another content management system, I am facing challenges with importing HTML into Django using fixtures. The specific issue revolves around "Events", which is a model within my Django app ...