by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 14:45
    sindresorhus closed #482
  • 14:45
    sindresorhus commented #482
  • 13:00
    saneef opened #482
  • May 22 08:55
    matt81093 commented #481
  • May 21 10:52
    sindresorhus commented #473
  • May 20 19:24
    matt81093 commented #481
  • May 20 19:23
    matt81093 commented #481
  • May 20 08:32
    matt81093 commented #481
  • May 19 09:18
    sindresorhus commented #481
  • May 19 07:50
    matt81093 edited #481
  • May 19 07:50
    matt81093 edited #481
  • May 19 07:49
    matt81093 edited #481
  • May 19 07:48
    matt81093 opened #481
  • May 17 20:58
    ryparker commented #394
  • May 17 06:13
    sindresorhus commented #479
  • May 16 18:21
    tjrgg commented #473
  • May 16 18:08
    tjrgg opened #480
  • May 16 16:26
    tjrgg commented #479
  • May 16 12:13
    coreyfarrell commented #477
  • May 16 07:33
    sindresorhus labeled #479
Pierre Vanduynslager
@pvdlg
Yes :)
Sindre Sorhus
@sindresorhus
Good to hear you found a nice company :)
Sindre Sorhus
@sindresorhus
👌
John Mars
@j0hnm4r5
Hey, I'm not sure if this is an issue with VSCode, the VSCode plugin, or XO itself, but adding a "globals": {} to my config seems to break everything.
When it's not there, everything works as-expected, and when it is, VSCode pops up a little error: def.split is not a function, and the linting stops.
It looks like the same error is happening in Standard: standard/standard#1047
John Mars
@j0hnm4r5
Ah hah! Globals needs to be an array, not an object like in ESLint.
That also fixed another issue I was having with "envs".
Might I suggest making it clearer in the documentation that the formatting for some of the config is the same as ESLint ("rules: {}"), and some is not ("envs": [])?
Or, even better, make all of the config match the ESLint format.
As-is, I can't define my globals to be rewriteable or not, since they can't be true/false.
Jorge Gonzalez
@jorgegonzalez
xojs/xo#326 Added TypeScript and Flow support 🙌
Sindre Sorhus
@sindresorhus
@jorgegonzalez Awesome ✨
Jorge Gonzalez
@jorgegonzalez
sindresorhus/eslint-formatter-pretty#31
Maybe there's a way to change this that I don't know about
Jorge Gonzalez
@jorgegonzalez
Would appreciate support for this issue
prettier/prettier#4845
Max
@maxfi

Hi all. In meteor it's common to do import './some-template.html'but this causes an Imported module should be assigned import/no-unassigned-import error.

I've already got a rule override for this rule to allow meteor packages (with only side-effects) to work:

  "xo": {
    "prettier": true,
    "semicolon": false,
    "space": 2,
    "settings": {
      "import/resolver": "meteor"
    },
    "rules": {
      "import/no-absolute-path": 0,
      "import/no-unassigned-import": ["error", {
        "allow": ["meteor/*:*"] // this allows: `import 'meteor/meteorhacks:unblock'`
      }]
    }
  }

I was hoping to simply add *.html to the allow section but it still throws the same error. Any ideas?

Max
@maxfi
Derp. I got the glob wrong. It should be "**/*.html". I put together a quick overview of this and some other helpful XO settings for meteor here: https://github.com/xojs/xo/issues/262#issuecomment-406865385. If you guys know of any other meteor specific settings please let me know. Cheers!
Corey Farrell
@coreyfarrell
does anyone know of a rule that I can enable to make xo warn about unused ES6 exports? my project is an application so this rule could help find dead code.
Sindre Sorhus
@sindresorhus
@coreyfarrell benmosher/eslint-plugin-import#186
Corey Farrell
@coreyfarrell
@sindresorhus thanks for the link!
Sindre Sorhus
@sindresorhus
// @pvdlg
Pierre Vanduynslager
@pvdlg
👍
Maxime HEBRARD
@mhebrard
hello here: I use XO with atom editor on js and react projects without issue :). now I try to use the linter on a typescript project (shell app created with angular CLI) but the linter seams not be triggered :-/. could I find some help over here ?
Here a part of my package.json
"devDependencies": {
    "eslint": "^5.3.0",
    "eslint-config-xo": "^0.24.1",
    "eslint-config-xo-typescript": "^0.1.0",
    "eslint-plugin-typescript": "^0.12.0",
    "tslint": "~5.9.1",
    "typescript": "^2.9.2",
    "typescript-eslint-parser": "^17.0.1",
    "xo": "^0.21.1"
  },
  "xo": {
    "extends": "xo-typescript",
    "space": 2,
    "env": [
      "browser",
      "node"
    ]
  }
Pierre Vanduynslager
@pvdlg
what do you mean the linter is not triggered?
In Atom? Or when you run xo in the root of the repo?
Maxime HEBRARD
@mhebrard
In Atom. with a react project I get nice notification of errors when I am typing my code (underline red + list and link of lint rules at the bottom)... with a typescript project, I do not have these "in editor, live, linter rules error...
Itai Steinherz
@itaisteinherz
Hi there, is there any way to define an env (e.g. mocha) in a specific file instead of in package.json? I think I've seen this done before but I'm not sure how.
Sindre Sorhus
@sindresorhus
@itaisteinherz No, XO config can only be defined in package.json. Why do you need to define it outside package.json?
Itai Steinherz
@itaisteinherz

@sindresorhus I have a Jest test file that uses it, and unless I define it at the top of the file using

/* global it */

XO throws an error.

Sindre Sorhus
@sindresorhus
Ah ok. I misunderstood your question. Yes, use you use /* eslint-env jest */ at the top of the file or use the overrides feature to only target test files: https://github.com/xojs/xo#config-overrides
Itai Steinherz
@itaisteinherz
Awesome, thanks!
kivi
@kivi
I am in trapped in some kind of configuration loop. I have people in my node.js project, that are non developers, but like to code. So I thought I give xo a try. Now How can I use a linting enabled Vscode based on let's say xo rules that can later be adjusted with .eslintrc - atm I am pretty indifferent what rules to use, Important is that my fellows use a linter and something that fixes/make the code prettier - therefore I am trying to get eslint plugin in vscode running with prettier, that handle corrections on save. But prettier or eslint wouldn't use the xo rules with zero config
Or maybe xo is not what I am looking for.
Sindre Sorhus
@sindresorhus
@kivi If you use Prettier, you need to enable the prettier XO option: https://github.com/xojs/xo#prettier
You don't adjust the rules with .eslintrc, but rather in the xo.rules config in package.json.
You can also use shareable ESLint config if you need to share the rule customizations. See the extends option in the XO docs.
Neal
@nstanard
Can't seem to get XO or SublimeLinter/XO to work in Subime - nor VSCode + linter-xo ... anybody have any suggestions?
kivi
@kivi

@sindresorhus

@itaisteinherz No, XO config can only be defined in package.json. Why do you need to define it outside package.json?

If you work in a team there might be other linters cleaning the code. Most probably all developers (and none developers) use an editor, which is able to workd with .editorconfig. So why not define the linting params in .editorconfig?

LitoMore
@LitoMore
@kivi EditorConfig only support these options. We should not add any unrelated options to the .editorconfig file.
Joe Becher
@drazisil
I'm trying to get XO to honordisable-line. I'm getting 'no-unused-vars' rule is disabled but never reported. (eslint-comments/no-unused-disable)XO(eslint-comments/no-unused-disable)
Adam Avenir
@adamavenir

I'm trying out xo and running into a challenge where xo's prettier is calling errors things that stock prettier says are fine. (btw I respect your time and am happy to make a donation somewhere as a thanks for help supporting me figuring this out.)

  src/components/TeamList.js:2:9
  ✖   2:9   Replace ·graphql,·StaticQuery· with graphql,·StaticQuery                                                                                                                             prettier/prettier
  ✖  11:22  Replace ·fields:·{·collection:·{·eq:·"bios"·}·}· with fields:·{collection:·{eq:·"bios"}}                                                                                             prettier/prettier
  ✖  12:20  Replace ·orderASCfields:·frontmatter___name· with orderASCfields:·frontmatter___name                                                                                         prettier/prettier

It's hard to understand that, but basically, it wants to remove the wrapping braces on the named import (e.g. it passes just fine if I do import graphql from 'gatsby' etc instead, which is obviously wrong) and it similar wants me to remove braces in the graphql query.

isidorosp
@isidorosp

Ah ok. I misunderstood your question. Yes, use you use /* eslint-env jest */ at the top of the file or use the overrides feature to only target test files: https://github.com/xojs/xo#config-overrides

Hi guys! I'm trying to apply the latter approach as I'm getting lint errors in my test files for things like test and expect. I've added the following to my package.json but it appears to not work. Any tips?

"xo": {
    "space": 2,
    "prettier": true,
        "overrides": [
            {
                "files": "/src/__tests__/",
                "env": "jest"
      }
    ],
...

EDIT:
Dumb mistake on my part, needed to specify ./src/... and not /src/... Leaving this for shaming/posterity

isidorosp
@isidorosp
also tried /__tests__/*.* Ideally i'd also like to include subdirs as well