Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default spacing rule #8

Closed
GeorgeGkas opened this issue Feb 7, 2019 · 1 comment
Closed

Change default spacing rule #8

GeorgeGkas opened this issue Feb 7, 2019 · 1 comment

Comments

@GeorgeGkas
Copy link

Using xo with eslint-config-xo-typescript and @typescript-eslint/eslint-plugin without eslint, I came up with an issue. The default spacing rule set by eslint-config-xo-typescript is tab indentation. If I am going to specify space: true in xo config, I get the following error:

src/index.ts:2:1
✖  2:1  Expected indentation of 1 tab but found 2 spaces.  @typescript-eslint/indent

Here is the xo configuration object:

"xo": {
  "space": true,
  "semicolon": false,
  "ignores": [
    "lib/"
  ],
  "extends": "xo-typescript",
  "extensions": [
    "ts"
  ]
},

It seems that "space": true, is override by eslint-config-xo-typescript. Is there any fix to this?

@GeorgeGkas
Copy link
Author

I found the solution. You can override the default rules using rules key in xo object.

"xo": {
  "rules": {
    "@typescript-eslint/indent": ["error", 2, { "SwitchCase": 1 }]
  },
  "ignores": [
    "lib/"
  ],
  "extends": "xo-typescript",
  "extensions": [
    "ts"
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant