Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 00:44

    kaicataldo on remove-parser-demo

    (compare)

  • 00:44

    kaicataldo on master

    Chore: remove references to par… (compare)

  • 00:44
    kaicataldo closed #12644
  • 00:43

    kaicataldo on master

    Docs: wrap {{}} in raw liquid t… (compare)

  • 00:43

    kaicataldo on fix-liquid-interpolation

    (compare)

  • 00:43
    kaicataldo closed #12643
  • 00:36
    kaicataldo unlabeled #12582
  • 00:36
    kaicataldo labeled #12582
  • 00:36
    kaicataldo unlabeled #12582
  • 00:36
    kaicataldo commented #12582
  • Dec 05 22:50
    mdjermanovic reopened #12222
  • Dec 05 22:50
    mdjermanovic unlabeled #12222
  • Dec 05 22:50
    mdjermanovic assigned #12222
  • Dec 05 22:47
    mysticatea pinned #12642
  • Dec 05 22:47
    mysticatea labeled #12642
  • Dec 05 22:47
    mysticatea pinned #12629
  • Dec 05 22:47
    mysticatea labeled #12629
  • Dec 05 22:43
    eslint[bot] commented #12222
  • Dec 05 22:43
    eslint[bot] labeled #12222
  • Dec 05 22:43
    eslint[bot] closed #12222
PradheepGit
@PradheepGit
Using --debug flag I got the above message
PradheepGit
@PradheepGit
The plugin works only when I run ESLint in my plugin's directory and not working in any other directory
Domvel
@Domvel
I just wondered because jshint recognized it as es6 feature. But ok, eslint uses parsing error. ... thanks.
Jordan Harband
@ljharb
jshint is many years obsolete at this point.
Kevin Partington
@platinumazure

@Domvel If you set parserOptions.ecmaVersion = 6 (or 2015), it will parse using ES6, but then you get all of the ES6 features.

If you wanted, you could try setting ecmaVersion=6, but then use no-restricted-syntax to lint on other syntax patterns such as rest/spread. Or you could try using eslint-plugin-es, which might or might not have rules to enable what you need.

If ecmaVersion=3, then let will not be parsed as a keyword, as standard ES3 did not specify that behavior (even if some browsers might have allowed it).

Roman
@moltar
Hi, what can go into the overrides section? I tried to find the docs for that, but cannot find anything. Can I override any value from the top level config?
E.g. can I set env for a specific pattern of files?
Can I setup a different parser for specific files? E.g. only use typescript parser for *.ts files?
Kevin Partington
@platinumazure
@moltar There are very few limits- all the cases you described should work
You can't nest overrides and I think there are one or two other config keys that aren't allowed in overrides, but pretty much everything should work.
PRs to improve the documentation here are welcome!
PradheepGit
@PradheepGit
Is it mandatory to provide "--resolve-plugins-relative-to" for my plugin to work?(I have installed my plugin globally)
Jordan Harband
@ljharb
don't install things globally :-)
PradheepGit
@PradheepGit

When I use eslint file.js the below error message appears:
ESLint: 6.4.0.

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

(The package "eslint-plugin-myplugin" was not found when loaded as a Node module from the directory "/Users/pradheep-9009".)

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

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

The plugin "eslint-plugin-myplugin" was referenced from the config file in ".eslintrc.js".

Using --debug flag the below message appears:
eslint:config-array-factory Loading plugin "myplugin" from /Users/pradheep-9009/.eslintrc.js +12ms
eslint:config-array-factory Failed to load plugin 'myplugin' declared in '.eslintrc.js'. +1ms
It works only when eslint is run from plugin's directory. But earlier versions allows plugins to run from any CWD.
Dima Tisnek
@dimaqq

Hi channel, is there perhaps a canonical workaround for "unused" variables in for...of?
For example, I have code like this:

async function forever(x) {
  for await (const unused of x) {
    void unused;
  }
}

forever(monitor_network());

As far as I can tell, must have a variable in for...of
But the monitor_network doesn't yield anything useful, the generator style is so that it's easier to test
Up until recently void unused silenced ESLint, but no longer
Is there canonical way to do what I'm trying to?
Is there a known e.g. name for unused that ESLint automatically recognises?

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
@drkstersetweets_twitter

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
@drkstersetweets_twitter
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.
PradheepGit
@PradheepGit
@platinumazure Thanks for your response!!
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",

npm@6.1.0
node@8.11.3

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
  eslint:config-array-factory Loading {extends:"airbnb-base"} relative to /Users/philipjohnson/Desktop/hellojavascript/.eslintrc +15ms

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?
the documentation asks me to find a "champion" for the inclusion of this rule so I'm asking here to see if anybody else is passionate about this
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".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "C:\WINDOWS\system32".)

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