def.split is not a function
, and the linting stops.
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?
"**/*.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!
"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"
]
}
xo
in the root of the repo?
/* 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
prettier
XO option: https://github.com/xojs/xo#prettier
.eslintrc
, but rather in the xo.rules
config in package.json.
extends
option in the XO docs.
@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?
.editorconfig
file.
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 ·order:·ASC,·fields:·frontmatter___name· with order:·ASC,·fields:·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.
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