Questions tagged [eslint]

The pluggable linting utility for JavaScript and related frameworks.

eslint
Filter by
Sorted by
Tagged with
0 votes
0 answers
24 views

angular.json : configuration for multiple library projects

My Angular application is composed of one 'Application' project and 20+ 'library' project. These libraries are consumed inside my main application. Everything is working fine. I am using eslint ...
Nutan Gwari's user avatar
0 votes
1 answer
89 views

eslint-plugin-react rule react/no-unknown-property false negatives on all props for threejs

after installing the threeJS I kept having the eslint-plugin-react rule react/no-unknown-property false negatives on all props for threeJS while trying to pass props.. See error here I tried ...
Samuel Peters's user avatar
0 votes
0 answers
48 views

eslint-plugin-react-hooks : Unclear Installation

The npm webpage for eslint-plugin-react-hooks, or the github page, says, under "installation", Note: If you're using Create React App, please use react-scripts >= 3 instead of adding it ...
emrys57's user avatar
  • 6,716
-2 votes
0 answers
32 views

Eslint issue on Yarn Install

I am trying to run a project which requires 20.9.0. After installing the required node from NVM. Installation of yarn is giving the following error. npm install yarn npm ERR! code ERESOLVE npm ERR! ...
Gourav's user avatar
  • 9
0 votes
0 answers
16 views

eslint-disable does not work on lines with importing JSON files

I've tried eslint-disable-line eslint-disable-next-line eslint-disable - None seem to work when trying to ignore lines that import a JSON file (either with assert or with) /* eslint-disable-next-line *...
Aviran's user avatar
  • 5,270
0 votes
0 answers
38 views

Is there a way to enforce Nx module boundaries at compile time?

My app is using Nx Module Boundaries, the issue is that it is only enforced during linting. Running at compile time would be preferred. Only idea so far: Add lint commands to all of custom package....
Christopher Peralta's user avatar
3 votes
4 answers
77 views

Why does TypeScript assume that the document object is always available?

I have the following line of code in a function: if (!document) return; For some reason, I am getting the following ESLint error from the official TypeScript rules: Unnecessary conditional, value is ...
Magnus's user avatar
  • 7,247
2 votes
1 answer
399 views

failed to load builtin eslint_d for method diagnostics

I encountered this problem after watching typecrafts Neovim series on Youtube. I tried with AI but it didn't work. I tried adding both eslint_d and eslint-lsp and received the same error the following ...
pydi's user avatar
  • 21
0 votes
1 answer
34 views

@typescript-eslint/no-shadow complains about shadowing variable that is just being declared

@typescript-eslint/no-shadow complains about shadowing a variable that is just being declared, while I think it should only bicker about variables that have already been declared: I set '@typescript-...
Florian Lentsch's user avatar
0 votes
0 answers
20 views

Linting `import.meta.env` expressions in svelte+vite app

I have a primitive svelte app, which is built with Vite. I'm using Vite's way to access env vars, like this: <div class="app"> {import.meta.env.VITE_WHATEVER} </div> I works ...
jeron-diovis's user avatar
0 votes
1 answer
33 views

Eslint disable all rules for one line

I have integrated eslint in my JS project, and I get one error for class attributes. For example, in this case: class RateLimit { delay = 2 * 1000; ... } I am getting "Parsing error: ...
Lilit Mazmanyan's user avatar
1 vote
1 answer
37 views

How to show all files errors in react app with eslint by one line code in scripts in package.json?

I want it to show all errors for all files in react/next app in command line with eslint when i write (for example) "npm run errors" or "npm run lint". I tried searching for eslint ...
Ali Shariatian's user avatar
0 votes
1 answer
31 views

Getting a linting error of no-var-requires

