Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 16:43
    mdjermanovic commented #12470
  • 16:43
    octogonz labeled #12473
  • 16:43
    octogonz labeled #12473
  • 16:43
    octogonz opened #12473
  • 16:16
    mdjermanovic labeled #12470
  • 16:15
    mdjermanovic commented #12470
  • 15:17
    platinumazure commented #12414
  • 15:17
    platinumazure closed #12163
  • 15:17

    platinumazure on master

    Update: enforceForOrderingRelat… (compare)

  • 15:17
    platinumazure closed #12414
  • 15:03
    yeonjuan synchronize #12472
  • 13:49
    yeonjuan synchronize #12472
  • 13:46
    yeonjuan synchronize #12472
  • 13:36
    eslint[bot] labeled #12472
  • 13:36
    yeonjuan opened #12472
  • 13:30
    mysticatea labeled #12457
  • 13:29
    mysticatea unlabeled #12457
  • 13:28
    mysticatea commented #12457
  • 12:51
    ilyavolodin unlabeled #12410
  • 12:50
    ilyavolodin commented #12471
Jordan Harband
@ljharb
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 :-)
Jesse Jackson
@jsejcksn_gitlab
@ljharb Thanks. Peripherally-related: Is there a "serial auto-fix" feature for ESLint? In VS Code, I often have to hit cmd-S multiple times to get to the end of the auto-fixes.
Jordan Harband
@ljharb
not that i know of. it just takes multiple passes sometimes.
Ilya Volodin
@ilyavolodin
@jsejcksn_gitlab I think that's vscode implementation issue. ESLint does multipass autofix (i.e. it will keep fixing issues until either none are left, or the number of errors doesn't decrease).
Jordan Harband
@ljharb
ah, gtk. best to file a vscode issue on that one (i've run into it too)
Ilya Volodin
@ilyavolodin
But that's done through CLI. And I think vscode plugin uses API, which doesn't do multipass by default
And in terms of prettier capabilities, ESLint doesn't accept autofixes that have potential of breaking user's code (or even potentially breaking code), but those are guidelines only for core rules, plugins can do whatever they want. So it would be entirely possible to create a plugin that will contain a set of rules that can be autofix to provide parity with prettier
The only one that might cause major trouble is line-wrapping
Jordan Harband
@ljharb
afaik prettier doesn't have that potential in any of its formatters
since the AST remains the same
Ilya Volodin
@ilyavolodin
Yeah, sorry, I don't know much about prettier, I find idea of somebody rewriting my code constantly unappealing
Jordan Harband
@ljharb
lol i mean, that's autofixing too