## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• 17:27
eslint[bot] labeled #13513
• 17:27
eslint[bot] locked #13513
• 09:14
snitin315 commented #13756
• 09:12
snitin315 commented #13899
• 08:52
• 08:52
• 08:52
• 08:52
• 06:12
danielrentz labeled #14019
• 06:12
danielrentz labeled #14019
• 06:12
danielrentz labeled #14019
• 06:12
danielrentz opened #14019
• 05:50
anikethsaha commented #14014
• 05:48
anikethsaha commented #14005
• 05:40
anikethsaha labeled #14005
• 05:40
anikethsaha labeled #14005
• 05:40
anikethsaha unlabeled #14005
• 05:40
anikethsaha unlabeled #14005
• 01:41
nzakas commented #12758
• 01:39
nzakas commented #14014
Miguel Marques
@munerf
i'm going to edit the first post, one sec
I can't

I have a project like this:

c:\git\foo.eslintrc
c:\git\foo\views (project that I want to lint, this is a typescript project, it has it's own node modules etc etc)
c:\tools\eslint\ (i have node_modules here with all the plugins I want to use) - here I meant the node_modules for eslint to run, and the plugins it uses

Jordan Harband
@ljharb
right, all node_modules must be in the same dir as your repo root and package.json and eslintrc
that's unavoidable
and every project needs their own node_modules.
Miguel Marques
@munerf
ok, got it, still confused about the --resolve-plugins-relative-to flag, can you give me an example?
Miguel Marques
@munerf
thanks for the help
Jordan Harband
@ljharb
i'm not sure what it's for tbh, but it was added to try to pacify some of the people who were trying to do bad things like having user-wide configs, and global eslints
Miguel Marques
@munerf
thanks :)
kimenyikevin
@kimenyikevin
Hello? anyone around to help with eslint problem ?


kevinkimenyi@Kevins-MacBook-Air dashboard-revamp % yarn lint
yarn run v1.22.10
\$ eslint .

Oops! Something went wrong! :(

ESLint: 6.8.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/kevinkimenyi/Desktop/.eslintrc.json".

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

error Command failed with exit code 2.
kevinkimenyi@Kevins-MacBook-Air dashboard-revamp %


Hamid
@hamidyfine

Hi,
Is anyone getting into this error?

No files matching the pattern "" were found.

eslint: 7.16.0

Matthew
@MatthewS2077
Hi... is there any way to have eslint catch the missing () ie, if the programmer forgets to add () to a function it is never called.
function foo() { return false; }
if (!foo()) { console.log('foo is false'); }
if (!foo) { console.log('foo is defined, so this then clause is never executed'); }
Matthew
@MatthewS2077
so I'm talking about this line, if (!foo) { console.log('foo is defined, so this then clause is never executed'); } ie, !foo instead of !foo() the programmer forgot the ()
Jordan Harband
@ljharb
no, because that’s not necessarily a mistake
functions are first-class values, and are often used as one.
Matthew
@MatthewS2077

no, because that’s not necessarily a mistake

hmm... but TS since 3.7 will warn if i use if (foo) with a warning like "did you mean foo()" but not warn with if (!foo).... seems to me TS should also warn in both cases

Jordan Harband
@ljharb
TS can choose to warn on whatever it likes, but TS not being a superset of JS means that TS already doesn't map nicely to JS
if you want TS to warn in different cases, you'd need to file an issue on their repo
Matthew
@MatthewS2077
yes thanks... do you know if eslint has a rule for this? i couldn't find one... can u see how it's difficult bug to catch? if the dev forgets the () ie if (!foo) instead of if (!foo())
Jordan Harband
@ljharb
i see how it's a difficult bug if you're in the bad habit of avoiding intermediate variables :-)
but also no, it's not possible for an eslint rule to catch this, except with type information.
since there's no way to statically know foo is a function without type information
Matthew
@MatthewS2077

i see how it's a difficult bug if you're in the bad habit of avoiding intermediate variables :-)

so like this?

function foo() { console.log('in foo'); return false; }
const x = foo;
if (!x) { console.log('this is never executed'); }

same problem... but thanks for your witticism 🤦‍♂️

Jordan Harband
@ljharb
const x = foo()
Matthew
@MatthewS2077

const x = foo()

yes, yes i get it... my point is what if the dev forgets the () and writes const x=foo then if (!x) fails because TS doesn't warn This condition will always return true since the function is always defined. Did you mean to call it instead?(2774)

with if (x) TS does issue the warning... that's great... BUT with if (!x) TS does NOT issue the warning.... surely this is a TS bug? it should warn in both cases

so anyway.... does eslint have a rule to catch this... i guess not?

Jordan Harband
@ljharb
it's not possible for eslint to catch it, unless TS is used
and most JS devs don't write TS.
so perhaps the typescript eslint plugin could have a rule for it, but otherwise TS itself would have to.
Aaron Ponce
@amponce
Does anyone know if nvm causes issues with eslint? My team has a custom file and it was working recently but yesterday I switched over to node 14 and now I can't get eslint to work for the life of me
Jordan Harband
@ljharb
@ampomce it shouldn’t (i maintain nvm)
how are you running eslint?
make sure it works on the command line, editors are always a different beast
Aaron Ponce
@amponce
we use vs code at work, I use the intergrated terminal and it's always worked fine with npm run lint filename.js
but now it fails every time
Aaron Ponce
@amponce

make sure it works on the command line, editors are always a different beast

I'll give that try, thank you

Jordan Harband
@ljharb
meaning if you can get it working on the real CLI, then it's an issue with your editor
for vscode, i think by default it ships with its own copy of node, so you might need to configure it to point to nvm's node
Martin Törnqvist
@toerndev
I'm trying to understand the anatomy of vue-eslint-parser + @typescript-eslint/parser, is there typically a way to print human-readable ASTs from anywhere in the plugin code so one can see what's going on?
Martin Törnqvist
@toerndev
Alternative question, or the reason I'm asking: Does anyone know whether vue-eslint-parser strips TypeScript from the AST returned by @typescript-eslint/parser for parseForESLint(vueScriptTag), before processing Vue rules? Trying to understand the best approach for dealing with TypeScript inside a non-standard file format.
2 replies
@Akxe
Hi, I would like to ask. After syncing my settings in VS Code, I don't know what changed, but now ESLint cannot find C:\.eslintrc.json (stakctrace: C:\Users\akxe\Documents\programming\rita\node_modules\eslint\lib\cli-engine\cascading-config-array-factory.js:172:35) . The config is at C:\Users\akxe\Documents\programming\rita\.eslintrc.js.
The log is from the VS Code extension output, I don't know how to pass it arguments, not I don't know what argument to pass to it...
Karan Ganesan
@karanganesan
Hi I am trying to write a eslint rule
so what I am trying to do is
the rule make sure the number of times a dependency is used for say X number
is it possible to do something like this?
Jordan Harband
@ljharb
what's the value in limiting it to an arbitrary number?
Jordan Harband
@ljharb
that seems right to me