6,975
questions
0
votes
1
answer
24
views
ESLint VSCode plugin not working with eslint.config.mjs
I have an Express.js API, and I'm using the latest version of ESLint (9.10.0). I've been trying to enable code warnings and errors in VS Code, but when I run npx eslint --init, ESLint creates an ...
0
votes
0
answers
32
views
Trouble setting up eslint_d in neovim for Javascript projects
So I've had my lsp setup with neovim for a minute now, but I've just started working on a javascript project and I realize I have no idea how to setup eslint_d. I've scoured the internet for answers ...
0
votes
0
answers
11
views
Can you pattern match with eslint - lean-imports/import
I have a resource that is a folder of images. When a user imports an image using the pattern below, it pulls in the whole package.
import {thisIcon} from "../../myResource/dist";
So, I want ...
-3
votes
0
answers
25
views
While installing a project in NextJs by using npm install I am getting this error [closed]
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/eslint
npm error dev eslint@"^7.9.0" from the root project
npm error
npm error Could not ...
0
votes
0
answers
30
views
Problem with Eslint js and global variable
I have a problem with eslint when building my docker containers, but for some reason when I want to create it it gives me an error in a global variable, which I use in the same component but it only ...
0
votes
1
answer
32
views
How to deal with <script-setup> component imports and eslint rules like no-unused-vars
When using Vue
composition API with <script setup>, components are just imported like
import Component from '@/components/Component.vue';
How do I keep eslint from applying the no-unused-var ...
0
votes
1
answer
108
views
Latest way on updating an ESLint config file (2024)
Trying to create a new React project with vite. I usually setup ESLint via the npx eslint --init and then get an .eslintrc.cjs file which I afterwards modify for my preferred formatters. Once done, I ...
0
votes
0
answers
17
views
How to fix - 'global' is not defined" no-undef
In the new eslint flat file config, how to fix this?
I have already added the below and is not working.
import globals from "globals";
globals: {
...globals.browser,
.....
0
votes
0
answers
21
views
Vue throws an error due to Multiple spaces found when I try to align a commment
I am trying to comment some Vue code on a template like this:
showSelectedValue: { // ------- showSelectedValue -------
type: Boolean, // Switches between showing ...
-3
votes
0
answers
43
views
How to use ESLint without Prettier?
I've never been able to get the code to format properly without running Prettier before ESLint.
What am I doing wrong, maybe I'm missing some rules?
Source code:
{{
var text = {
"a": 1,
...
1
vote
0
answers
44
views
Why is VSCode reverting my simple-import-sort sorting of imports in this particular file?
I asked Run autofix to sort these imports! on eslint simple-import-sort/imports plugin in TypeScript a while back, but now I got everything working pretty much. If I run eslint --ext .tsx,.ts . --fix ...
-1
votes
0
answers
16
views
Is it possible to lift the eslint console lint to the calling function
I have the following code
function dbg<T>(input: T): T {
console.log(input);
return input;
}
that allows me to output values without needing a separate statement. eslint correctly warns ...
1
vote
1
answer
84
views
Ng lint doesn't recognize eslint.config.mjs
I upgraded my project from Angular version 16.2.0 to 18.2.2 and eslint version 8.46 to 9.9.1.
As the documentation suggested I migrated the eslint config file and I got an eslint.config.mjs but now ...
1
vote
0
answers
22
views
Glob pattern with AND condition for eslint plugin boundaries
I'm trying to setup eslint boundaries plugin and need to specify glob pattern for paths. But its not clear how to write the pattern which will cover the following case:
The pattern should match the ...
0
votes
1
answer
75
views
Eslint and prettier with Typescript React configuration
I have recently integrated eslint and prettier with react application based on typescript. I am having an issue where when I run npm run lint, I am able to see the warnings given by eslint, but when I ...
-1
votes
0
answers
24
views
ESLint Errors During Production Build - How to Fix?
I recently tried deploy the project airbnb clone but i am getting Project Lint error while deploying in the Vercel app which says about configuring the "Plugin "react-hooks" was ...
0
votes
0
answers
14
views
How to change indent size to 4 in Nx workspace for all files including config files at root level?
I created workspace using Nx, i managed to changed indent size to 4 using generated .editorconfig file.
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
...
2
votes
0
answers
43
views
How to get custom eslint working on Visual Studio 2022?
My package.json
{
...
"main": "index.js",
"type": "module",
"scripts": {
"start": "node index.js"
},
...
0
votes
1
answer
36
views
How to disable eslint `require-jsdoc` for TS type declarations, or at least for individual props
We love the eslint rule require-jsdoc... most of the time. But whenever we export a TS type (or interface), we're warned if we don't have a jsdoc block on not only the type itself, but also on each ...
1
vote
1
answer
17
views
How to explicitly mark a package as internal when ordering imports?
I've got this:
"pathGroups": [
{
"pattern": "react",
"group": "external",
"position": "...
-1
votes
0
answers
34
views
Is there an ESLint rule to avoid object modifications from a state coming from useState hook?
I found this ESLint rule, but it's for class components and I would like the same for useState hook.
For example, the rule would warn/error if someone did the following:
const [state, setState] = ...
0
votes
0
answers
22
views
TS2307: Cannot find module 'portal/PortalApp' or its corresponding type declarations
I am getting an error TS2307: Cannot find module 'portal/PortalApp' or its corresponding type declarations in the WebPack, React, TypeScript, Micro frontend project.
In the localhost server I am ...
0
votes
0
answers
45
views
EsLint error async/await promise callback function
I am getting an error on eslint expecting ( and not a { here.
loginStateChanged: async (params) => {
^ Expected '(' and ...
0
votes
0
answers
9
views
Format object property array on single line while having array new line
I would like to enforce ruling on object property arrays like this:
{ foo: [ "foo", "foo" ] }
While still having the array outside objects like this:
[
"foo",
&...
0
votes
0
answers
30
views
Is There an ESLint Rule to Require Parenthesis Around Conditions?
I want to be able to enforce parens around conditions in my JavaScript project with ESLint.
if ((condition1 === "yes") && (condition2 === "no")) {
// Do something
}
...
0
votes
1
answer
21
views
How to Require a Single-Line Conditional Body to be on its Own Line with ESlint
I have a large project with a lot of code. We are trying to standardize that code with linting rules.
We have several conditionals that are written like this:
if (thing) { doSomething(); }
else { ...
-2
votes
0
answers
42
views
ESLint 8.57.0 - Error with Git Hooks - Could not serialize parser object (missing 'meta' object)
So I've upgraded to ESLint version 8.57.0. The linting works in terminal when running by it self however I get the below error when I run a git commit (Git Hooks with Husky).
The Error
✖ eslint --...
1
vote
0
answers
34
views
ESLint Import Issue in Turborepo with Vue and Nuxt
I'm currently working with Turborepo and Vue/Nuxt, following the example project from this GitHub link.
I ran the following command to create my project:
npx create-turbo@latest -e with-vue-nuxt
...
1
vote
1
answer
76
views
Migrating from TSlint to ESlint
I am maintaing an old Angular 11 project that uses tslint. I have now migrated every dependency to angular 18 and everything works fine. The last thing is to migrate from tslint to eslint using this ...
-1
votes
0
answers
333
views
How do I resolve dependency errors when there isn't an stable release for eslint-react-plugin-hooks? Do I just use a beta version?
I'm trying to update my eslint package to a newer version due to a deprecated dependency rimraf package but run into an issue with eslint-plugin-react-hooks. From what I understand, eslint-plugin-...
0
votes
0
answers
32
views
Next JS - meta data ESLint warning
I'm working on a Next project based on the tutorial
https://nextjs.org/learn/dashboard-app/adding-metadata
I have this code (pretty much exactly what they have in the tutorial)
import { Providers } ...
0
votes
0
answers
47
views
Can't get ESLint rule to warn for no-floating-promises
Wheny my ESLint config has
"@typescript-eslint/no-floating-promises": "error"
I get errors for not awaiting promises. When I switch to "off", I get no output. When I set ...
-1
votes
0
answers
34
views
WebPack React Eslint error in JSON: Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions
Webpack React TypeScript Eslint in JSON file error: Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions
I am getting an error when I try to ...
0
votes
2
answers
28
views
Array.prototype.filter() expects a value to be returned at the end of arrow function - why?
I'm trying to understand why this error is appearing, I couldn't find similarities to other questions around here.
function decreaseQty(item) {
if (item.qty > 1) {
const updatedItems = ...
0
votes
0
answers
31
views
ESLint complains about type declaration
I declared a custom type in the codebase, like this:
/**
* SearchBoxOption Type
*/
export declare type SearchBoxOption = {
/**
* A key, shall be unique for all entries put into the SearchBox ...
-1
votes
1
answer
38
views
How to fix the missing dependency warning when using useEffect React Hook
With React 18.3.1, I get this error when I attempt to prevent an infinite loop on a fetch request:
src\pages\ItemDetail.js
Line 16:8: React Hook useEffect has a missing dependency: 'id'.remove the ...
0
votes
0
answers
31
views
How to extend eslint config when using yarn workspaces
I have yarn workspaces in my repository in packages directory with 3 packages: shared and app-1, app-2.
In shared package i have .eslintrc.js config file with following rules:
module.exports = {
...
0
votes
1
answer
48
views
Github action is failing but build marked as success in pull request [duplicate]
I have a GitHub action script to check lint for Vue 3 projects. The goal is to check es-lint, build, and output the result to the pull request conversation. But the step in which I output the errors ...
0
votes
0
answers
29
views
How to separate import and import type properly with eslint-plugin-import?
I'm using eslint-plugin-import in my React app.
There is a rule in that plugin which is named import/order. It allows you to make the order of imports inside your file.
I need all my import type to be ...
0
votes
0
answers
139
views
How to fix eslint - node version compatibilty issue?
I am trying to configure eslint & prettier in my node project
When i run npm i i am getting version compatibility warning for eslint.How can i fix this ? I tried to specify node version within ...
2
votes
0
answers
41
views
ESLint and TSServer errors reported twice in diagnostics
I'm trying to configure ESLint for my React (TypeScript) project.
This is my initial eslint.config.js file located in the root of the project.
// @ts-check
import eslint from "@eslint/js"
...
0
votes
0
answers
32
views
Eslint single quote rule not applying in vue template
Why doesn't eslint single quote rule apply inside vue template?
Relatively new to vue and codebase that I am working on does not have prettier (yet). I just wonder if this is a linter limitation. Or, ...
1
vote
1
answer
41
views
How to configure ESLint rule to add blank line between test/test.beforeAll/test.beforeEach/test.afterEach/test.afterAll in Playwright test?
I want to update my .eslintrc.js to set up the rule that it requires a blank line between the test.beforeAll, test.beforeEach, test, test.afterAll, test.afterEach in the test code using Playwright
// ...
-1
votes
1
answer
52
views
How can I use eslint:recommended and Google in eslint 9 with commonjs syntax?
I have a new project I want to use eslint9 for. I want a clean setup ans therefore utilize the new format.
As the project is a WebApp, it's script/common.js and not module syntax.
I tried to set up ...
0
votes
0
answers
55
views
Why are airbnb rules not being applied in my eslint configuration with flat config?
I'm trying to set up ESLint with Airbnb rules and TypeScript support using the new flat config format. However, it seems that the Airbnb rules are not being applied to my codebase.
Here's the ...
0
votes
0
answers
13
views
Type errors in story args are not thrown when running the lint script
I've noticed some inconsistent behavior with the linting rules for stories, but it will be easier to explain with a simple example. Let's say we have a basic button component that looks like this:
...
1
vote
0
answers
34
views
Javacript monorepo: How to organize barrel files to avoid unnecessary imports and cyclical dependencies
We have a small mono-repo similar to the following:
- /core
- package.json
- tsconfig.json
/src
- index.ts (export/imports from components and utils)
- /components
- index.ts (...
1
vote
1
answer
811
views
Parsing error: was not found by the project service, but I've ignored these files
My project structure
dist (compiled code by ts)
lib
lib.d.ts
lib.js
index.d.ts
index.js
src (source code)
lib
lib.ts
index.ts
eslint.config.mjs
packages.json
tsconfig.json
yarn.lock
My ...
-1
votes
1
answer
32
views
I am only using the plugin:@typescript-eslint/recommended preset rule set,Why am I getting no-var errors?
1、When I use ESLint to check my code, there is a rule that targets the var keyword, and the rule name is no-var. the no-var rule is a native rule of ESLint. However, I am only using the 'plugin:@...
0
votes
0
answers
37
views
eslint errors with TypeScript prototype function
I'm adding eslint v9 to my TypeScript project, starting with the standard rule set:
eslint.configs.recommended,
...tseslint.configs.strict,
I'd like to keep the rules quite strict, but I'm getting ...