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

0.28.1 breaks support for space option in typescript #445

Closed
EdJoPaTo opened this issue Mar 26, 2020 · 6 comments · Fixed by #451
Closed

0.28.1 breaks support for space option in typescript #445

EdJoPaTo opened this issue Mar 26, 2020 · 6 comments · Fixed by #451

Comments

@EdJoPaTo
Copy link
Contributor

I assume #442 overrides the options set by space.

npm i xo@0.28.0 && npx xo works fine.
npm i xo@0.28.1 && npx xo does not.

@sindresorhus
Copy link
Member

// @pvdlg

@pvdlg
Copy link
Contributor

pvdlg commented Mar 27, 2020

For Typescript files we set the rule @typescript-eslint/indent explicitly based on the XO space option:

config.rules['@typescript-eslint/indent'] = ['error', spaces, {SwitchCase: 1}];

So not surer what is the problem you are reporting.

Can you provide a reproductible case with your config, the file you lint and what report you get and expect?

@EdJoPaTo
Copy link
Contributor Author

EdJoPaTo commented Mar 28, 2020

create a temp folder, put in a ts file, for example index.ts with this content:

export function foo(): void {
  console.log('bar');
}

and a package.json with this content

{
  "name": "xo-testing",
  "xo": {
    "space": 2
  }
}

Then run these two commands:

npm i xo@0.28.0 && npx xo
npm i xo@0.28.1 && npx xo

Using 0.28.0 this works fine without errors.
0.28.1 reports for the rule 'indent' (which is only javascript specific, not for typescript) for expected tabs.

Also: In #446 I added test cases for the space option which are failing on 0.28.1 and work on 0.28.0.

@pvdlg
Copy link
Contributor

pvdlg commented Apr 1, 2020

Thanks! Will look into that tonight

@pvdlg
Copy link
Contributor

pvdlg commented Apr 1, 2020

So the problem is the indent rule is set in the default XO config: https://github.com/xojs/eslint-config-xo/blob/06e4e1416bdbf2df56984adca8039683ebad735c/index.js#L305

So as a result for TS files we end up with both indent and @typescript-eslint/indent to be set up.

Fixing xojs/eslint-config-xo-typescript#23 will solve the issue

@pvdlg
Copy link
Contributor

pvdlg commented Apr 1, 2020

Never mind my last comment, the indent rule is not part of those.

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

Successfully merging a pull request may close this issue.

3 participants