Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:17
    eltociear synchronize #14589
  • 02:14
    eltociear edited #14589
  • 01:12

    eslintbot on master

    Sponsors: Sync README with webs… (compare)

  • 00:38
    eslint-github-bot[bot] labeled #13840
  • 00:38
    eslint-github-bot[bot] locked #13840
  • May 14 17:52
    eslint-github-bot[bot] labeled #14589
  • May 14 17:52
    eltociear opened #14589
  • May 14 14:48
    aladdin-add edited #14588
  • May 14 10:59
    boutahlilsoufiane review_requested #14238
  • May 14 08:55

    mysticatea on class-fields

    update no-eval update operator-assignment (tes… update operator-linebreak and 2 more (compare)

  • May 14 06:23
    aladdin-add labeled #14588
  • May 14 06:23
    aladdin-add labeled #14588
  • May 14 06:23
    aladdin-add unlabeled #14588
  • May 14 06:16
    aladdin-add labeled #14588
  • May 14 06:16
    aladdin-add labeled #14588
  • May 14 06:16
    aladdin-add labeled #14588
  • May 14 06:16
    aladdin-add opened #14588
  • May 14 00:38
    eslint-github-bot[bot] labeled #13843
  • May 14 00:38
    eslint-github-bot[bot] locked #13843
  • May 13 13:54
    snitin315 edited #14354
lordkyzr
@lordkyzr
@not-an-aardvark reading the docs real quick it does appear to be what I am looking for. I will test tomorrow when I get in. Thanks for the hint.
Epaminaidos
@Epaminaidos
@platinumazure I found a solution: The block-scoped-var rule included in this plugin: https://github.com/mysticatea/eslint-plugin#eslint-plugin-mysticatea
It does exactly, what I expect from a "block-scoped-var"-rule :)
Victor Hom
@VictorHom
is there a rule that can enforce a space before a ternary "?" and a space before and after the ":" ?
martskins
@martskins
space-infix-ops ?
Clément Pit-Claudel
@cpitclaudel
Hi eslint folks. Quick question about eslint --format=checkstyle: is this option expected to produce pure XML in all cases? Or is it by design that some messages are still printed as plaintext to stderr? We've been bitten by this multiple times in Flycheck, and we're not sure whether it's an eslint bug to be reported, or a design choice that we need to work around on our side (see flycheck/flycheck#1350 for a concrete example)
Victor Hom
@VictorHom
sweet @martskins thanks I knew it had to be a thing :tada:
Sam Ferrell
@samcf
Hello. New here. Wondering if it's feasible to write an ESLint plugin to detect "bad" imports, such as foo.js importing from bar.js where bar.js is not some place you would sensibly import from foo.js. It's technically a correct and working import, but considered bad design in our project. Does that make sense?
Teddy Katz
@not-an-aardvark
It seems like that would be possible as long as you can tell whether it's a "bad" import from the filename
Sam Ferrell
@samcf
@not-an-aardvark Sort of ... using a more specific use case, the "Users Page" should never import from the "Statistics Page" and vice versa, where the file org is like src/pages/users and src/pages/statistics
However files within the users page should obviously be allowed to import from its own page
Just trying to get a feel for whether thats feasible or not before I dive into it.. never written an ESLint plugin before
Teddy Katz
@not-an-aardvark
Yes, that seems like it should be feasible
Sam Ferrell
@samcf
Neat, thanks!
Kevin Partington
@platinumazure
@cpitclaudel I would expect stdout to be valid XML (though do please report an issue if you see otherwise), while stderr would not conform to any formatter. On a console, stdout and stderr are interleaved, but in a program that spawns a subprocess, it should track stdout and stderr separately. (I believe our lint formatter output should be to stdout.) So at first glance, it seems like a design issue on your end... But please let me know if I'm missing something.
Benjamin R Gibson
@brgibson
Hi all, I wanted to make sure I have gotten the process right for re-submitting after my first review eslint/eslint#9506. I realized a little late not to amend my commit. After the next round of feedback, I will leave it as a second commit.
Ilya Volodin
@ilyavolodin
@brgibson amending is fine, it's not necessary anymore, since we always squash commits before merging, but it doesn't hurt.
Btw, just so you'd be aware, we require 3 +1s from the core team, as well as one champion, so it might take a little while for this proposal to be accepted
Benjamin R Gibson
@brgibson
Thanks @ilyavolodin. Will those discussions happen in the pull request?
Ilya Volodin
@ilyavolodin
Yes, they usually happen either in PR directly, or if PR is fixing an existing issue, they will happen in the issue
Benjamin R Gibson
@brgibson
Sounds good. Thanks again.
Clément Pit-Claudel
@cpitclaudel
@platinumazure We currently handle stderr and stdout together, simply because we've not needed to separate them for any other linter. Some send error lists to stderr, and some to stdout, and others mix depending on the type of error. The real question is: what do you intend tools to do with eslint's stderr output? Ignore it, or somehow print it, or something else?
@platinumazure What other checkers tend to do is report issues that are not directly connected to the current file as happening on line 1, column 1 (of the current file). It ties in nicely with the existing interface between linters and UIs (the linter produces a list of issues, the UI displays them). The problem with eslint's stderr output at the moment is that we don't have any metadata associated with it: when we see a message, we don't know whether it's a bug to be reported (we had two such cases), or an informational message to report to the user (we had one such case), or something else (in fact, we don't even know how to separate consecutive messages on stderr)
yuta0801
@yuta0801
I can't use standard
ESLint couldn't find the plugin "eslint-plugin-standard".
Kevin Partington
@platinumazure
@cpitclaudel We'll report on line 1 column 1 for files that fail to parse and other file-level issues, but any issues with configuration tend to go to stderr. I would honestly say your tool should probably be able to distinguish which tools tend to write to stdout, which to stderr, and which a mix, and handle them accordingly without having everything be interleaved. That seems like a design flaw. As for the fact that stderr messages are not obviously meant to be user errors vs bugs, I can see how that can happen, but I'm also not really sure what we can do about them without concrete suggestions for improvement.
Doyle Timberlake
@Timbercakes
Hello, I am receiving the error "unexpected black statement surrounding arrow body with the following snippet .map((school) => { return $filter('machine')(school.district); })
Not quite sure how to refactor this to get past the linter
Kevin Partington
@platinumazure
@Timbercakes You can use the concise arrow body syntax: .map((school) => $filter('machine')(school.district))
Doyle Timberlake
@Timbercakes
@platinumazure I thank you kindly sir.
Kevin Partington
@platinumazure
:+1:
Ilya Volodin
@ilyavolodin
Jed Fox
@j-f1
Hi! I’ve opened a PR (github/explore#77) adding information to the page at https://github.com/topics/eslint. How does the information I’ve provided look?
Teddy Katz
@not-an-aardvark
:+1:
Jonathan Pool
@jrpool
I am puzzled by an error message resulting from npm test. I can’t find a copy of that message anywhere in the project. I could use a hint about how to diagnose such a message. Here it is:
Error: rule-tester:
Configuration for rule "object-property-newline" is invalid:
Value "[object Object]" should NOT have additional properties.
Jonathan Pool
@jrpool
@jrpool I have diagnosed the above error message. It means that an options object specified in a test may not contain an option that the rule’s options object is not defined as having. But it is still a puzzle to me that the text of this message is not findable anywhere in the project code.
Jordan Harband
@ljharb
@jrpool it wouldn't be in project code; the english in the message says the configuration of a rule is invalid; if you grep for the rule name alone, you'd fine it in your eslint config.
there is a bug tho; "[object Object]" appearing somewhere means something is stringifying an object for no good reason
Sahil Prajapati
@sahil290791

Hello for weird reason eslint has stopped running from command line. These are the versions:

"devDependencies": {
    "babel-eslint": "7.2.2",
    "eslint": "3.19.0",
    "eslint-plugin-babel": "^4.1.2",
    "eslint-plugin-import": "^2.2.0",
    "eslint-plugin-react": "^7.0.0"}

I keep getting this error if I run eslint src/js/**/*.js:

Oops! Something went wrong! :(

ESLint couldn't find the plugin "eslint-plugin-babel". This can happen for a couple different reasons:

1. If ESLint is installed globally, then make sure eslint-plugin-babel is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.

2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm i eslint-plugin-babel@latest --save-dev

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

What can be the issue?

Jonathan Pool
@jrpool
@ljharb Thanks for your reply. The text I searched for is “should NOT have additional properties”. I expected to find it somewhere in the project code, since the project is ESLint itself. (I neclected to say that.)
Teddy Katz
@not-an-aardvark
I think that error message is coming from https://github.com/epoberezkin/ajv, which we use to validate rule configs against JSON schemas.
Usually, if you encounter that error it means that you have attempted to use a rule configuration which is not allowed by the schema for that rule
Sandro Scheiwiller
@sandrosc
Hey guys, is there a rule that limits the length of arrow functions?
Sahil Prajapati
@sahil290791
Is there any tool with which I can validate the eslintrc schema?
Benny Powers
@bennypowers
hey there. eslint complains about unused var foo on line one of this case:
const foo = {};
function bar(foo = foo) {
  const baz = foo.getBaz();
  return baz.something();
}
Saul Hardman
@saulhardman
Hi, here for some help. I'm looking to target tagged and non-tagged template literals in the ignoreNodes option of the indent rule: "indent": ["error", "tab", { "ignoredNodes": ["?"] }]
Would anyone be able to point me in the right direction?
Kevin Partington
@platinumazure
@bennypowers It's only used once in the RHS of a default parameter, so you should be able to inline it... I think.
Teddy Katz
@not-an-aardvark
@sahil290791 You could probably run CLIEngine.executeOnText on an empty string and see if an error gets thrown
Jonathan Pool
@jrpool

@not-an-aardvark: Thanks for the hint. I have reproduced the error by altering the name of an object option in a rule test, changing the name to something that is not the name of an object option. Testing then results in 1 failure, with this error message:

     Error: rule-tester:
    Configuration for rule "object-property-newline" is invalid:
    Value "[object Object]" should NOT have additional properties.

      at validateRuleOptions (lib/config/config-validator.js:9:4426)
      at Object.keys.forEach.id (lib/config/config-validator.js:9:5616)
      at Array.forEach (<anonymous>)
      at validateRules (lib/config/config-validator.js:9:5564)
      at Object.validate (lib/config/config-validator.js:9:8790)
      at runRuleForItem (lib/testers/rule-tester.js:9:9345)
      at testInvalidTemplate (lib/testers/rule-tester.js:9:11587)
      at Context.RuleTester.it (lib/testers/rule-tester.js:9:17221)

The message and stack trace confuse me. I am not finding references that I can follow to lines of code. lib/config/config-validator.js contains error messages similarly constructed (“Configuration for rule . . . is invalid:”), but not with anything resembling “Value . . . should NOT have additional properties”.

Ilya Volodin
@ilyavolodin
@jrpool The second part of the message is coming from JSON-schema validation library
So you wouldn't find it in our code