Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 18:12
    CharlyPoppins commented #12584
  • 16:46
    matmalkowski commented #12570
  • 16:38
    kaicataldo commented #12582
  • 16:32
    kaicataldo commented #12582
  • 16:29
    kaicataldo labeled #12582
  • 16:29
    kaicataldo unlabeled #12582
  • 16:26
    kaicataldo labeled #12586
  • 16:21
    matmalkowski edited #12587
  • 16:21
    matmalkowski synchronize #12587
  • 16:17
    eslint[bot] labeled #12587
  • 16:17
    matmalkowski opened #12587
  • 12:14
    arthurdenner commented #12377
  • 11:09
    Redsandro closed #12586
  • 11:09
    Redsandro commented #12586
  • 10:48
    g-plane labeled #12586
  • 10:48
    g-plane unlabeled #12586
  • 10:48
    g-plane unlabeled #12586
  • 10:48
    g-plane commented #12586
  • 09:48
    Redsandro labeled #12586
  • 09:48
    Redsandro labeled #12586
Chris Greenwood
@otang
Thank you I will take a look
Derek Leung
@drkstersetweets_twitter
Hi guys. Is ESLint enabled the moment you add values to the extends or rules keys? I ask because I installed eslint-plugin-tslint to run an instance of tslint inside eslint, handling TSLint rules with no ESLint equivalents yet, but when I test if ESLint is on by enabling an ESLint rule that TSLint won't catch, it doesn't give me an error for violating that rule.
Jordan Harband
@ljharb
yes, nothing will warn unless a rule is enabled
installing things does nothing
(by itself)
Derek Leung
@drkstersetweets_twitter
Oops maybe I was unclear, I've definitely added keys to extends and rules, including an ESLint rule that TSLint won't catch, but ESLint isn't responding to my test. My test was adding no-debugger to the ESLint rules key, and turning off no-debugger in TSLint, and putting a debugger; statement in my code. It just tells me "Compiled successfully," neither TSLint nor ESLint catch it now. What reasons might stop ESLint from linting?
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?
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