Category "eslint"

EsLint - Suppress "Do not use 'new' for side effects"

I saw the way to suppress this with jsLint, tried it, it did not work. I need the 'new' keyword or my script does notwork. How can I suppress it in .eslintrc?

Lint rule "no-restricted-imports" throw error when patterns group specified

I configured .eslintrc.json in Nx/nrwl monorepo for React project. When I add group to pattern attribute to no-restricted-import "rules": { "no-restricted-i

Stuck with eslint Error i.e Separately, loops should be avoided in favor of array iterations

I have the Code for some iterations and it works well. After installing eslint, One of my code generates an error by eslint. My code is: for (const column of

Expected 'this' to be used by class method

In my class, eslint is complaining "Expected 'this' to be used by class method 'getUrlParams' Here is my class: class PostSearch extends React.Component { c

ESLint - Component should be written as a pure function (react prefer/stateless function)

ESLint is giving me this error on a react project. Component should be written as a pure function (react prefer/stateless function) It points to the first lin

How to fix this violation of this 'react/no-unescaped-entitie' of eslint rule?

This is my code: const func = () => { return ( <div > you're free </div> )} Somehow eslint flags the line "you're free" w

Different eslint rules based on file extension

Is it possible to have different rules applied to files based on their files extension? For example I have [test].spec.js test spec files residing along my sour

Warning Unexpected unnamed function func-names under, ESLint rule

My eslint version is 4.18.2, it would give a warning like this: Unexpected unnamed function Expected an assignment or function call and instead saw an ex

How do you run eslint for only a specific rule or set of rules - command line only

I know you can define rules in an .eslintrc file, but what if I just want to run eslint and check for one specific rule? E.g. $ eslint helpme.js --rule some-im

Nice way to get rid of no-unused-expressions linter error with chai

In my Chai tests I often find myself wanting to use their assertions that are something like .to.be.empty, .to.be.true e.t.c., because I find them to be cleaner

"Import in body of module; reorder to top import/first" Across Many Files

I have the same error as this answer, except instead of it just occurring in one file it is occurring in many; once I fix it for one file, another just pops up

TypeError: Failed to load plugin 'jest' declared in '.eslintrc': Class extends value undefined is not a constructor or null

I was updating react-scripts to latest version i.e. 5.0.0 and started seeing above error. One article suggested to upgrade @typescript-eslint to version ^5.0.0

Eslint rule to ensure minimum variable name length, but not on JSON?

Our code has become a bit of a maintenance nightmare due to previous developers being liberal with single letter variables and little documentation. The latter

Codemod vs. eslint --fix

I want to write a couple of scripts to automatically detect missing imports and import them based upon a root directory. Is it better to write this script as a

SAP Web IDE shows errors about ES6+ features

for (var items in _selectedContexts) { var downloadModel = __parsed[__parsed[items].toString().split("/")[1]][__parsed[items].toString().split("/")[2]]; var

Vue: disable no-unused-vars error: the simplest fix

I have a very simple vue project: <template> <div class="text-breakdown"> <h3 class = "title">Text Breakdown</h3>

Why (and How Can I FIx) ESLint import/no-extraneous-dependencies Failures on Installed Packages?

When I run ESLint I get the following errors: 1:13 error 'joi' should be listed in the project's dependencies. Run 'npm i -S joi' to add it import/no-

Eslint not working with the TypeScript syntax

I am trying to configure eslint for my REACT-TypeScript project. It was previously using tslint which is going to deprecate soon. I have gone through the web an

no-use-before-define typescript interfaces

I have 2 typescript interfaces that have a member that is of the type of the other interface (circular reference). My linter complains that I cannot use an inte

How to create a custom hook that recives dependencies?

I'm making a custom hook that have a toogle when some state change. You should be able to pass any state in an array. import { useState, useEffect } from 'rea