Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
Activity
• 21:32
kaicataldo labeled #12664
• 21:32
kaicataldo labeled #12664
• 21:32
kaicataldo unlabeled #12664
• 21:32
kaicataldo unlabeled #12664
• 21:32
kaicataldo unlabeled #12664
• 21:32
kaicataldo commented #12664
• 21:15
ljharb commented #12664
• 21:10
trusktr edited #12664
• 21:10
trusktr edited #12664
• 20:59
trusktr edited #12664
• 20:59
trusktr edited #12664
• 20:59
trusktr labeled #12664
• 20:59
trusktr labeled #12664
• 20:59
trusktr labeled #12664
• 20:59
trusktr opened #12664
• 20:44
mdjermanovic commented #12094
• 20:38
mdjermanovic labeled #12094
• 20:38
mdjermanovic unlabeled #12094
• 20:37
mdjermanovic assigned #12094
• 19:02
Conduitry synchronize #12068
Dima Tisnek
@dimaqq
OK, I've opened eslint/eslint#12287 for this.
Kevin Partington
@platinumazure
@PradheepGit Yes, you must use that flag if your plugins are globally installed and you are using ESLint 6.x
Andrei Neculau
@andreineculau
does anyone know of a rule that works based of another one? my goal is to model a situation where I don't want a rule to activate, unless another rule would report errors. specifically: take object-curly-newline, and imagine that ImportDeclaration would require multiline ONLY IF the line length would trigger a max-len error
I forgot to say that I want to enforce the reverse of that: given that an ImportDeclaration would not exceed x when inlined, I would like to enforce inlining
Kevin Partington
@platinumazure
@andreineculau You could use eslint-rule-composer to take a base rule and filter its reported messages based on any logic. (You won't be able to easily look at the max-len configuration from within the rule, but you could create a module containing configuration-related constants, and then have your ESLint configuration be a JS file that uses that module to generate the max-len rule options.)
Ghost
@ghost~5d7a58ccd73408ce4fcabf04
@ilyavolodin it does, but i couldn't make it work. Anyways thanks for your help friend, i switched to VsCode and it is working perfectly!
Andrei Neculau
@andreineculau
@platinumazure thanks! didn't know about the composer. afaics it would almost work
Sebastien Guillemot
@SebastienGllmt

Hello! I'm looking to try and write my own plugin that uses Flow to check for "floating" promises (promises which are never used or awaited on)
Example:

async function doSomething() { return 5; }
doSomething() // error: missing await

Such a plugin exists for Typescript: https://palantir.github.io/tslint/rules/no-floating-promises/
but no such plugin exists for Flow

I can leverage eslint-plugin-flowtype to get access to Flow type definitions from inside an ESLint plugin. However, (since I've never written an ESLint plugin before) I was wondering if anybody knows a similar existing plugin that I can look at

for example I couldn't find a plugin that simply checks if a function result is unused in the general case.

I think the logic would just be something like
1) Check if the function return is a Promise type
2) Pretend the whole function is one variable X
3) Use the eslint/no-unused-vars to check if X is used anywhere

Derek Leung

Where would I normally have control over how eslint finds definitions for enabled rules? I'm getting errors looking like

ERROR in /Users/.../actions.ts(1,1):
@typescript-eslint/no-triple-slash-reference: Definition for rule '@typescript-eslint/no-triple-slash-reference' was not found.

The setup of the repo I'm contributing to displays errors like this on compile as part of their webpack setup, which uses fork-ts-checker-webpack-plugin, which on version ^1.4.0 supports @typescript-eslint.
When I run ./node_modules/.bin/eslint a-file on the command line, it gives me around 5 rules it can't find definitions for, so for now I've turned them off. Most of them turned out deprecated, but one was an eslint rule that should still exist, no-param-resassign.

