Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:40
    yeonjuan edited #12659
  • 15:40
    yeonjuan synchronize #12659
  • 15:31
    shanimal closed #12658
  • 15:31
    shanimal commented #12658
  • 15:25
    eslint[bot] labeled #12661
  • 15:25
    yeonjuan opened #12661
  • 13:47
    adamklepacz commented #12637
  • 13:47
    adamklepacz closed #12637
  • 05:59
    mdjermanovic labeled #12660
  • 05:59
    mdjermanovic labeled #12660
  • 05:59
    mdjermanovic unlabeled #12660
  • 05:59
    mdjermanovic labeled #12660
  • 05:59
    eslint[bot] labeled #12660
  • 05:59
    mdjermanovic opened #12660
  • 05:53

    mdjermanovic on no-unreachable-loop

    New: Add no-unreachable-loop ru… (compare)

  • Dec 12 22:43
    eslint[bot] commented #12548
  • Dec 12 22:43
    eslint[bot] labeled #12548
  • Dec 12 22:43
    eslint[bot] closed #12548
  • Dec 12 22:43
    eslint[bot] commented #12549
  • Dec 12 22:43
    eslint[bot] labeled #11716
Roman
@moltar
Can I setup a different parser for specific files? E.g. only use typescript parser for *.ts files?
Jordan Harband
@ljharb
@drkstersetweets_twitter "compiled successfully" isn't something eslint reports. are you running eslint via the command line? no other method is important until that works.
Derek Leung
@drkstersetweets_twitter
@ljharb Oh interesting, "Compiled successfully" must be a TSLint-only thing then. I'm migrating from TSLint to ESLint, and I set up my eslintrc.js file using the tslint-to-eslint-config package associated with the typescript-eslint repo, and some manual setup.
Jordan Harband
@ljharb
i'd start by disabling your eslint-plugin-tslint thing, and get all those things working
then add in the new plugino
Derek Leung
@drkstersetweets_twitter
I could have missed a step somewhere, a lot of packages are involved at the typescript-eslint monorepo and I tried to put all the instructions together
Derek Leung
@drkstersetweets_twitter
When I attempt to run ./node_modules/.bin/eslint --init at the ESLint Getting Started docs, I get -bash: ./node_modules/.bin/eslint: No such file or directory. This is after checking that my yarn.lock has the eslint package, and running yarn install to install all dependencies in case
Jordan Harband
@ljharb
are you in your repo root, where package.json is?
also are you using windows?
Derek Leung
@drkstersetweets_twitter
@ljharb My folder is where package.json is, and where there's a node_modules folder at the first level. It's not the repo root though. I'm using a Mac
Jordan Harband
@ljharb
ok, that should still be fine (altho generally you want all those things in the repo root)
i don't use yarn, but i'd expect npm install to put eslint in the .bin folder
Derek Leung
@drkstersetweets_twitter
Okay, thanks for the feedback! You did confirm some things for me
Has anyone installed ESLint with yarn, or done a TSLint to ESLint migration?
Jesse Jackson
@jsejcksn_gitlab

How to understand the source of a linting error?

I have the following code in a project bootstrapped with create-react-app, but which is extended from multiple configs:

const objectFromNestedEntries = arrayOfEntries => {
  if (!Array.isArray(arrayOfEntries)) return arrayOfEntries;
  const obj = {};
  for (const [key, value] of arrayOfEntries) {
    obj[key] = objectFromNestedEntries(value);
  }

  return obj;
};

and I am getting linting errors that key and value are defined, but never used no-unused-vars. However, that's clearly not the case, so how can I determine which line from which config is causing this?

Jordan Harband
@ljharb
there's an open bug on eslint about that one
Jesse Jackson
@jsejcksn_gitlab
@ljharb Thanks for responding. I am still wanting to understand how to determine the source of errors when multiple extends are used.
and can you link to the issue or provide the issue number?
Jordan Harband
@ljharb
the source is the code; as for which config originated it, there’s no easy way, but it doesn’t really matter - all you need to do is override the rule in your config if you want
i don’t have it off hand, sorry
Jesse Jackson
@jsejcksn_gitlab
Jordan Harband
@ljharb
yep, looks right to me too!
Ilya Volodin
@ilyavolodin
Haci Kale
@HaciKale
Does anybody have a good article about how to set up Eslint with Create React App, React and Airbnb,
I'm about to go mad with these settings
RedstoneMiner27
@RedstoneMiner27
when I go to the global eslint installation, and then in the 'conf' folder, there are two files named 'eslint-all' and 'eslint-recommend'. which one does eslint use for default? or is it on some other path?
RedstoneMiner27
@RedstoneMiner27
INACTIVEEE
Jordan Harband
@ljharb
@redstoneminer27 eslint uses no config by default. also why do you have a global installation at all
Luiz Felipe Gonçalves
@lffg
Is it possible to use the ESLint API in the front-end?
Ilya Volodin
@ilyavolodin
Yes, it is, although it's not officially supported: https://eslint.org/demo
Kyoungtaek Koo
@boxersb
@platinumazure thanks :D
Thomas Tortorini
@mr21
Hi all :)
Is there a rule or a setting to prevent turning off rules with eslint-disable-line?
EDIT: I found it, it was "noInlineConfig": true, :)
Marko Benigar
@markobenigar
hi there
Screen Shot 2019-09-16 at 4.24.40 PM.png
Can you help me fix this error, it doens't want to commit/push because of it
Kevin Partington
@platinumazure
@markobenigar That doesn't look like an ESLint issue, so I'm not sure how to help
Jesse Jackson
@jsejcksn_gitlab

Has anyone ever wanted a smarter version of max-len?

For example, if I enable the option ignoreStrings, and I have a 200-character line with a single string consisting of a single character, the whole line gets ignored. But that seems unreasonable. There has to be a better way to do it.

Jordan Harband
@ljharb
i used to want that. but then i realized that max-len is a terrible rule, and rules should target patterns instead of spray-and-pray with a line length limit.
Jesse Jackson
@jsejcksn_gitlab
@ljharb Is there a better solution than prettier? When dealing with opinions, I prefer my own. prettier-eslint used to be supported, but is sadly not any more.
Jordan Harband
@ljharb
if you want to use prettier, only use it via eslint-plugin-prettier; iow, if you disagree with something prettier has nonconfigurable, you're SOL.
Jesse Jackson
@jsejcksn_gitlab
:confounded:
Jordan Harband
@ljharb
prettier is fast, and has better autoformatting than a small number of eslint rules, but otherwise i'm not a fan - eslint can do 99% of what prettier does, and imo theoretically better because of prettier's line-length-based algorithm
so what i'd prefer to do is pursue better autofixes in eslint rules so that prettier can become 100% unnecessary ¯\_(ツ)_/¯
prettier-eslint is a good hack, but as you said, it's not supported anymore anyways
Jesse Jackson
@jsejcksn_gitlab

I agree with all of this. Is there a project which exists to aid with formatting based on eslint rules? Like a shared config that duplicates the prettier functionality with as much coverage as possible?

There are just certain ESLint rules that can definitely auto-fix my code given some criteria, but I don't really know where to begin to write a plugin in order to make that happen. I'm happy with the way prettier-eslint did it.

Without the input preferences, ESLint can't auto-fix and I'm left with manually having to format my code.
Jordan Harband
@ljharb
@jsejcksn_gitlab i mean, https://npmjs.com/eslint-config-airbnb is the most used one by any metric
both are based off the same style guide, which reflects the most common conventions in the overall ecosystem.
or at least, almost entirely reflects :-)