I am getting the error below on running the eslint. \helpers\getEnvCredentials.ts 4:9 error Require statement not part of import statement @typescript-eslint/no-var-requires ✖ 1 problem (1 error, ...
simpleMan's user avatar
0 votes
1 answer
11 views

ESlint throws an error with my code here but I can't understand the problem

After completing a few programming courses I have decided to make my own application. However, I have hit a brick wall and don't understand how to get around it. As you can see I have created a fake ...
Kbessell's user avatar
-1 votes
1 answer
257 views

Enabling the recommendedTypeChecked config causes the linter to lint its config file and error out

How do I enable the recommendedTypeChecked config in typescript-eslint? The config below works for recommended, but when I uncomment ...tseslint.configs.recommendedTypeChecked, I get the error below ...
Hoppe's user avatar
  • 6,643
1 vote
1 answer
26 views

Mixed JS and TS - Eslint no longer throwing error for js and jsx files

I have my .eslintrc.js as such: module.exports = { root: true, parser: "@babel/eslint-parser", parserOptions: { requireConfigFile: false, babelOptions: { presets: ["@...
Owenn's user avatar
  • 1,000
0 votes
1 answer
18 views

I want to check the type of array with spread operator in eslint

.eslintrc.js extends: [ 'airbnb', 'airbnb/hooks', 'plugin:@next/next/recommended', 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-...
Take's user avatar
  • 33
1 vote
1 answer
31 views

ESLint to remove unnecessary braces on React properties?

Is there any way to get ESLint to automatically flag/fix properties in JSX which have an unnecessary curly brace? <HStack mt={"xl"} ... /> ...would become... <HStack mt="xl&...
ThisRestlessPilgrim's user avatar
0 votes
2 answers
22 views

Angular typed controls No seeing types

I am working updating some legacy forms to be more strongly typed and thus fix eslint errors. I keep running into issues where the .value operator on abstract controls throws an IDE error "...
Dylan's user avatar
  • 1
0 votes
0 answers
75 views

Issue: Replace `··` with `↹`eslintprettier/prettier

I'm getting an error: Replace ·· with ↹eslintprettier/prettier, but only in some cases, like here: export const getTotalHabitableArea = ( checklist: FormattedChecklistType, isFullChecklist: ...
Andrik Dizhak's user avatar
6 votes
1 answer
2k views

Issue with none-ls configuration error with eslint_d

I'm configuring neovim with none-ls and when I'm trying to add eslint_d to the setup I have this error : [null-ls] failed to load builtin eslint_d for method diagnostics; please check your config Here ...
Guillaume Marc's user avatar
1 vote
0 answers
19 views

`eslint-env` failed to prevent `no-undef` to raise errors on `console`, `window` or `process`, `export`

title says it all. My project is a simple Node.js server, so it includes both Node.js and Browser environment. Add Globals to eslint.config.js might cause underreporting. But /* eslint-env browser */ ...
user avatar
0 votes
1 answer
46 views

ESLint complains that 'HeadersInit' is not defined, when according to TypeScript, it clearly is

I'm trying to use the HeadersInit type in my react/typescript project. My problem is that ESLint thinks the type is undefined: But as you see, typescript clearly knows what HeadersInit is. When I ...
Seth Lutske's user avatar
0 votes
1 answer
33 views

What is the good way to lint SharedWorker code using eslint inside Vue application that runs on Vite

I have a standard Vue 3/Vite application scaffolded using npm create vue I am using eslint in the project and I want to add a SharedWorker to my app. I have created worker.js file inside the project, ...
Alexandra Urushadze's user avatar
0 votes
0 answers
26 views

Eslint rule for space after asterisks in comment line

I have a problem that the eslint doesn't validate my comment correctly. Below is the case: /** *FieldName for react-hook-form. */ I want to set a rule so if I don't have a space after an asterisk(*)...
Anton's user avatar
  • 11
1 vote
1 answer
148 views

Next.js server actions - eslint errors

Getting eslint errors writing a simple server component with server action: // /app/search/page.tsx export default function Search() { async function updateResults(formData: FormData) { "...
user19448827's user avatar
2 votes
1 answer
25 views

How to find lint rule that move '>' starting new lines to previous lines in html?

I am having trouble formulating a question for Google, but I can illustrate my issue with an example: This is the code fragment from my Vue component <span v-if="item.editable">...
Daniel's user avatar
  • 8,277
0 votes
1 answer
21 views

Eslint ignoring my rule settings "no-unused-vars"

Still getting this rule reported as an error when I run eslint. This is after I have set no-unused-vars and @typescript-eslint/no-unused-vars to warning in .eslintrc file. I have tried both "no-...
user3146945's user avatar
0 votes
0 answers
25 views

ESLint config to spot when two imports from different locations import the same name

I've been using ESLint for years but this is the first time I've encountered this problem. We had a merge issue where two import statements were kept in the same file that were importing from ...
eldoctoro's user avatar
  • 893
0 votes
0 answers
16 views

Initialize NestJS project with TypeScript without ESLint

I am using the below command for initializing a NestJS project with TypeScript: nest new <project-name> The issue here is, that an ESlint is also applied in the project with this command. Is it ...
Yeasin Abedin's user avatar
2 votes
2 answers
72 views

Prettier replaces single quote character with &quot; when used inside double quotes | Angular .html files

I have applied angular-eslint in my angular package. I have also added prettier configurations. The prettier is changing the single quotation mark to &quote; symbol. How can I fix that The code ...
Maria Ali's user avatar
0 votes
0 answers
38 views

New eslint config file not catching errors in real-time

I am converting my eslintrc.json to the new eslint.config.js file. When I run npx eslint src it works fine, however no errors are being caught in real-time. For example, if I require semicolons, lines ...
Samuel Patterson's user avatar
0 votes
1 answer
95 views

How can I get rid of the red underlines on warnings in VSCode?

This is a new issue that I have been dealing with on my personal computer at home. This issue has started, I think, when I first started using React. This makes me wonder if it has something to do ...
Brandyn Coverdill's user avatar
1 vote
1 answer
68 views

Can I reproduce eslint's "prefer-object-spread" rule using ast-grep?

I am trying to compare different linters and their performance with custom rules. Ast-grep is promising, and likely runs much faster than eslint, as it is written in Rust instead of javascript. ...
Steven Love's user avatar
2 votes
1 answer
233 views

typescript-eslint "SyntaxError: Cannot use import statement outside a module"

I try settup eslint with typescript-eslint. My config from docs: import eslint from '@eslint/js'; import tseslint from 'typescript-eslint'; export default tseslint.config( eslint.configs....
Timofey Goncharov's user avatar
-1 votes
1 answer
81 views

"@typescript-eslint/no-useless-template-literals" vs "prefer-template" conflict in ESLint

Logger.logInfo({ //... description: `${ this.TARGET_SOURCE_FILES_TYPE__SINGULAR_FORM__CAPITALIZED } file has been added.\n` + `${ targetFileOrDirectoryAbsolutePath }` }); I have ...
Takeshi Tokugawa YD's user avatar
0 votes
1 answer
41 views

Ignore a literal file graphql string deprecated fields warning with eslint-disable

I was trying to ignore a literal file graphql string deprecated fields warning with eslint-disable with a comment but it's complaining that // is not recognize. Tried #, """ but none of ...
changey's user avatar
  • 19.1k
0 votes
0 answers
9 views

TypeScript unable to recognize filenames by using @ to indicate

tsconfig.json { "compilerOptions": { "target": "ES2020", "useDefineForClassFields": true, "lib": ["ES2020", "DOM", &...
Programmer's user avatar
0 votes
0 answers
18 views

I want to find 'import/Export' mistake in eslint

#File ./A.ts const a = 1; const b = 3; export {a} #File ./B.ts import {a} from './A' const B = ()=> { const result = a + b; <== this line error 'b not export ' } I want to find eslint or ...
pan's user avatar
  • 1
1 vote
0 answers
24 views

Eslint Parsing problem in sfra salesforce project

I have problem related to eslint . I configured my eslintrc.json file ( folder level ) . add some rules there and everything is working fine ( if file doesn't has any problem ) ( I will mention this ...
Beka Lobzhanidze's user avatar
0 votes
0 answers
32 views

Linting errors for unused/undefined variables in React

I'm writing some React code and noticed from my tutorial videos that their unused variables have the red squiggly lines under unused/undefined variables. For me the unused/undefined variables are ...
Sing's user avatar
  • 1
2 votes
1 answer
74 views

How to avoid React useEffect first render with ESLINT react-hooks/exhaustive-deps

I have a useEffect that I want to avoid the first run. So I did a hook to check if it's the first render: useFirstRender import { useRef, useEffect } from 'react'; export function useFirstRender() { ...
Arthur's user avatar
  • 5,008
-1 votes
1 answer
62 views

eslint error for using a specific function

I have a function in my react application which I want to move away from. I want to show eslint error when a developer calls/uses that function. Is there a way for that. For now I have used @...
codenoob's user avatar
0 votes
0 answers
76 views

I have an issue with React Hook called inside a callback

This is my current code export default function InteractableAreasList(): JSX.Element { useTownController(); const activeConversationAreas = useActiveConversationAreas(); return ( <Box>...
Yunkai Wang's user avatar
0 votes
0 answers
6 views

How to combine eslint 'git-ignore style patterns'

I want to use https://eslint.org/docs/latest/rules/no-restricted-imports to match specific imports. It should match **/selectors and should not match **.selectors. The docs say it uses 'git-ignore ...
Mike's user avatar
  • 899
1 vote
0 answers
121 views

ESLint: Failed to load plugin 'jsx-a11y' declared in '.eslintrc » eslint-config-next/core-web-vitals

When I upgraded to Next 14.1.0 from 13.3.1 I started getting a warning from yarn next build saying ESLint: Failed to load plugin 'jsx-a11y' declared in '.eslintrc. This is the beginning of my eslintrc ...
thegreenedition's user avatar
0 votes
1 answer
94 views

How to prevent VSCode prettier and eslint clashing with projects configuration

I can't find setting how to disable eslint errors and auto formatting for type assertions as per below example. I use as keyword right after object I am returning from arrow function, but eslint shows ...
Andyally's user avatar
  • 985
0 votes
1 answer
33 views

Force relative import with full filename

On my TypeScript project to import ./foo/index.ts I can use any of these 4 lines: import Foo from './foo' // ❌ import Foo from './foo/index' // ❌ import Foo from './foo/index.js' // ❌ ...
Yukulélé's user avatar
  • 16.5k
1 vote
0 answers
61 views

Eslint plugin import rule to detect missing properties in module.exports

I have the following files: // abc.js module.exports = { def: 7, ghi: 8, } // export const def = 7 // export const ghi = 8 and // importing.js import { xyz } from './abc.js' My IDE (Webstorm) ...
v-moe's user avatar
  • 1,323
0 votes
2 answers
37 views

What's the difference between ReadonlyArray and "readonly arr: T[]"?

See this playground. interface Feature { readonly name: string; } // <Test> // This is OK interface Foo1 { readonly arr: ReadonlyArray<Feature>; } function save1(foo: Foo1) { ...
azizj's user avatar
  • 3,587