Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 01:48
    ygongdev edited #16189
  • 01:47
    ygongdev labeled #16189
  • 01:47
    ygongdev labeled #16189
  • 01:47
    ygongdev opened #16189
  • 01:47
    ygongdev labeled #16189
  • 00:59
    nzakas commented #16156
  • 00:57
    eslint-github-bot[bot] labeled #15588
  • 00:57
    eslint-github-bot[bot] locked #15588
  • 00:57
    eslint-github-bot[bot] labeled #15592
  • 00:57
    eslint-github-bot[bot] locked #15592
  • 00:57
    eslint-github-bot[bot] labeled #15593
  • 00:57
    eslint-github-bot[bot] locked #15593
  • Aug 08 19:31
    DMartens commented #16102
  • Aug 08 19:27
    netlify[bot] commented #16102
  • Aug 08 19:27
    netlify[bot] commented #16102
  • Aug 08 19:27
    DMartens synchronize #16102
  • Aug 08 16:59

    nzakas on main

    docs: use shorthand property na… (compare)

  • Aug 08 16:59
    nzakas closed #16180
  • Aug 08 13:23
    nickpresta commented #15865
  • Aug 08 13:21
    Kaltoft commented #16006
Branden Visser
@mrvisser
doing --resolve-plugins-relative-to . I don't think solves this issue because the path to both jest plugins are from the root, which is where I want the lookup to be ? root: true doesn't either because the duplicate is within the root due to hoisting.
The best thing I can think of is a postinstall that deletes node_modules/eslint-config-react-app -- anything better that can be done on the eslint plugin resolution side? Is there something for ignoring plugin lookup paths via glob pattern or anything like that?
Branden Visser
@mrvisser
Bleh, just realized it's not some crazy nested lookup thing, it's loading the same plugin multiple times from different modules (I was extending react-app/jest as well as applying jest/all, which was unnecessary).
Martin Vengai
@MartinVengai
Hi, I'm new here. I'm trying to enable gitlab sast on a monorepo, and the eslint-sast jobs keeps failing. Am I missing something?
$ /analyzer run
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ GitLab ESLint analyzer v2.25.1
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ Detecting project
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ Found relevant files in project, analyzing entire repository
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ Running analyzer
Oops! Something went wrong! :(
ESLint: 7.32.0
RangeError: Invalid string length
    at JSON.stringify (<anonymous>)
    at module.exports (/home/node/node_modules/eslint/lib/cli-engine/formatters/json.js:12:17)
    at Object.format (/home/node/node_modules/eslint/lib/eslint/eslint.js:648:24)
    at printResults (/home/node/node_modules/eslint/lib/cli.js:181:30)
    at async Object.execute (/home/node/node_modules/eslint/lib/cli.js:316:13)
    at async main (/home/node/node_modules/eslint/bin/eslint.js:132:24)
[DEBU] [ESLint] [2022-04-05T13:39:30Z] ▶ /home/node/node_modules/.bin/eslint -c /home/node/.eslintrc --no-eslintrc --ext .html,.js,.jsx,.ts,.tsx -f json . --resolve-plugins-relative-to /home/node
[ERRO] [ESLint] [2022-04-05T13:39:30Z] ▶ An error occurred while running eslint: exit status 2
Seif Eddine Slimene
@SeifESlimene
It said Invalid string length
5P4RK3R
@5P4RK3R
Hi Guys, I'm getting this issue: ESLint couldn't determine the plugin "import" uniquely. can anyone help me out?
Jordan Harband
@ljharb
is eslint-plugin-import a top level dev dep?
also, nothing else should depend on it directly, only as a peer
Ludea
@ludea12:matrix.org
[m]
Hi, I install eslint plugin for vscode.
I get a lot of error with yarn eslint. But no error into vs. May I have to enable something ?
Domenico Loiacono
@dloiacono

Hello guys, maybe you know better than me and the solution is very easy:
I installed eslint globally:
npm i eslint@6.8.0 -g
Then I also installed globally eslint-config-google:
npm i eslint-config-google -g
But when I run the command:
npm run lint
I get this error:

Oops! Something went wrong! :(
ESLint: 6.8.0.
ESLint couldn't find the config "google" to extend from. Please check that the name of the config is correct.

My configuration contains:

    "extends": [
        "google"
    ],

Logs:

  eslint:cli CLI args: [ './', '--fix', '--debug' ] +0ms
  eslint:cli Running on files +4ms
  eslintrc:config-array-factory Loading JSON config file: /source/package.json +0ms
  eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/source', loose: false } ] +0ms
  eslintrc:ignore-pattern   processed: { basePath: '/source', patterns: [ '/**/node_modules/*' ] } +1ms
  eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/source', loose: false } ] +1ms
  eslintrc:ignore-pattern   processed: { basePath: '/source', patterns: [ '/**/node_modules/*' ] } +0ms
  eslint:file-enumerator Start to iterate files: [ './' ] +0ms
  eslint:file-enumerator Directory: /source +1ms
  eslint:file-enumerator Enter the directory: /source +0ms
  eslintrc:cascading-config-array-factory Load config files for /source. +0ms
  eslintrc:cascading-config-array-factory No cache found: /source. +0ms
  eslintrc:config-array-factory Loading JSON config file: /source/.eslintrc.json +6ms
  eslintrc:config-array-factory Config file found: /source/.eslintrc.json +1ms
  eslintrc:config-array-factory Loading {extends:"google"} relative to /source/.eslintrc.json +0ms
1 reply
paparao p
@paparao:matrix.org
[m]

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

The config "developit" was referenced from the config file in "/node_modules/@babel/preset-modules/package.json".

while running eslint getting error,Could someone please help me here
dimtabu
@taburetkin
hi guys, is it possible to disable linting on commented code?
in my case, i get errors when in commented code i have tabs, while there is a rule no-tabs enabled. its ok for code but its not really ok for commented code.
tried to google, but without success
2 replies
John Morgan
@john-s-morgan

So my linting is passing, but I'm not sure it should. CJS node16 build
eslintrc.json:

{
  "plugins": [
    "jest",
    "import"
  ],
  "env": {
    "node": true,
    "jest/globals": true
  },
  "extends": [
    "standard",
    "plugin:import/recommended"
  ],
  "parser": "@babel/eslint-parser",
  "parserOptions": {
    "ecmaVersion": 12,
    "requireConfigFile": false
  },
  "rules": {
    "comma-dangle": [
      "error",
      {
        "arrays": "always-multiline",
        "objects": "always-multiline",
        "imports": "always-multiline",
        "exports": "always-multiline",
        "functions": "always-multiline"
      }
    ],
    "eqeqeq": "off",
    "no-case-declarations": "off",
    "import/named": "error"
  }
}

package.json:

{
 "devDependencies": {
    "@babel/core": "^7.17.10",
    "@babel/eslint-parser": "^7.17.0",
    "@babel/preset-env": "^7.17.10",
    "babel-jest": "^28.1.0",
    "eslint": "^8.15.0",
    "eslint-config-standard": "^17.0.0",
    "eslint-plugin-curry": "^0.1.0",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-jest": "^26.2.2",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^6.0.0",
    "jest": "^28.1.0",
  }
}

export.js (in /lib/export:

exports.someMethodName = () => {};

consuming code:

const { someMethodNameNotCorrect } = require('../lib/export');

exports.SomeOtherThing = () { someMethodNameNotCorrect;

I'd expect a import/named error in the consuming code; however this passes linting. Other than changing to ESM, is there an option that throws an error here?

1 reply
Piyush Aggarwal
@ThePiyushAggarwal

I am using eslint-config-react-native-community.

I had prettier extension installed in VS Code. I want my extension to decide things for me everywhere except the react native project I am working on.

So, I added a file name .prettierignore in the root folder and added an asterisk inside. I am not sure if this is the right way to do it.

Earlier, I was getting errors from eslint like "react/react-in-jsx-scope", "semi" and "prettier/prettier". Now, there is no "prettier/prettier" errors. Did I do something wrong? Please help me to separate my extension prettier and the prettier I installed with

npm i -D eslint prettier @react-native-community/eslint-config
Piyush Aggarwal
@ThePiyushAggarwal

I am using eslint-config-react-native-community.

I had prettier extension installed in VS Code. I want my extension to decide things for me everywhere except the react native project I am working on.

So, I added a file name .prettierignore in the root folder and added an asterisk inside. I am not sure if this is the right way to do it.

Earlier, I was getting errors from eslint like "react/react-in-jsx-scope", "semi" and "prettier/prettier". Now, there is no "prettier/prettier" errors. Did I do something wrong? Please help me to separate my extension prettier and the prettier I installed with

npm i -D eslint prettier @react-native-community/eslint-config

Got the answer right after this. So, I just disabled the prettier extension for the workspace I was working on. And voila it worked. .prettierignore was disabling both the extension as well as the local prettier I installed with eslint.

Piyush Aggarwal
@ThePiyushAggarwal
Sorry, I don't want to disable the prettier. How will I work? Question still stands.
Piyush Aggarwal
@ThePiyushAggarwal
So, at the end I have edited .eslintrc file to have rules for prettier/prettier and .prettierrc file to have the same rules as well, for the extension.
Kyle Pittman
@monkpit
image.png
How do I browse documentation for eslint v7.32.0? I only see 8 on the dropdown in the docs
Kyle Pittman
@monkpit

How do I browse documentation for eslint v7.32.0? I only see 8 on the dropdown in the docs

Are docs for old versions broken? 7.32 is only about 1 year old now.

Jordan Harband
@ljharb
the age isn't really relevant; v7 was EOL once v8 came out
Kyle Pittman
@monkpit
Ok, but is the version browser for the documentation page broken?
Jordan Harband
@ljharb
seems like it might be
i'd expect the dropdown to contain every past version
Kyle Pittman
@monkpit
Me too :(
Jordan Harband
@ljharb
i'd file an issue
Kyle Pittman
@monkpit
Alrighty will do. thx
Ahmed Saad
@ahmedsaad313
image.png
Hey new to eslint. I set up my .eslintrc congif file and ran npm run lint and got this error
any do i need to install anything before adding these extensions
Martin Törnqvist
@toerndev
@ahmedsaad313 Have you installed eslint-plugin-react-hooks? It sounds like that library is missing.
I think loading the rule import/no-cycle is overriding my settings['import/resolver'] somehow. I have a settings['import/resolver'].typescript, and if I activate no-cycle, some rules behave differently as if they're failing to resolve correctly.
Looking at the source at rules/no-cycle.js, it does import `eslint-module-utils/resolve and does some tricks with that. But I can't see why it would affect other rules.
Martin Törnqvist
@toerndev
Processing a file with no-cycle (which I guess prefers the node resolver) seems to change what type info is available to other rules. For instance restrict-plus-operands comes alive when I activate no-cycle, finding several variables with unclear types. Some of those lint errors are actually legit, while others are from broken type inference. Without no-cycle, I don't get any of those errors. This is a monorepo with the typescript resolver.
Jordan Harband
@ljharb
@toerndev what is the object ordering of the import/resolver settings
make sure node is there and is also last
Martin Törnqvist
@toerndev

@ljharb Aha, no I had them ordered alphabetically. It doesn't seem to make a difference though.
The structure is (hope this makes sense):
.eslintrc.settings['import/resolver'].typescript.project: ['tsconfig.eslint.json']
.eslintrc.overrides: [<files regex for eachPackage>].settings.['import/resolver'].typescript.project = ['./' + eachPackage + '/tsconfig.json']

All these tsconfig.json extend a tsconfig.base.json.
As you suggested, I added next to "typescript" in each override, below typescript: node.paths = ['./' + eachPackage + '/src'].

Jordan Harband
@ljharb
if you're still having trouble, please file an issue on eslint-plugin-import, and i can help you work through it
Martin Törnqvist
@toerndev
Thanks, I will.
Martin Törnqvist
@toerndev
@ljharb Sorry but I am also wondering: no-cycle and order are super slow. Would you be interested in PRs that optimize them (assuming I could find something), if they use more memory and/or cache things at module scope? Or are there strict guidelines for how to use memory, meaning that these tasks are unsuitable for newcomers?
Jordan Harband
@ljharb
the first rule that you use that has to build a dependency map will always be the slowest - so if you disabled those two, and enabled another one that requires the dep map, it'd be slow too
i'm always happy to accept PRs that improve perf without sacrificing correctness
but i would suggest looking at the "help wanted" issues long before trying to tackle large-scale performance things :-)
Martin Törnqvist
@toerndev
I understand, good to know
virtual
@EasyProg
Hey guys had some problem with updating to 8.19.0 from 7.5 here is error when using eslint command in my app ESLint couldn't find the config "airbnb/hooks" to extend from. Please check that the name of the config is correct. what can be outcomes?
Jordan Harband
@ljharb
make sure you have an updated version of eslint-config-airbnb
Sherlock-Yao-GZ
@Sherlock-Yao-GZ
image.png
image.png

"lint-staged": {
".{ts,tsx}": [
"node --max_old_space_size=8192 ./node_modules/.bin/eslint --fix --color --cache --quiet"
],
"
.{js,jsx,mjs,mjsx,cjs,cjsx}": [
"node --max_old_space_size=8192 ./node_modules/.bin/eslint --fix --color --cache --quiet"
]
}

throw an Error SyntaxError: missing ) after argument list