mdjermanovic on no-unreachable-loop
New: Add no-unreachable-loop ru… (compare)
Here's an example of where I'd want an auto-fix for combinations of rules:
eslintrc
{
"max-len": "warn",
"object-curly-newline": ["error", {"multiline": true}],
"object-property-newline": ["error", {"allowAllPropertiesOnSameLine": true}]
}
// 77 < 80: ok - no fix needed
const obj = {prop1: 'value', prop2: 'value', prop3: 'value', prop4: 'value'};
// 93 > 80: not ok - fix needed
const obj = {prop1: 'value', prop2: 'value', prop3: 'value', prop4: 'value', prop5: 'value'};
// auto-fixed
const obj = {
prop1: 'value',
prop2: 'value',
prop3: 'value',
prop4: 'value',
prop5: 'value'
};
Oops! Something went wrong! :(
ESLint: 6.1.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 "/home/user/projects/.eslintrc".
If you still have problems, please stop by https://gitter.im/eslint/eslint to chat with the team.
Howdy folks
Just a tiny question:
let hehe = 42;
I use ES3 settings for a very old JS-Engine. (No browser, no node). Whatever...
ESLINT says: Parsing error: Unexpected token hehe.
The variable name is marked / underlined.
I expected something like: let is not supported in ES3.
It's a ES6 feature. And mark the keyword let
.
Or something like that. Why this behavior?
Oops! Something went wrong! :(
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".
--debug
flag to see where it's trying to find your plugin
@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).
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".
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?
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
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.
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?
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?
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!
$ 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