question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: prefer eslint syntax over style

See original GitHub issue

With more and more tools becoming available to automatically format the code base to a certain set of style rules (and more comprehensive than eslint --fix, I’m also more inclined to stop teaching style preference, as indicated by mentor notes, mentor guidance docs and discussions on slack.

The current state

Currently, the javavscript package.json sets a very restrictive code style (airbnb) and I don’t think this:

  • helps the student understand the language
  • helps the student get fluent in a language
  • helps the mentor mentoring as downloading exercises can result in wibbly wobblies all over the place

We don’t instruct or enforce these rules (https://github.com/exercism/javascript/issues/44#issuecomment-416760562) strictly, but I seem them in mentoring comments and most IDE’s will run these automagically if present.

Recommendation

I therefore recommend to drop down to eslint:recommend or if we must have a non-company style guide, use standard with semicolon rules disabled (people should decide about ASI themselves – I don’t think pushing people who know about ASI helps anyone, and TS doesn’t have them either).

If this is something we want, I think doing it sooner rather than later is good and will speed up #480 greatly. The eslintignore list is still quite long and I don’t think tháts particularly helpful.

As a final note, I think we should better communicate to the students to run npm/yarn install and then npm/yarn test. I also suggest running test followed by lint so that someone is only bugged once the test succeeds, instead of using a "pretest": "lint":

{ 
  "scripts": {
    "test": "test:jest && test:lint",
    "test:jest": "...",
    "test:lint": "..."
   }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
SleeplessBytecommented, Jan 21, 2019

I’m happy to actually strip all style items left in eslint:recommended btw! We are definitely in sync on reasoning and I agree with everything you say.

1reaction
tejasbubanecommented, Jan 21, 2019

I am in the favor of not recommending anything to students - only use it for CI in our repo. For mentors, put a mentor note regarding the same. What do you think?

This is because JS does not have a standard formatting tool (you mentioned the same in previous comment). Had it been golang or elixir, it would be good to recommend.

Having said that I am OK with using eslint:recommend as well - since it is less strict and opinionated that airbnb. But I would certainly put up a mentor note to atleast not make it a requirement for students (it is fine to subtly suggest, but not ok to make it a requirement for approving solutions).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rules - ESLint - Pluggable JavaScript Linter
Suggestions. prefer-object-spread. Disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.
Read more >
ESLint: Everything You need to know about setting up a style ...
If you prefer to have a lenient style guide Standard is a good choice. ... By default, ESLint expects ECMAScript 5 syntax.
Read more >
How To Lint and Format Code with ESLint in Visual Studio Code
You can use a linter to do this. Linters check your code for syntax errors and highlight errors to make sure you can...
Read more >
Setting up efficient workflows with ESLint, Prettier and ...
ESLint is a tool which can analyze written code. Basically it is a static code analyzer and it can find syntax errors, bugs...
Read more >
Using Prettier and ESLint to automate formatting and fixing ...
The primary reason Prettier was created was to eliminate debates over code styles. The idea is that Prettier's style guide is fully ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found