Eslint encountered an issue while parsing: Unable to access tsconfig.json

My directory structure looks like this:

-projects
  --MyProject
    ---MyDir
      tsconfig.json
      eslinttrc.json

Inside my eslinttrc.json file, I have the following configuration:

  "parserOptions": {
        "ecmaVersion": "latest",
        "project": ["tsconfig.json"],
        "sourceType": "module"
    }

Even though there is a tsconfig.json in the same directory, ESLint is giving me an error saying "cannot read project\tsconfig.json" because it is searching from the wrong root directory 'projects' instead of 'MyDir'. To resolve this, I need to update the parseOption path to './MyDir/tsconfig.json' rather than just 'tsconfig.json'.

Answer №1

If you haven't already found a solution, consider including the following line in your code:

project: path.join(__dirname, "tsconfig.eslint.json")

Adding this snippet to your .eslintrc.js file could resolve the issue. Check out this Github thread for more details.

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

Navigating JSON data in a POST request using C# in .NET Core version 3.1

Previously, in my .Net Core 2.1 project, I had implemented a method to handle JSON data successfully as shown below: [HttpPost] [Route("sendJsonData")] public JObject saveTemplate(JObject jsonString) { string templateName = (string)jsonString.Sel ...

When parameters are added to one route, all other routes cease to function properly

After I added a parameter to one of the routes, all the other routes stopped rendering correctly (i.e., router-view is not working at all). The route /download/:id works as expected. Am I missing something in the setup? I tried leaving and removing the /do ...

Issue Encountered in AWS CloudFormation Template When Configuring EC2 Instance types

I am encountering an issue while attempting to activate the Spot Instance option in my CloudFormation template, which I then upload into AWS Service Catalog. The error pertains to my MarketType parameter, specifically within the InstanceMarketOptions Para ...

Sending complicated JSON objects through AJAX to a MVC2 controller

Although this question has appeared in a similar form before, I am currently facing a dilemma.... I am encountering the common issue of passing a complex JSON type to MVC2. The problem lies in the fact that, as shown in the code below, while I am able to s ...

Different approach for searching and modifying nested arrays within objects

Here is an example of the object I am working with: { userId: 111, notes: [ { name: 'Collection1', categories: [ { name: 'Category1', notes: [ {data: 'This is the first note& ...

The return type in Typescript for dynamically generated return values

If I have a function in Typescript 2.0 like this: doSomething(): any { const apple: Apple = ... const pears: Pear[] = ... return { apple: apple, pears: pears } } I am aware that the function will always produce an object ...

svg-to-json.js | The mysterious disappearing act of my file

After completing the installation process for svg-to-json.js as detailed in my previous post, I ran the command: node svg-to-json.js filename.txt The expectation was that a .json file would be generated, but I couldn't locate it. Is it supposed to ...

Troubleshooting Issues with Deserialization in ServiceStack's JsonServiceClient

I have been working on integrating the Expedia API and navigating my way through ServiceStack, which has been relatively smooth so far. However, I have encountered an issue with deserializing a JSON response from the API that is failing even though JsConfi ...

There is no overload that fits the current call | Typescript, React, and Material UI

Embarking on my TypeScript journey with React and Material UI, I am hitting a roadblock with my initial component. // material import { Box } from '@material-ui/core'; // ---------------------------------------------------------------------- ...

Convert a segment of XML into JSON using PHP

Currently, I am working on parsing an XML document using PHP. Everything is going smoothly except for one issue. Here's a snippet of the XML: <properties> <property> <propertyid>1</propertyid> <flags> < ...

Using Javascript to save content to a text file across multiple lines

I am working on a coding project that involves extracting data from a JSON file via a URL and parsing the JSON content. The script successfully filters out the necessary data, but now I want to write this data to a text file with each piece of information ...

Unable to iterate through elements in JSON data using PHP

I received the following JSON data via AJAX to test.php: [{},{"product[]":"john","qty[]":"12","price[]":"100","total[]":"1200"},{"product[]":"juan","qty[]":"22","price[]":"3.5","total[]":"77"},{"product[]":"louis","qty[]":"99","price[]":"1.22","total[]":" ...

What is the best method to merge two arrays into a single array of objects?

Is it possible to utilize an ngFor directive instead of duplicating the <table> element twice? (Note: I considered consolidating all items into objects within a single array for mapping purposes (each object containing a variable, label, and value) ...

Issue with absolute import in React TypeScript application

An error occurs when trying to import a module, displaying the following message: Compiled with problems: × ERROR in ./src/App.tsx 5:0-33 Module not found: Error: Can't resolve 'routes' in 'F:\Tamrinat\Porfolio\microsite ...

Stop fullscreen mode in Angular after initiating in fullscreen mode

Issue with exiting full screen on Angular when starting Chrome in full-screen mode. HTML: <hello name="{{ name }}"></hello> <a href="https://angular-go-full-screen-f11-key.stackblitz.io" target="_blank" style=& ...

Angular Delight: Jaw-Dropping Animation

After setting up my first Angular project, I wanted to incorporate Angular Animations to bring life to my content as the user scrolls through the page. I aimed to not only have the content appear on scroll but also implement a staggering animation effect. ...

Utilizing an Angular Service within the main.ts script

My main.ts file currently has the following code snippet: declare const require; const translations = require("raw-loader!./locale/messages.de.xlf"); platformBrowserDynamic().bootstrapModule(AppModule, { providers: [ { provide: TRANSLATIONS, useVa ...

The JSX element 'Provider<AnyAction>' does not match a valid instance type. The render() function should return compatible types

https://i.sstatic.net/MBHo5.pngMy current provider error just started happening out of nowhere, even though everything was working fine yesterday. Any suggestions on how to troubleshoot and fix this issue? ReactDOM.render( <React.StrictMode> ...

Error: Unable to retrieve the child value from Newtonsoft.Json.Linq.JProperty in C#

Hello, I could use some assistance with extracting IDs from a JSON file. However, I keep encountering an exception error that says: Cannot access child value on Newtonsoft.Json.Linq.JProperty. private void button1_Click(object sender, EventArgs e ...

What is causing the Password Verification code to malfunction when used with a jquery form wizard?

I have implemented a jquery form wizard for my multi-page form. You can view an example of the form structure by visiting . Currently, the form utilizes a jquery validation plugin. However, I noticed that the jquery.validation.js file lacks validation rul ...