## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• 08:38
netlify[bot] commented #15926
• 08:37
netlify[bot] commented #15926
• 08:37
amareshsm synchronize #15926
• 08:08
netlify[bot] commented #15926
• 08:06
netlify[bot] commented #15926
• 08:06
amareshsm synchronize #15926
• 01:08
eslint-github-bot[bot] commented #15873
• 01:08
mdjermanovic closed #15873
• 01:08
mdjermanovic commented #15873
• 01:06
mdjermanovic labeled #15916
• 00:57
eslint-github-bot[bot] labeled #15363
• 00:57
eslint-github-bot[bot] locked #15363
• May 27 23:03
mdjermanovic commented #15926
• May 27 22:51
Krinkle commented #15730
• May 27 22:35
mdjermanovic commented #15926
• May 27 22:34
github-actions[bot] labeled #15730
• May 27 22:34
github-actions[bot] commented #15730
• May 27 22:34
github-actions[bot] labeled #15735
• May 27 22:34
github-actions[bot] commented #15735
• May 27 20:33
12Me21 labeled #15930
Jordan Harband
@ljharb
("global" means "in npm root -g, and there's no global package.json)
Julie Laursen
@julielaursen
i assumed when the error first said to install globally it meant the package.json at the top of the file structure instead of the package.json in the individual folder i was working on
Jordan Harband
@ljharb
nah, that's outdated advice telling you to npm install -g
whatever folder you're running eslint in is the package.json that should have all your eslint stuff, and the folder that should have your eslint config with "root: true" set.
Liveloper
@liveloper
hello all, I have a custom library installed in my node_modules, inside I have an .eslintsrc.json file, I want to use this file in the extends eslint root file of my project, but I have an error. I'm triying to do this: {"extends": ["@customlibrary/.eslintrc.json"]} and I get: Failed to load config "@customlibrary/.eslintrc.json" to extend from. Any idea about how can I use this?
Julie Laursen
@julielaursen
Sorry to bug y'all again but we decided to just move our whole code to a separate repo and now im trying eslint there with prettier. My package.json has 'eslint --fix' in it but i still have 15 errors in my typescript file that i'd like eslint/prettier to either fix or ignore
package.json looks like this:
{
"name": "provider-mock",
"version": "1.0.0",
"description": "Matches requests to the serviceability-provider-mock service and sends back expected mock responses.",
"linters": {
"*.{js,json,css,ts}": [
"eslint --fix .",
]
},
"scripts": {
"start": "ts-node src/setExpectations.ts",
"prettier": "prettier '**.ts'",
"prettier:fix": "prettier --write '**.ts'"
},
"dependencies": {
"mockserver-client": "^5.11.2",
"ts-node": "^10.4.0",
"typescript": "^4.5.4"
},
"devDependencies": {
"@types/node": "^17.0.8",
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "7.0.4",
"lint-staged": "12.3.4",
"prettier": "^2.5.1",
"prettier-eslint": "^13.0.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
I have an eslintrc.js nad a .prettierrc config too i can post
but i thought eslint --fix is where the fix is supposed to happen. I tried it with the period after and without it, and with a direct file path too
Peter
Hi I'm trying to write a warning when the following import is used import { NotFoundError } from 'rxjs'; is there someway I could achieve that using no-restricted-syntax?
Peter
I managed to find a way using
"no-restricted-imports": ["error", {
"name": "rxjs",
"importNames": ["NotFoundError"],
"message": "Where you intending to use shiny/errors/not.found.error?"
},{
"name": "rxjs/internal/util/NotFoundError",
"message": "Where you intending to use shiny/errors/not.found.error?"
}],
Richard Hagen
@Richard87
HI everyone! I am trying to make eslint work for us, but having major issues :/ I have a project root, and a ./assets folder with all our js/ts/react source, and a ./public/node_modules folder... for the life of me, I cant get eslint to look for plugins in the right node_modules path (except linking the folder directly, but that doesnt work for us :/ )
is there any way I can specify NODE_PATH or otherwise tell eslint which node_modules folder to use?
(If I put eslintrc file in the ./public directory, I dont understand how I can also get it to scan the ./assets folder...
Jordan Harband
@ljharb
@Richard87 node_modules, and package.json, and your eslint config should all only be in the root of your project
public is usually not the root of a project
Richard Hagen
@Richard87
hehe, I know, and I hate how I was lazy 5 years ago, but because of a "monorepo", with modern react in ./assets, and legacy javascript in ./public, with the same legacy ./public/node_modules, I'm in a pinch until I'm done migrating to react, but that will take a year, so I was hoping to use eslint in the meantime! (maybe the process would go faster if I could catch bugs earlier :D )
Benjamin Muskalla
@bmuskalla
:wave: I'm playing around with the @typescript-eslint/no-unused-vars - I've quite a few occurrences in our codebase due unused parameters in methods overriding ones from their superclass (e.g. noop impl of a service). Is there a good way to avoid those warnings or is my best bet to disable them in each case
Jordan Harband
@ljharb
@bmuskalla the best way it not to use inheritance where it's not appropriate :-)
@sircle:matrix.org
[m]
Hi
I want to get all the function names in a file via eslint context. How can I do it? ref https://eslint.org/docs/1.0.0/developer-guide/working-with-rules#the-context-object
@sircle:matrix.org
[m]
KJones
@KJsRepo
Oh boy oh boy, I really wish I could get linting working properly. About half the time, Atom shows "invalid position given by 'whichever error'". When I try to run eslint on the file in the command line it says it can't find the plugin eslint-plugin-js, but I've installed it globally.
Dominic Watson
@intellix

I'm trying to detect floating promises but the rule seems not to detect it in particular scenarios... is there any reason it wouldn't work?

"@typescript-eslint/no-floating-promises": "error",

If I rename the rule, it says that it doesn't exist (so I know that it's found it), if I change error to "errrror" it says that it's not a valid option (so I know that's correct). If I have a basic example in the root of my project it seems to pick it up.
If I add lots of empty lines, i can see other linting errors popping up, so I know the file is being checked. In fact if I put something really basic in the file, it's catching it

Dominic Watson
@intellix
ahah.... it doesn't work in conditions or when you assign a variable
if (doSomethingAsync())

const result = doSomethingAsync();
I mean you can assign to a promise but if you never await it in the entire function then... and also inside a condition is always going to return true as a Promise is truthy is it not?
Dominic Watson
@intellix

I think a good rule could be: if you want to store a Promise in a variable, you should suffix the name with Promise like so:

const somePromise = doSomethingAsync();

So it'll at least throw an error that it changed from sync -> async and you need to look at it again

Dominic Watson
@intellix
ahah..... found the rules I was looking for:
• return-await
• no-misused-promises
Jordan Harband
@ljharb
forced variable suffixes is called Hungarian notation i think? It’s pretty far out of vogue, for decades now
Jordan Harband
@ljharb
@AnderssonPeter yes, with overrides
Jordan Harband
@ljharb
sounds like you’re using eslint-config-standard and it’s not npm installed
Dominic Watson
@intellix
is there a rule to disallow SomeClass.name? to prevent people relying on it and breaking things after minification:
SomeClass.name -> "SomeClass" but after minification: "A"
Peter

Hi I have the following config

    {
"files": [
"*/infrastructure/**/*.ts"
],
"rules": {
"no-restricted-imports": ["error", {
"patterns": [{
"group": ["*/ui/*"],
"message": "ui services should not be used in infrastructure!"
}]
}]
}
}

So the idea here is to disallow any import in a file thats in a infrastructure folder, that is importing something that's in a ui folder, but it dosen't work in the file src\app\test\infrastructure\test.infrastructure.module.tsthere is a import of ../ui/test.service but eslint dosen't yield a error? what am I doing wrong?

Kristopher Recinos
@kristopherRec

HI, i'm geeting this error when trying to commit, i've tried a lot of solution but nothing seems to work : npm ERR! could not determine executable to run

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/krecinos/.npm/_logs/2022-04-02T03_03_06_249Z-debug.log
Aborting commit due to empty commit message.

Jordan Harband
@ljharb
do you have git hooks? Either way this isn’t an eslint question
Kristopher Recinos
@kristopherRec
Yes i have git hooks. Oh ok sorry did not check the channels subject properly.
Branden Visser
@mrvisser

Hi folks, I'm wondering what options I have to avoid duplicate plugin errors due to different dependencies having different versions of a plugin (using yarn)?

I'm using create-react-app, but want to have my own linting configuration. create-react-app uses eslint-jest-plugin, and so does my app, but the versions are different. That results in yarn storing a copy of eslint-jest-plugin in both the CRA linting module node_modules, and my own root node_modules:

$npx eslint --max-warnings 0 --resolve-plugins-relative-to . . Oops! Something went wrong! :( ESLint: 8.12.0 ESLint couldn't determine the plugin "jest" uniquely. - /Users/branden/Source/enactive/node_modules/eslint-plugin-jest/lib/index.js (loaded in ".eslintrc.js » ./node_modules/@enactive-ac/dev-config/eslint/react.js » /Users/branden/Source/enactive/workspaces/integration-ui/node_modules/@enactive-ac/dev-config/eslint/index.js » plugin:jest/all") - /Users/branden/Source/enactive/node_modules/eslint-config-react-app/node_modules/eslint-plugin-jest/lib/index.js (loaded in ".eslintrc.js » ./node_modules/@enactive-ac/dev-config/eslint/react.js » eslint-config-react-app/jest") Please remove the "plugins" setting from either config or remove either plugin installation. If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. doing --resolve-plugins-relative-to . I don't think solves this issue because the path to both jest plugins are from the root, which is where I want the lookup to be ? root: true doesn't either because the duplicate is within the root due to hoisting. The best thing I can think of is a postinstall that deletes node_modules/eslint-config-react-app -- anything better that can be done on the eslint plugin resolution side? Is there something for ignoring plugin lookup paths via glob pattern or anything like that? Branden Visser @mrvisser Bleh, just realized it's not some crazy nested lookup thing, it's loading the same plugin multiple times from different modules (I was extending react-app/jest as well as applying jest/all, which was unnecessary). Martin Vengai @MartinVengai Hi, I'm new here. I'm trying to enable gitlab sast on a monorepo, and the eslint-sast jobs keeps failing. Am I missing something? $ /analyzer run
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ GitLab ESLint analyzer v2.25.1
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ Detecting project
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ Found relevant files in project, analyzing entire repository
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ Running analyzer
Oops! Something went wrong! :(
ESLint: 7.32.0
RangeError: Invalid string length
at JSON.stringify (<anonymous>)
at module.exports (/home/node/node_modules/eslint/lib/cli-engine/formatters/json.js:12:17)
at Object.format (/home/node/node_modules/eslint/lib/eslint/eslint.js:648:24)
at printResults (/home/node/node_modules/eslint/lib/cli.js:181:30)
at async Object.execute (/home/node/node_modules/eslint/lib/cli.js:316:13)
at async main (/home/node/node_modules/eslint/bin/eslint.js:132:24)
[DEBU] [ESLint] [2022-04-05T13:39:30Z] ▶ /home/node/node_modules/.bin/eslint -c /home/node/.eslintrc --no-eslintrc --ext .html,.js,.jsx,.ts,.tsx -f json . --resolve-plugins-relative-to /home/node
[ERRO] [ESLint] [2022-04-05T13:39:30Z] ▶ An error occurred while running eslint: exit status 2
Seif Eddine Slimene
@SeifESlimene
It said Invalid string length
5P4RK3R
@5P4RK3R
Hi Guys, I'm getting this issue: ESLint couldn't determine the plugin "import" uniquely. can anyone help me out?
Jordan Harband
@ljharb
is eslint-plugin-import a top level dev dep?
also, nothing else should depend on it directly, only as a peer
Ludea
@ludea12:matrix.org
[m]
Hi, I install eslint plugin for vscode.
I get a lot of error with yarn eslint. But no error into vs. May I have to enable something ?
Domenico Loiacono
@dloiacono

Hello guys, maybe you know better than me and the solution is very easy:
I installed eslint globally:
npm i eslint@6.8.0 -g
Then I also installed globally eslint-config-google:
npm i eslint-config-google -g
But when I run the command:
npm run lint
I get this error:

Oops! Something went wrong! :(
ESLint: 6.8.0.
ESLint couldn't find the config "google" to extend from. Please check that the name of the config is correct.

My configuration contains:

    "extends": [
],

Logs:

  eslint:cli CLI args: [ './', '--fix', '--debug' ] +0ms
eslint:cli Running on files +4ms
eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/source', loose: false } ] +0ms
eslintrc:ignore-pattern   processed: { basePath: '/source', patterns: [ '/**/node_modules/*' ] } +1ms
eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/source', loose: false } ] +1ms
eslintrc:ignore-pattern   processed: { basePath: '/source', patterns: [ '/**/node_modules/*' ] } +0ms
eslint:file-enumerator Start to iterate files: [ './' ] +0ms
eslint:file-enumerator Directory: /source +1ms
eslint:file-enumerator Enter the directory: /source +0ms
eslintrc:cascading-config-array-factory No cache found: /source. +0ms
eslintrc:config-array-factory Config file found: /source/.eslintrc.json +1ms
eslintrc:config-array-factory Loading {extends:"google"} relative to /source/.eslintrc.json +0ms
paparao p
@paparao:matrix.org
[m]

ESLint couldn't find the config "developit" to extend from. Please check that the name of the config is correct.

The config "developit" was referenced from the config file in "/node_modules/@babel/preset-modules/package.json".

in my case, i get errors when in commented code i have tabs, while there is a rule no-tabs enabled. its ok for code but its not really ok for commented code.