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
``
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.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
kevinkimenyi@Kevins-MacBook-Air dashboard-revamp %
``
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'); }
foo
is a function without type information
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 🤦♂️
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?
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.
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
.