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

Calculate the sum of elements within an array

I've been attempting to calculate the sum of values in an array based on different levels, but so far I haven't had much success. Here are the data I'm working with (stored in a variable called totalByLevel): https://i.stack.imgur.com/rOP9 ...

Obtaining array value in JSON and incorporating it into a datatable

I have the following JSON data: { "aaData": [ [ { "displayValue": "Home Page", "link": "http://somelink.com" }, "London", "1983" ], [ { ...

Trouble decoding JSON strings in PHP

Good evening, I need some help with converting a string from an AJAX call into a PHP array. I've been trying to figure this out for a while now, but no luck so far. The string looks like this: count: "[{\"cartKey\":\"d9d4f495e875a ...

Get information on Splash Screen

My goal is to fetch 3 JSONs from the server when my app's splash screen is displayed, in order to prevent users from waiting and staring at a loading spinner. The current method I am using is as follows: MainActivity.raffle_controller.fetch_curr ...

The npm start command is throwing an error, but running node index.js is

Recently, I embarked on a journey to learn nodejs and eagerly followed a tutorial to create a basic web application. The tutorial stated that I could run the web app using either 'npm start' or 'node index.js'. Surprisingly, when I use ...

Waiting for variable to become false using Angular 7 Observable

The observable below highlights the authentication process: import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { CookieService } from 'ngx-cookie-service'; import { Observabl ...

The Vuetify v-spacer does not seem to be working as intended

When using the <v-dialog> modal, I am attempting to stick one block to the bottom of the <v-col> block by utilizing the <v-spacer> component, but it does not seem to have any effect. What could be causing this issue? You can view an exam ...

Tips for effectively overriding a method in typescript

Why is this.fullName appearing empty in the show() method? class Person { protected name: string = ""; constructor(name: string) { this.makeSir(name); } makeSir(name: string) { this.name = "sir" + name; } } class M ...

What is the process for removing the depcheck/npx tool?

After mistakenly running npx depcheck and accidentally installing it by pressing Y, I now encounter warnings about future deprecations every time I run npm run dev. These warnings primarily originate from upstream codebases that I am not responsible for. S ...

Is it possible to incorporate bootstrap files using EJS and Express without altering the existing file structure?

Recently delving into NodeJS development, I have begun utilizing EJS for incorporating common views and express.static() to serve the public directory's "style.css" file. While I initially used Bootstrap from a CDN, I now find myself in need of custom ...

Is it possible to leverage ES6 modules within a Node.js application while also debugging it using Visual Studio?

Trying to create a basic node.js module test project using ES6 in Visual Studio 2015 has resulted in build errors, preventing me from running or debugging the application. Could it be that I arrived at the party too soon? I attempted opening and building ...

Heroku refreshes my JSON document

My node.js app relies on a basic JSON file as the model. To keep things simple since it's only an MVP with minimal data storage requirements, I opted not to set up and configure a MongoDB database. Instead, I just read from and write to a JSON file lo ...

Is there a way to retrieve the ID following the creation of a MySQL row in Vue and Express?

I have a query regarding retrieving the ID from Sequelize.create. I have a database called Cases where all cases created by users are stored. Additionally, there is a database named CasesImages that stores images related to these cases. Case model: module ...

Using JSON Filtering with React

I am currently working on fetching JSON data and implementing a filtering feature for the displayed content. An error that I am encountering is: Uncaught TypeError: Cannot read property 'toLowerCase' of undefined Any insights on what might be ...

I'm experiencing an issue where posts are duplicated based on the number of comments they have. Any suggestions on how to

Currently, I am working on a project involving lumen and Vuejs. In this project, I have performed a left join operation between my 'likes' and 'comments' tables with my posts table. While the likes data is being retrieved correctly with ...

What is causing the ESLint error when trying to use an async function that returns a Promise?

In my Next.js application, I have defined an async function with Promise return and used it as an event handler for an HTML anchor element. However, when I try to run my code, ESLint throws the following error: "Promise-returning function provided t ...

Dividing an Array of Json DataFrame into various row counts using Scala

Is there a way to split an Array of Json DataFrame into multiple rows using Spark-Scala? Input DataFrame : +----------+-------------+--------------------------------------------------------------------------------------------------------- ...

Learning how to access npm information with Python

Currently, I'm working on a project that involves accessing npm pages and extracting data from them through a process known as 'scraping'. Some people have suggested using REST APIs and similar methods, but I am not very familiar with them a ...

Struggling with TypeScript and JsObservable? Let us assist you!

Having previous experience with JSRender, JSViews, and JSObservables, I recently embarked on a new project using TypeScript. Unfortunately, I am struggling to understand how to properly utilize TypeScript in my project, especially when it comes to referenc ...

React Router Issue: Component Not Rendering When <nav> Element Is Incomplete

I am currently experiencing an issue with rendering a component in my React TypeScript application using React Router. The problem arises when trying to navigate to the AddTask component by clicking on a link within a <nav> element. Strangely, the co ...