From 6227d4614dcbedbf16716c7dafed87ebdc73fa4b Mon Sep 17 00:00:00 2001 From: David Bushong Date: Fri, 18 Oct 2019 14:40:37 -0700 Subject: [PATCH 1/4] chore: update package setup & lint --- .editorconfig | 11 + .eslintignore | 3 + .eslintrc | 9 - .eslintrc.json | 37 + .gitignore | 5 +- .npmrc | 2 + .travis.yml | 12 + CONTRIBUTING.md | 171 +++ index.js | 115 +- package-lock.json | 2800 +++++++++++++++++++++++++++------------ package.json | 73 +- test/.eslintrc | 8 - test/abbreviate.js | 97 -- test/abbreviate.test.js | 119 ++ test/expand.js | 51 - test/expand.test.js | 62 + test/mocha.opts | 2 + 17 files changed, 2520 insertions(+), 1057 deletions(-) create mode 100644 .editorconfig create mode 100644 .eslintignore delete mode 100644 .eslintrc create mode 100644 .eslintrc.json create mode 100644 .npmrc create mode 100644 .travis.yml create mode 100644 CONTRIBUTING.md delete mode 100644 test/.eslintrc delete mode 100644 test/abbreviate.js create mode 100644 test/abbreviate.test.js delete mode 100644 test/expand.js create mode 100644 test/expand.test.js create mode 100644 test/mocha.opts diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..beffa30 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..8493529 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +tmp +node_modules/ +.git diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 68d14a4..0000000 --- a/.eslintrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "airbnb/legacy", - "rules": { - "id-length": 0, - "vars-on-top": 0, - "strict": [2, "global"], - "no-param-reassign": 0 - } -} diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..c9bfd91 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,37 @@ +{ + "extends": "groupon/node8", + "rules": { + "id-length": 0, + "vars-on-top": 0, + "strict": [ + 2, + "global" + ], + "no-param-reassign": 0 + }, + "overrides": [ + { + "files": "*.mjs", + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "node/no-unsupported-features": [ + "error", + { + "version": 8, + "ignores": [ + "modules" + ] + } + ] + } + }, + { + "files": "*.test.js", + "env": { + "mocha": true + } + } + ] +} diff --git a/.gitignore b/.gitignore index 3c3629e..fa950af 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -node_modules +node_modules/ +npm-debug.log +/.nyc_output +/target diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..7061c24 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +ignore-engines=true +registry=https://registry.npmjs.org diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9929d6a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: node_js +node_js: + - 8 + - 10 + - 12 +deploy: + - provider: script + script: npx nlm release + skip_cleanup: true + 'on': + branch: master + node: 12 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..31c092f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,171 @@ + + +# Contributing + +🎉🏅 Thanks for helping us improve this project! 🙏 + +This document outlines some of the practices we care about. +If you have any questions or suggestions about the process, +feel free to [open an issue](#reporting-issues) +. + +## How Can I Contribute? + +### Reporting Issues + +If you find any mistakes in the docs or a bug in the code, +please [open an issue in Github](https://github.com/groupon/host-pattern/issues/new) so we can look into it. +You can also [create a PR](#contributing-code) fixing it yourself, or course. + +If you report a bug, please follow these guidelines: + +* Make sure the bug exists in the latest version. +* Include instructions on how to reproduce the issue. + The instructions should be as minimal as possible + and answer the three big questions: + 1. What are the exact steps you took? This includes the exact versions of + node, npm, and any packages involved. + 1. What result are you expecting? + 1. What is the actual result? + +### Improving Documentation + +For small documentation changes, you can use [Github's editing feature][ghedit]. +The only thing to keep in mind is to prefix the commit message with "docs: ". +The default commit message generated by Github will lead to a failing CI build. + +[ghedit]: https://help.github.com/articles/editing-files-in-another-user-s-repository/ + +For larger updates to the documentation +it might be better to follow the +[instructions for contributing code below](#contributing-code). + +### Contributing Code + +**Note:** If you're planning on making substantial changes, +please [open an issue first to discuss your idea](#reporting-issues). +Otherwise you might end up investing a lot of work +only to discover that it conflicts with plans the maintainers might have. + +The general steps for creating a pull request are: + +1. Create a branch for your change. Always start your branch from the latest + `master`. We recommend using `git wf start some-feature-name` by using + [git workflow][gitwf]. Run `npm install` to install the dependencies. +1. If you're fixing a bug, be sure to write a test *first*. That way you can + validate that the test actually catches the bug and doesn't pass. +1. Make your changes to the code. Remember to update the tests if you add new + features or change behavior. +1. Run the tests via `npm test`. This will also run style checks and other + validations. You might see errors about uncommitted files. This is + expected until you commit your changes. +1. Once you're done, `git add .` and `git commit`. Please follow the + [commit message conventions](#commits--commit-messages) described below. +1. Push your branch to Github & create a PR. + +[gitwf]: https://github.com/groupon/git-workflow + +#### Code Style + +In addition to any linting rules the project might include, a few general rules +of thumb: + +* Try to match the style of the rest of the code. +* We prefer simple code that is easy to understand over terse, expressive code. +* We try to structure projects by semantics instead of role. E.g. we'd rather + have a `tree.js` module that contains tree traversal-related helpers than + a `helpers.js` module. +* Actually, if you create helpers you might want to put those into a separate + package. That way it's easier to reuse them. + +#### Commits & Commit Messages + +Please follow the [angular commit message conventions][angular-commits]. We +use an automated tool for generating releases that depends on the conventions +to determine the next version and the content of the changelog. Commit messages +that don't follow the conventions will cause `npm test` (and thus CI) to fail. + +The short summary - a commit message should look like this: + +``` +: + + + + + +