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.

JavaScript style guide for documentation PRs

See original GitHub issue

@zachleat,

Can we drum up a quick style guide for vanilla JS code examples? I’m willing to forego my (otherwise highly opinionated) personal style for a standard.

I can mimic what’s already there, but it’d be good to establish something formally—for consistency within the docs (if not also the codebase). Here are the major categories I’m thinking we could use some clear ground rules:

  • Ternary operators v. conditional statements?
  • Semicolon?
  • Closures?
  • Explicit return statements?
  • var v. const and let?
  • Arrow functions v. declarations v. expressions?
  • When and when not to cache variables
  • Classes v. exports.render
  • Comments and/or JSDoc blocks?
  • import v. require()
  • this
  • Others?

I’m convinced more folks would reach for the vanilla 🍦 if they had more examples in the docs—and I wanna help.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
Ryuno-Kicommented, Dec 27, 2020

Looking into that right now (but @matt-auckland was faster with https://github.com/11ty/11ty-website/commit/3a0ce3b1535d7d220091df86bb20a9faff40c916 ):

If you agree, I’d fill a PR with those rules added.

1reaction
Ryuno-Kicommented, Dec 26, 2020

Shoot, totally forgot about this! Yes, I’m still interested. Thanks for the reminder!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google JavaScript Style Guide
1 Introduction. This document serves as the complete definition of Google's coding standards for source code in the JavaScript programming language.
Read more >
How to implement Google JavaScript style guide with Codacy
The Google JavaScript style guide is one of the most popular code style guides. We'll show you how to implement it in Codacy....
Read more >
How to Pull Request.. Some guidelines I have collected over…
It is an art form to keep Pull Requests (PRs) small. ... all the comments I receive into this document so that our...
Read more >
Docs and Website | Data Version Control - DVC
Doc style guidelines (JavaScript and Markdown) ... Some of the following rules are applied automatically by a pre-commit Git hook that is installed...
Read more >
Code Review Guidelines | Nuxeo Documentation
Important coding standards are described in the Java Code Style and JavaScript Code Style pages. It is important to understand that changes ...
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