7,035 questions
Best practices
0
votes
0
replies
16
views
Next.js ESLint presets not compatible with ESLint 9 + Nx 22 flat-config — what is the correct way to support Next.js linting?
Recently we upgraded to Nx 22 and ESLint 9, which broke a lot of linting across the repo because the old .eslintrc-style configs and Next.js presets aren’t compatible with flat-config.
I spent quite a ...
Advice
1
vote
3
replies
59
views
how to detect key duplicates when spreading multiple source objects
For readability sake, I've slices one big object into multiple smaller:
const ABC_ROUTES = {
main: '/abc',
details: '/abc/:id'
} as const
const XYZ_ROUTES = {
mainAbc: '/xyz',
details: '/xyz/:...
Tooling
0
votes
8
replies
121
views
ESLint exhaustive-deps rule doesn't recognize stable refs when passed to custom hooks
I'm trying to factor out a useCallback that uses refs into a custom hook, but ESLint's exhaustive-deps rule keeps complaining about missing dependencies, even though refs are stable and shouldn't be ...
2
votes
1
answer
182
views
ESLint issue after upgrading to Angular 20 (".eslintignore" no longer supported)
After upgrading my Angular project to version 20, ESLint started throwing the following error when I run linting (using Nx):
[error] (node:20947) ESLintIgnoreWarning: The ".eslintignore" ...
2
votes
0
answers
121
views
eslint, lsp, and setup error in react project
I have a nvim setup that I have created and when I want to open a react/nextjs project it errors on imports like import Image from "next/image"; and no one likes that, so I wanted to ask how ...
1
vote
0
answers
171
views
Eslint language server fails to load in zed code editor
I am getting this error when I try to launch the zed code editor and it shows me failed to load eslint language server, other language server are working alright.
Language server eslint:
initializing ...
-4
votes
1
answer
149
views
ESLint core now provides this functionality via `defineConfig()` (`config` is deprecated)
While run eslint --cache --cache-strategy content . got error:
`config` is deprecated. ESLint core now provides this functionality via `defineConfig()`
Using npx @eslint/migrate-config also give ...
0
votes
1
answer
53
views
ESLint can't resolve electron specific module node:original-fs
I need this module to perform some logic with asar files. Project builds and works fine. VSCode correctly resolves node:original-fs. Only ESLint fails to resolve it:
PS C:\Users\my-project> npm run ...
-3
votes
1
answer
66
views
eslint precommit - block warnings in new lines of code
Is there a way to configure a pre-commit or MR rule that would prevent writing new code with eslint warnings?
We generally treat linter warnings as an antipattern and prefer to have all errors, but ...
0
votes
0
answers
167
views
ESLint 9 with Vue 3 + TypeScript: Parsing error ‘Unexpected token <’
I'm working with Vue3 + Typescript and want to integrate a pipeline with Lint but it's giving me some issues.
I have eslint 9.34.0 and my eslint.config.cjs is in /config but I reference it in my ...
2
votes
1
answer
221
views
How to fix ESLint errors automatically?
In VS Code, when I hover on the yellow underlined warning on if (!clientId) { I see:
Unexpected nullable string value in conditional. Please handle the nullish/empty cases explicitly.eslint@typescript-...
-2
votes
1
answer
233
views
ESLint doesn’t recognize Vitest globals when using a separate tsconfig.test.json with types: ["vitest/globals"]
I’m trying to separate my TypeScript test configs for a Vite + React + Vitest project. The tsconfig.app.json and tsconfig.node.json files were created automatically by Vite; I only added my own ...
0
votes
0
answers
193
views
How to correctly configure eslint-plugin-import in Next.js 15 with TypeScript and path aliases?
I'm working with a Next.js 15 project using TypeScript, and I'm trying to properly configure eslint-plugin-import to work with path aliases (like @/), as well as import sorting and unresolved path ...
2
votes
4
answers
3k
views
Eslint Resolve error: Cannot find native binding
When trying to run eslint on my HP EliteBook 640 G11 (Intel Core Ultra 5 125U) I got this error:
C:\Users\test\Work\eslint-native-binding-test\eslint.config.mjs
1:1 error Resolve error: Cannot ...
0
votes
2
answers
105
views
Vercel build fails with TypeScript error 'params' is a Promise on Next.js 15 Server Component
I am building a website using Next.js 15.3.3, React 19, and Sanity.io for content. Everything works perfectly in my local development environment (next dev).
However, when I deploy to Vercel, the ...
0
votes
1
answer
45
views
Prevent Custom CSS in UI project
Is there a way to prevent devs from adding custom CSS and styling in a React project? The idea is that all of our components are built in-house and we have a stylable component that supports styling ...
3
votes
1
answer
549
views
How to migrate my CRA .eslintrc.js config to eslint.config.js in a new Vite + React 19 app
I'm trying to set up the same ESLint configuration in my new React 19 + Vite app using the modern eslint.config.js format. However, it's not working — the linter doesn’t show any errors or warnings in ...
0
votes
0
answers
313
views
VS Code is stuck in infinite loading
Literally just last Friday, everything was working smoothly - I could navigate to any function, hover over variables and instantly see their types. But on Monday, when I resumed work, it all suddenly ...
0
votes
1
answer
70
views
SyntaxError: Syntax error in selector when using (:not) and (:has)
The error message:
SyntaxError: Syntax error in selector ":not(TSTypeAliasDeclaration:has(> Identifier[name=Nullable])):has(> TSUnionType:has(> TSNullKeyword):not(:has(> ...
1
vote
0
answers
181
views
how to use prettier recommended rules with eslint's defineConfig API?
I have a folder with this structure:
root
|- folderA
|- folderB
|- folderC
I want to apply two sets of rules to eslint to each folderA and folderB and completely skip folderC. so I have this:
export ...
2
votes
0
answers
35
views
Javascript linting isolated Javascript files (without package structure)
I am working on a few Javascript files comprising a small part of a large legacy codebase. I notice that eslint requires a package.json file and package structure, which this codebase lacks. Is there ...
0
votes
0
answers
118
views
How to fix fixable eslint error only changed lines in staged JS/TS files using ESLint
I want to build a Node.js script (or Git hook) that will only fix ESLint errors on the lines that are changed in staged JavaScript/TypeScript files. The intention is to keep the fixes minimal and ...
3
votes
2
answers
3k
views
ESLint not working in Cursor editor UI but works in terminal (MacOS Sequoia 15.4.1)
I'm experiencing an issue specifically with Cursor where ESLint doesn't show any errors in the editor UI across all of my projects, despite working correctly in the terminal.
The Problem
ESLint ...
0
votes
0
answers
83
views
using eslint witn neostandard style guide
I am trying to understand how to use ESLint with neostandard style guide, then my eslint.config.mjs file could be:
option 1: this was generated by copilot
import js from "@eslint/js";
import ...
0
votes
1
answer
101
views
How to disable no-unused-vars errors when building from create-react-app?
I'm trying to run npm build but I get "no-unused-vars" errors. I'd like to disable these.
My project is build with create-react-app (https://github.com/facebook/create-react-app), React + ...