exercism / website

The codebase for Exercism's website.
https://exercism.org
GNU Affero General Public License v3.0
429 stars 125 forks source link

Add TS Linting #164

Closed iHiD closed 4 years ago

iHiD commented 4 years ago

We should add an ES linter for the JS Code.

@SleeplessByte says:

I suggest eslint together with typescript-eslint (https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md), and add the react, jest, import plugins

See also https://github.com/prettier/eslint-config-prettier#installation

ErikSchierboom commented 4 years ago

I'm working on this.

SleeplessByte commented 4 years ago

This might help, if you get stuck: https://dev.to/sleeplessbyte/tetris-choosing-the-tools-and-setting-up-the-project-4kh6

eslint and prettier chapters.

Some of it might be outdated (> 1 year ago written), but base steps is the same. Errors that are outputted by eslint about configuration are sane. Just post here and ping here + slack if you need help.

ErikSchierboom commented 4 years ago

Thanks!

ErikSchierboom commented 4 years ago

@SleeplessByte @kntsoriano I've created a draft PR laying out some of the basics to implement this: https://github.com/exercism/v3-website/pull/174

Something else has come up in the mean time, so I won't be able to work on this for a while. Maybe @kntsoriano could pick this up (with help of @SleeplessByte)?

kntsoriano commented 4 years ago

@ErikSchierboom @SleeplessByte What's left to do for this one? I've tried running the eslint command and it seems to work. I think we can ignore the errors for now as our linter only runs on the files that we've changed.

SleeplessByte commented 4 years ago

I think this is okay to start, but consider checking the custom rules I use in that blog post. Most are copy paste, if you agree.

kntsoriano commented 4 years ago

From reading your blog post, I've found out that we didn't add plugin:@typescript-eslint/eslint-recommended yet. I've pushed a new commit to add that now. Did I understand that correctly?

I think we could roll with these defaults first then adapt custom rules later, as I really haven't formed an opinion yet.