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

Inconsistent versions of Eslint and typescript plugin #287

Closed
Cerber-Ursi opened this issue Oct 11, 2019 · 3 comments · Fixed by #288
Closed

Inconsistent versions of Eslint and typescript plugin #287

Cerber-Ursi opened this issue Oct 11, 2019 · 3 comments · Fixed by #288

Comments

@Cerber-Ursi
Copy link

I've just updated my previously completed exercises, according to the notification on the Exercism page, and suddenly run into a problem.

I'm using Visual Studio Code, and I've tried to make use of the TSLint plugin to catch linting errors on-the-fly. Now, as TSLint seems to be deprecated, I've migrated to ESLint, according to the new package.json (PR #276). But:

  • On running yarn, it warned of incorrect peer dependency.
  • In VSCode, it wasn't able to find the plugin.

It seems that providing eslint 6.x together with typescript-eslint 1.x doesn't make any sense. I've tried both eslint 5.x + typescript-eslint 1.x and eslint 6.x + typescript-eslint 2.x, and both combinations worked fine.

Shouldn't we fix this? If we should, that what pair is to be preferred?

@SleeplessByte
Copy link
Member

SleeplessByte commented Oct 11, 2019

Don't use tslint on this project. Don't use typescript-eslint or whatever that is. The regular eslint plugin works on typescript

In vscode, open the settings.json and make sure you have:

{
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    { "language": "typescript", "autoFix": true },
    { "language": "typescriptreact", "autoFix": true }
  ]
}

(Turn off autoFix, if you don't want autofixing),

for example, in my settings I have:

"eslint.validate": [
  "javascript",
  "javascriptreact",
  "typescript",
  "typescriptreact"
]

and then via the UI I have turned on autofixing.

@Cerber-Ursi
Copy link
Author

The question is about the package.json and .eslintrc included in the exercises. Are they correct, or is there really a inconsistency?

I admit, I've already worked with TS and now am looking for improvements, not for start. So, of course, I could remove @typescript-eslint/eslint-plugin from .eslintrc (together with all its rules) and remove @typescript-eslint/eslint-plugin from dependencies. But should I? And, more importantly, should the student do this, who is just starting?

Moreover, I've just checked it - even if I remove @typescript-eslint/eslint-plugin, I still have to retain @typescript-eslint/parser (otherwise eslint simply can't understand TypeScript syntax). And it has its version inconsistent with eslint, too:

warning " > @typescript-eslint/[email protected]" has incorrect peer dependency "eslint@^5.0.0".

Is that normal? If you think so, I'll follow, of course.

@SleeplessByte
Copy link
Member

Just a heads up: you need to run yarn install before opening the folder in vscode, or reload vscode. The eslint plugin unfortunately most of the time does not initialise correctly when the node_modules dependencies are not present. This is an issue with the plugin, not with the exercism repo.

But should I?

No, you should not remove this.

Is that normal? If you think so, I'll follow, of course.

Yes, but we'll update the dependencies soon, so this will go away 👍 👍 😄

SleeplessByte added a commit that referenced this issue Oct 13, 2019
SleeplessByte added a commit that referenced this issue Oct 14, 2019
* Update dependencies

Fixes #287

* Sync the configuration

* Update package.track.json

* Use object (new style for the rule)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants