From f40f794d8c5d059484302f02c497185985bb158f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Mon, 28 Feb 2022 17:05:13 +0000 Subject: [PATCH 1/9] Add a .devcontainer Co-authored-by: Ned Schwartz --- .devcontainer/Dockerfile | 16 ++++++++++++++++ .devcontainer/devcontainer.json | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..43abf1a --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,16 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.222.0/containers/javascript-node/.devcontainer/base.Dockerfile + +# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster +ARG VARIANT="16" +FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment if you want to install an additional version of node using nvm +# ARG EXTRA_NODE_VERSION=10 +# RUN su node -c "source/usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" + +# [Optional] Uncomment if you want to install more global node modules +# RUN su node -c "npm install -g " diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..bf736f9 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,32 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.222.0/containers/javascript-node +{ + "name": "Node.js", + "build": { + "dockerfile": "Dockerfile", + // Update 'VARIANT' to pick a Node version: 16, 14, 12. + // Append -bullseye or -buster to pin to an OS version. + // Use -bullseye variants on local arm64/Apple Silicon. + "args": { "VARIANT": "16" } + }, + + // Set *default* container specific settings.json values on container create. + "settings": {}, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "dbaeumer.vscode-eslint" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "yarn install", + + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "node", + "features": { + "git": "latest" + } +} From 6ed92e4445076acd4e39bd44a84fe374d6a846b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Fri, 25 Mar 2022 15:53:42 +0000 Subject: [PATCH 2/9] Create .github/workflows/publish.yml --- .github/workflows/publish.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c1b229d --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,24 @@ +name: Publish + +on: + release: + types: [created] + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 14 + registry-url: https://registry.npmjs.org/ + cache: npm + - run: npm ci + - run: npm test + - run: npm version ${TAG_NAME} --git-tag-version=false + env: + TAG_NAME: ${{ github.event.release.tag_name }} + - run: npm whoami; npm --ignore-scripts publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} From 280b09ddcd9dd8e6b7e6bfd41dfe547f94ec7418 Mon Sep 17 00:00:00 2001 From: Artem Saveliev Date: Thu, 15 Sep 2022 16:22:48 -0700 Subject: [PATCH 3/9] Allow trailing commas --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 9efa3f1..a7ae736 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,6 @@ module.exports = { semi: false, singleQuote: true, bracketSpacing: false, - trailingComma: 'none', + trailingComma: 'es5', arrowParens: 'avoid' } From 2fa441558c492c625491555a405effc751c83c7b Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Wed, 30 Nov 2022 16:52:22 +0000 Subject: [PATCH 4/9] add package-lock --- package-lock.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..111d91b --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "@github/prettier-config", + "version": "0.0.4", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "@github/prettier-config", + "version": "0.0.4", + "license": "MIT" + } + } +} From 10072e289ca9aea7b366166ef08876fb0c0022ae Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Wed, 30 Nov 2022 16:53:12 +0000 Subject: [PATCH 5/9] add codeowners --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..e6bf555 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @github/web-systems-reviewers From f61aae0af47fe9b8cd58272c3003dda31ff6c597 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 1 Dec 2022 10:06:26 +0000 Subject: [PATCH 6/9] set trailing commas to all --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index a7ae736..c92394c 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,6 @@ module.exports = { semi: false, singleQuote: true, bracketSpacing: false, - trailingComma: 'es5', + trailingComma: 'all', arrowParens: 'avoid' } From 8fd1960c0db681522c815f7afb637ae92001959f Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 1 Dec 2022 10:24:22 +0000 Subject: [PATCH 7/9] add tests --- .gitignore | 1 + examples/one.ts | 23 +++++++++++++++++++++++ package-lock.json | 28 +++++++++++++++++++++++++++- package.json | 5 +++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 examples/one.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/examples/one.ts b/examples/one.ts new file mode 100644 index 0000000..3eda89b --- /dev/null +++ b/examples/one.ts @@ -0,0 +1,23 @@ +const obj = { + one: 1, + two: 2, + three: 3, +} + +;('this config avoids semicolons at the end of statements and uses single quotes for strings') + +async function heresAFunctionWhichSpansMulitpleLinesAnd( + that, + includes, + many, + args, + to, + demonstrait, + trailing, + func, + commas +) { + return obj +} + +const arrowFunctions = avoidParens => 1 diff --git a/package-lock.json b/package-lock.json index 111d91b..bc4be5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,33 @@ "": { "name": "@github/prettier-config", "version": "0.0.4", - "license": "MIT" + "license": "MIT", + "devDependencies": { + "prettier": "^2.8.0" + } + }, + "node_modules/prettier": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.0.tgz", + "integrity": "sha512-9Lmg8hTFZKG0Asr/kW9Bp8tJjRVluO8EJQVfY2T7FMw9T5jy4I/Uvx0Rca/XWf50QQ1/SS48+6IJWnrb+2yemA==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + } + }, + "dependencies": { + "prettier": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.0.tgz", + "integrity": "sha512-9Lmg8hTFZKG0Asr/kW9Bp8tJjRVluO8EJQVfY2T7FMw9T5jy4I/Uvx0Rca/XWf50QQ1/SS48+6IJWnrb+2yemA==", + "dev": true } } } diff --git a/package.json b/package.json index 0a20255..b7962b4 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,11 @@ "author": "GitHub Inc.", "main": "index.js", "scripts": { + "test:update": "prettier --config ./index.js --write examples/", + "test": "prettier --config ./index.js --check examples/", "postpublish": "npm publish --ignore-scripts --@github:registry='https://npm.pkg.github.com'" + }, + "devDependencies": { + "prettier": "^2.8.0" } } From 642c9ce305a0521bbfad57655694c7a59a1ead0c Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 1 Dec 2022 10:27:52 +0000 Subject: [PATCH 8/9] add CI build step --- .github/workflows/test.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f5dc344 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,18 @@ +name: Node CI + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 18.x + uses: actions/setup-node@v1 + with: + node-version: 18.x + - name: npm install, build, and test + run: | + npm it + env: + CI: true From 9e3619e1661fac8706d83fc3f1dd1cfa993398d7 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 1 Dec 2022 11:08:19 +0000 Subject: [PATCH 9/9] update snapshot tests --- examples/one.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/one.ts b/examples/one.ts index 3eda89b..6ebaa43 100644 --- a/examples/one.ts +++ b/examples/one.ts @@ -15,7 +15,7 @@ async function heresAFunctionWhichSpansMulitpleLinesAnd( demonstrait, trailing, func, - commas + commas, ) { return obj }