Derek Leung
This might be a really basic question too - I'm wondering, is there a way to turn all errors on enabled rules into warnings, that's faster than manually writing out each rule you want to downgrade? Right now if there's an error, the compiler seems to exit and show only the one error. It'd be far more useful if I could see all errors and warnings so I could fix more together.
Sebastien Guillemot
@SebastienGllmt
Ah I just realized Flow has its own linter called flowlint so maybe better it gets implemented there instead of ontop of ESLint
Jordan Harband
@ljharb
@sebastiengllmt just like tslint, eslint is the best place to do it - it was a mistake for tslint to ever exist in the first place, and it's probably a mistake for flowlint just the same.
Kai Böse
@Kagu-chan

Hi. we're using eslint@^6.2.0 eslint-config-airbnb-base@^14.0.0 eslint-plugin-import@^2.18.2 in our project. However, setting up automated pipelines with installing modules every time takes time, so we build a docker image which installed the stuff and copy node_modules to our project scope. This works and is faster then using npm i for every pipeline, but still very slow since our packahe.json contains a bit more (framework etc)

Now we tried a docker image, which installs only this three packages globally. So we wont need to have extra node_modules at all for the pure linting in pipeline. But now we're getting errors regarding the airbnb-base config:

Config: extends: 'eslint-config-airbnb-base', (was extends: 'airbnb-base', before, which works both locally)
Error: ESLint couldn't find the config "eslint-config-airbnb-base" to extend from

Why is it complaining / not working, when locally it does? I remember a few versions earlier this worked (but i dont remember which versions we used) - some change i missed?

Nico
@nicoayala

Hello there! First of all, thanks for this great tool
Second, I'm having a weird issue when running the linter:

> eslint .

