<commit_before># JavaScript at Groupon

This repository contains tools & guidelines for using JavaScript at Groupon.
It represents a best effort to capture the current practices.
<commit_msg>docs: Add notes on writing packages<commit_after># JavaScript at Groupon

This repository contains tools & guidelines for using JavaScript at Groupon.
It represents a best effort to capture the current practices.

## Writing NPM Packages

### ES5 or ES2015?

The general rule is:
When writing code that is distributed via npm, we use ES5 code.
All libraries should use `groupon/legacy`.
This ensures the code works consistently across all environments
and doesn't require any compilation.

There are exceptions when libraries depend on features like generators
that don't have a real ES5 equivalent.
But in most cases it's possible to isolate that code
into a separate library without polluting unrelated pieces of logic.

For applications using ES2015 and [proposed upcoming features](https://github.com/tc39/ecma262#ecmascript) like object spread is encouraged.
The default lint style should be `groupon/base` or `groupon` when using React.

### Versioning and Publishing

We use [`nlm`](https://github.com/groupon/nlm) to manage our libaries.
This ensures that:

1. Every library has a usable `CHANGELOG.md` file as part of its git history.
1. Releases are never tied to a single person.
1. We can easily share best practices across projects.

{'fraction_non_alphanumeric': 0.054279749478079335, 'fraction_numerical': 0.013221990257480862, 'mean_word_length': 4.798387096774194, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '995316', 'n_tokens_mistral': 381, 'n_tokens_neox': 353, 'n_words': 201}