Questions tagged [typescript-eslint]
TypeScript-ESLint is an open-source project which provides tooling to allow TypeScript code to be checked by ESLint. This tag is for questions specific to linting TypeScript code with ESLint; such as lint rule issues, parser issues, problems setting up, or writing your own lint rules.
typescript-eslint
714
questions
0
votes
1
answer
41
views
ESLint is not reading the rules specified in the eslintrc.json in my Angular v17 Project
ESLint is not reading the rules written in the eslintrc.json file. It is displaying all the problems as errors even though I have set values of some rules as warn. Moreover, it is displaying errors ...
0
votes
2
answers
35
views
Media elements such as <audio> and <video> must have a <track> for captions eslint error
When I try to add
<video controls>
<source src="content.mp4" type="video/mp4" />
<source src="content.webm" type="video/webm" />
Your ...
-3
votes
1
answer
46
views
Adding ignores to the typescript-eslint recommended configuration?
I'm trying to add an ignores object to the typescript-eslint configuration
I figured this would do the trick:
import eslint from "@eslint/js";
import tseslint from "typescript-eslint&...
-3
votes
2
answers
49
views
Why 'eslint' + 'typescript-eslint' used for TypeScript linting when 'tsc' appears to work better? [duplicate]
Goal: To create a strict TypeScript linter script
eslint checks for poor JavaScript code patterns.
The docs suggests initialising eslint with npm init @eslint/config@latest
This also installs ...
1
vote
2
answers
60
views
Eslint 9 add a rule to existing configuration
I have a ES9 config that looks like this (eslint.config.js):
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import stylistic from '@...
-1
votes
1
answer
46
views
Catching errors with the lint:eslint script in the lit typescript starter project?
I'm testing the lint:eslint script in the lit element typescript starter project.
I added a property with undefined any like this below the name property:
/**
* The name to say "Hello" ...
-3
votes
1
answer
33
views
@typescript-eslint/strict-boolean-expressions: Union type should be considered with allowOptions
An example.
play.
declare const str: string
if (str) { } good
declare const num: number
if(num) {} // good
declare const u: string | number
if(u) {} // Unexpected value in conditional. A boolean ...
0
votes
0
answers
525
views
Error while installing @typescript-eslint/eslint-plugin
I am getting below error while installing the package @typescript-eslint/eslint-plugin
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ...
0
votes
0
answers
40
views
Do i need the `languageOptions.globals` field in eslint flat config when using typescript-eslint?
Is it necessary to have languageOptions.globals in my eslint flat config when using the type-script-eslint plugin? Doesn't typescript eliminate the need for this field? Or should i keep this in my ...
0
votes
0
answers
30
views
VS Code IntelliSense Loading Indefinitely Across All Projects on macOS Sonoma for TypeScript/NextJs
I'm experiencing an issue with Visual Studio Code where IntelliSense is stuck on "Loading" indefinitely across all my TypeScript/NextJs projects. Whenever I Clicked ^ + space, I only see &...
0
votes
0
answers
23
views
eslint for array access
I have a problem that I think can be boiled down to this code snippet
public a() {
return {a: 0};
}
public b() {
return this.a()[0];
}
A while back the a function returned an array, but got ...
0
votes
0
answers
17
views
union and intersection type multiple line formatting with eslint
I'm using eslint.
// package.json
"eslint": "^9.0.0"
In cases like before, I would like to display an error line or change it to after.
// before
type MyTypes = 'whoami' | 'hello' ...
3
votes
1
answer
637
views
"Unsafe assignment of an error typed value" typescript-eslint error
At the time of asking this question, "Unsafe assignment of an error typed value" returned zero Google results, so it seems worth an SO question.
The error is produced by linting the ...
1
vote
2
answers
70
views
How to use Eslint rule for JSX attribute value
I want to apply eslint rule for JSX attribute value.
like I have a component having some attribute for example
<Component
attribute1="abc-efg"
/>
In above example I want to place a ...
0
votes
0
answers
20
views
TypeScript, ESLint and unused value [duplicate]
Here's my type for a project that uses Google Maps. onMarkerAdd is a callback function, which returns nothing and changes the state, as you can see below.
export type MapProps = {
markers: ...