Oops! Something went wrong! :(

ESLint: 4.19.1.
ESLint couldn't find the plugin "eslint-plugin-ie11". This can happen for a couple different reasons:
...

My eslint dependencies:

    "eslint": "4.19.1",
"eslint-config-airbnb-base": "13.0.0",
"eslint-plugin-import": "2.12.0",

This began to happen recently
Do you guys have any idea why this could be happening?

Jordan Harband
@ljharb
@nicoayala i don't see that eslint plugin installed locally.
eslint 6 changed resolution rules; so if you were relying on that, best to install it locally intead.
Philip Johnson
@philipmjohnson

Hi all, after upgrading to ESLint 6.4.0, I am getting the error "ESLint couldn't find the config "airbnb-base" to extend from." Running "eslint --debug --ext .js ." yields (in part):

eslint:config-array-factory Loading legacy config file: /Users/philipjohnson/Desktop/hellojavascript/.eslintrc +0ms
eslint:config-array-factory Config file found: /Users/philipjohnson/Desktop/hellojavascript/.eslintrc +23ms

Oops! Something went wrong! :(

ESLint: 6.4.0.

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

The config "airbnb-base" was referenced from the config file in "/Users/philipjohnson/Desktop/hellojavascript/.eslintrc".

If you still have problems, please stop by https://gitter.im/eslint/eslint to chat with the team.

So here I am! What do I do next to debug this? Thanks!

Further configuration info:
 $eslint --version v6.4.0 ~/D/hellojavascript$ sudo npm install -g eslint-plugin-import
npm WARN eslint-plugin-import@2.18.2 requires a peer of eslint@2.x - 6.x but none is installed. You must install peer dependencies yourself.

+ eslint-plugin-import@2.18.2
added 15 packages from 9 contributors, removed 7 packages and updated 20 packages in 4.946s
~/D/hellojavascript \$ sudo npm install -g eslint-config-airbnb-base
npm WARN eslint-config-airbnb-base@14.0.0 requires a peer of eslint@^5.16.0 || ^6.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb-base@14.0.0 requires a peer of eslint-plugin-import@^2.18.2 but none is installed. You must install peer dependencies yourself.

+ eslint-config-airbnb-base@14.0.0
added 17 packages from 10 contributors, removed 1 package and updated 1 package in 2.315s
Ilya Volodin
@ilyavolodin
ESLint resolves plugins based on the location of the config file. You are installing plugins globally, so they are not found in relationship to your config file. Please install them without -g flag
Philip Johnson
@philipmjohnson
Oh goodness. thanks.
Sebastien Guillemot
@SebastienGllmt
Good news! I finished writing my ESLint rules that provides the no-floating-promise functionality that TSLint implemented. It works both on vanilla Javascript (if your function is marked async) and on Flow (if your function is annotated to return a Promise)
do people think this is an important enough check to submit as a PR to the main ESLint repo or should I make this a one-rule plugin?
Jordan Harband
@ljharb
does it work if you have a non-async function that returns a promise?
Sebastien Guillemot
@SebastienGllmt
only if you can specify the type using Flow
I guess I could do it by actually stepping into the AST of the function
Sebastien Guillemot
@SebastienGllmt
anybody know how I can print out a dump of the AST so I can add it to my test? Seems this is required for tests that contain Flow to compile in the Eslint repo
Sebastien Guillemot
@SebastienGllmt
I tried getting it off of "astexplorer" but it complains about "missing the tokens array" whatever that means
Iwona Kubowicz
@programistka

Hi,
I have a problem with Webstorm & ESLint on Windows.
I installed ESLint, then configure it in Webstorm - set all the paths etc, set it as a watcher to make it run when I save the file and then when I save the file I'm getting the following:

cmd.exe /D /C call C:\_LAB_\tadam\node_modules\.bin\eslint.cmd --fix C:\_LAB_\tadam\src\App.js

Oops! Something went wrong! :(

ESLint: 6.4.0.

ESLint couldn't find the plugin "eslint-plugin-react".

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in "..\..\_LAB_\tadam\.eslintrc.json".

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

Process finished with exit code 2

I do have this plugin installed. I even tried to reinstall it but nothing helped.
When I run from the command line

C:\_LAB_\tadam\node_modules\.bin\eslint.cmd --fix C:\_LAB_\tadam\src\App.js

being in C:_LAB_\tadam it works fine
but when being in C:_LAB_ or any other folder location it doesn't work.

Sebastien Guillemot
@SebastienGllmt
ah I figured out you can get the tokens by setting ASTExplorer to Babylon 7 and then changing the configs. Still fails to parse though :/
Sebastien Guillemot
@SebastienGllmt
okay I've tried every tool and way to combine ASTs together and I just cannot find something that the test framework can load in :/
Sebastien Guillemot
@SebastienGllmt
SebastienGllmt/babel@7a30f58 here is my code if anybody wants too check it out. It should all works except for the 4 tests that use Flow annotations (They work in practice but the test fails to parse the code)
Sebastien Guillemot
@SebastienGllmt
Good news! I found a different ESLint plugin that can pares it and then modified the code so that it I could extract the AST :)
I made the pull request to ESLint with this feature and would appreciate feedback on whether or not this rule should be packaged in core and if so, if anybody wants to champion it
eslint/eslint#12297
Rodrigo Gomes
@rodgomesc
@KathiresanRamkumar95 did you solved ESLint couldn't find the config "airbnb/base" to extend from. Please .... ??
Pritesh Hirani
@phirani27
Hi Team,
I am getting the following issue when I run npm test
ESLint couldn't find the plugin "eslint-plugin-internal-rules". I tried reinstallign as siggested but it did not help. How do I solve this problem?
Kevin Partington
@platinumazure
@phirani27 Maybe try removing node_modules recursively and do a fresh npm install?
The plugin you mention isn't actually a published package (it uses a file: reference). So if you're using a package manager besides npm, it could give you weird/inconsistent results, I suppose.
Sebastien Guillemot
@SebastienGllmt
For anybody interested, I talked with a contributor to Flow about my no-floating-promise ESLint plugin and they added the functionality to Flow itself :+1:
ooyyloo
@ooyyloo
Hello, everyone. I'm writting an eslint plugin. I encounter the problem The package "@.../eslint-plugin" was not found when loaded as a Node module from the director. I don't knwo how to solve this. Could anyone told me that how to solve this problem?
@ooyyloo If you are using ESLint 6.x then you should use the "--reslove-plugin-relative-to" flag to load your plugin.
Francois Massart
@francoismassart

Hi there,
I've a question but I did not find an answer neither on google nor on github...

I'd like to generate the list of rules generated by using extends and rules inside the config file.
The idea is to "inspect" which rules are enabled and with which config...
Think of it as some kind of cousin the eject command on the angular or vue cli...

Is there something that does this already ?

Jakob Guddas
@jguddas
there is eslint --print-config but that does not show where the rules are comming from
Francois Massart
@francoismassart
Thank you @jguddas :
:)
gdagosto
@gdagosto

Hello, everyone. I'm trying to use eslint with Webstorm, and I'm facing an issue.

The command I execute is: (i took the full project path away just to show the problem, path is huge)
cmd.exe /D /C call [projectPath]\node_modules\.bin\eslint.cmd --fix [projectPath]\src\index.js

The issue I'm facing is:

ESLint couldn't find the plugin "eslint-plugin-react".
(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "C:\Program Files\JetBrains\WebStorm 2019.2\jbr\bin".)

And down the line it also says: The plugin "eslint-plugin-react" was referenced from the config file in "[projectPath]\.eslintrc.js".

I started it with eslint --init, with airbnb config files, and did not edit anything else.

Any ideas on what I might be doing wrong?

Rob Lingstuyl
@anwarhamr
can anyone tell me what I need to add/change based on this message?

eslint . --ext js,ts

Oops! Something went wrong! :(

ESLint: 5.16.0.
ESLint couldn't find the config "plugin:@typescript-eslint/recommended-requiring-type-checking" to extend from. Please check that the name of the config is correct.

"dependencies": {
"@dfd/doc-converter-lib": "^1.0.24",
"@dfd/doctransmit-lib": "0.0.6",
"@dfd/nest-service-core": "^1.4.0",
"@nest-modules/mailer": "^1.1.3",
"@nestjs/common": "^6.5.3",
"@nestjs/core": "^6.5.3",
"@nestjs/passport": "^6.1.0",
"@nestjs/platform-express": "^6.5.3",
"@nestjs/swagger": "^3.1.0",
"@types/jsonwebtoken": "^8.3.3",
"@types/passport": "^1.0.0",
"axios": "^0.19.0",
"class-transformer": "^0.2.3",
"class-transformer-validator": "^0.7.1",
"class-validator": "^0.9.1",
"date-fns": "^1.30.1",
"lodash": "^4.17.11",
"mongodb": "^3.3.2",
"passport-http-bearer": "^1.0.1",
"passport-strategy": "^1.0.0",
"phantomjs-prebuilt": "^2.1.16",
"rxjs": "^6.5.2",
"swagger-ui-express": "^4.0.7"
},
"devDependencies": {
"@dfd/eslint-config": "^1.0.0",
"@nestjs/testing": "^6.5.3",
"@types/chance": "^1.0.2",
"@types/express": "^4.16.1",
"@types/jest": "^24.0.11",
"@types/lodash": "^4.14.123",
"@types/nock": "^10.0.2",
"@types/node": "^12.6.2",
"@types/passport-http-bearer": "^1.0.33",
"@types/passport-strategy": "^0.2.35",
"@types/supertest": "^2.0.7",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.6.0",
"chance": "^1.0.18",
"dotenv": "^8.0.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-jest": "^22.15.0",
"eslint-plugin-prettier": "^3.1.0",
"husky": "^3.0.3",
"jest": "^24.5.0",
"lint-staged": "^9.2.1",
"nock": "^10.0.6",
"nodemon": "^1.19.2",
"prettier": "^1.17.0",
"rimraf": "^2.6.3",
"supertest": "^4.0.2",
"ts-jest": "^24.0.2",
"ts-node": "^8.1.0",
"tsconfig-paths": "^3.8.0",
"typescript": "^3.4.4"