From a5836da283d9684ba53c585cdb8c28aea7f54ff6 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Tue, 18 Dec 2018 11:09:41 +1100 Subject: [PATCH 01/17] Create a basic Buildkite ESLint formatter --- .buildkite/eslint-formatter-buildkite.js | 103 +++++++++++++++++++++++ .buildkite/eslint-formatter-multi.js | 32 +++++++ package.json | 4 +- 3 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 .buildkite/eslint-formatter-buildkite.js create mode 100644 .buildkite/eslint-formatter-multi.js diff --git a/.buildkite/eslint-formatter-buildkite.js b/.buildkite/eslint-formatter-buildkite.js new file mode 100644 index 000000000..3d9a208ec --- /dev/null +++ b/.buildkite/eslint-formatter-buildkite.js @@ -0,0 +1,103 @@ +const spawnSync = require('child_process').spawnSync; + +module.exports = function(results) { + const { warning, error } = results.reduce( + function(acc, file) { + if (file.errorCount > 0) { + acc.error.push(file); + } + + if (file.warningCount > 0) { + acc.warning.push(file); + } + + return acc; + }, + { + warning: [], + error: [] + } + ); + + if (error.length > 0) { + let errorOutput = ` +#### ESLint Errors + +${ + error.map(function(file) { + return ` +
${file.filePath} + +${ + file.messages.map(function(message) { + if (message.severity > 1) { + return ''; + } + + return `${message.line}:${message.column}: ${message.message} (${message.ruleId})`; + }).join('\n\n') +} + +
`; + + // return JSON.stringify(file, null, 2); + }).join('\n\n') +}`; + + if (process.env["BUILDKITE"]) { + spawnSync( + 'buildkite-agent', + [ + 'annotate', + '--context', 'eslint', + '--style', 'error', + errorOutput + ] + ); + } else { + console.log(errorOutput); + } + } + + if (warning.length > 0) { + let warningOutput = ` +#### ESLint Warnings + +${ + warning.map(function(file) { + return ` +
${file.filePath} + +${ + file.messages.map(function(message) { + if (message.severity > 1) { + return ''; + } + + return `${message.line}:${message.column}: ${message.message} (${message.ruleId})`; + }).join('\n\n') +} + +
`; + + // return JSON.stringify(file, null, 2); + }).join('\n\n') +}`; + + if (process.env["BUILDKITE"]) { + spawnSync( + 'buildkite-agent', + [ + 'annotate', + '--context', 'eslint', + '--style', 'warning', + warningOutput + ] + ); + } else { + console.log(warningOutput); + } + } + + return ''; +}; diff --git a/.buildkite/eslint-formatter-multi.js b/.buildkite/eslint-formatter-multi.js new file mode 100644 index 000000000..10e0d8d36 --- /dev/null +++ b/.buildkite/eslint-formatter-multi.js @@ -0,0 +1,32 @@ +// Pull in ESLint's own "getFormatter" method (https://git.io/fpAqw), which +// normalises both ESLint's friendly names, npm package names, and files +// on-disk, and then returns the result of requiring them. +let getFormatter = require('eslint/lib/cli-engine').prototype.getFormatter.bind({}); + +module.exports = function(results) { + // Since ESLint doesn't give us access to any context or config, + // we have to resort to pulling Environment Variables + let formatters = ( + process.env['ESLINT_MULTI_FORMATTERS'].split(';') + || [ false ] + ); + + // Map over each formatter, calling it with the result array we got given, + // then return the combination of all the outputs. + return formatters + .map(function (formatterName) { + let formatter = getFormatter(formatterName); + + // TODO: When would this happen, and not just be a thrown error? + if (!formatter) { + console.debug('Weird! "' + formatterName + '" isn\'t a real formatter...'); + return; + } + + return formatter(results); + }) + .filter(function(output) { + return output && output.trim().length > 0; + }) + .join('\n\n'); +}; diff --git a/package.json b/package.json index b6ad2d38a..3da40419e 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "test": "NODE_ENV=test jest --colors", "test-with-coverage": "yarn test --coverage", "flow": "flow", - "lint": "eslint . --color", - "lint-and-fix": "eslint --fix --color .", + "lint": "ESLINT_MULTI_FORMATTERS=\"./.buildkite/eslint-formatter-buildkite.js\" eslint . -f='./.buildkite/eslint-formatter-multi.js' --color", + "lint-and-fix": "ESLINT_MULTI_FORMATTERS=\"./.buildkite/eslint-formatter-buildkite.js\" eslint --fix -f='./.buildkite/eslint-formatter-multi.js' --color .", "relay-compile": "relay-compiler --schema app/graph/schema.json --src app", "prebuild": "yarn run relay-compile", "build": "NODE_ENV=development webpack --config webpack/config.js --progress --bail --cache", From d1c33746d66b47909d6d80890c63e9cb37cde7c3 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Tue, 18 Dec 2018 11:09:52 +1100 Subject: [PATCH 02/17] Add a lint error for testing with --- app/components/layout/Navigation/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/layout/Navigation/index.js b/app/components/layout/Navigation/index.js index 07cb9b3ff..1576aa72c 100644 --- a/app/components/layout/Navigation/index.js +++ b/app/components/layout/Navigation/index.js @@ -82,7 +82,7 @@ class Navigation extends React.PureComponent { ) { this.setState({ lastDefaultTeam: UserSessionStore.get(`organization-default-team:${nextProps.organization.id}`) - }); + }) } } From e11e748f6300ca03eb8243323ea52c7ae67e79ad Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Tue, 18 Dec 2018 11:24:57 +1100 Subject: [PATCH 03/17] Restore the "Stylish" formatter --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3da40419e..c2a37d85b 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "test": "NODE_ENV=test jest --colors", "test-with-coverage": "yarn test --coverage", "flow": "flow", - "lint": "ESLINT_MULTI_FORMATTERS=\"./.buildkite/eslint-formatter-buildkite.js\" eslint . -f='./.buildkite/eslint-formatter-multi.js' --color", - "lint-and-fix": "ESLINT_MULTI_FORMATTERS=\"./.buildkite/eslint-formatter-buildkite.js\" eslint --fix -f='./.buildkite/eslint-formatter-multi.js' --color .", + "lint": "ESLINT_MULTI_FORMATTERS=\"stylish;./.buildkite/eslint-formatter-buildkite.js\" eslint . -f='./.buildkite/eslint-formatter-multi.js' --color", + "lint-and-fix": "ESLINT_MULTI_FORMATTERS=\"stylish;./.buildkite/eslint-formatter-buildkite.js\" eslint --fix -f='./.buildkite/eslint-formatter-multi.js' --color .", "relay-compile": "relay-compiler --schema app/graph/schema.json --src app", "prebuild": "yarn run relay-compile", "build": "NODE_ENV=development webpack --config webpack/config.js --progress --bail --cache", From df50a226ae2a7106c8e233660c4e725cabfa85b4 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Tue, 18 Dec 2018 11:44:24 +1100 Subject: [PATCH 04/17] Fix buildkite-agent calls --- .buildkite/eslint-formatter-buildkite.js | 26 +++++++++--------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/.buildkite/eslint-formatter-buildkite.js b/.buildkite/eslint-formatter-buildkite.js index 3d9a208ec..f8d001897 100644 --- a/.buildkite/eslint-formatter-buildkite.js +++ b/.buildkite/eslint-formatter-buildkite.js @@ -45,15 +45,12 @@ ${ }`; if (process.env["BUILDKITE"]) { - spawnSync( - 'buildkite-agent', - [ - 'annotate', - '--context', 'eslint', - '--style', 'error', - errorOutput - ] + const result = spawnSync( + 'buildkite-agent', [ 'annotate', '--context', 'eslint', '--style', 'error', ], + { encoding: 'utf8', input: errorOutput } ); + + console.log(result); } else { console.log(errorOutput); } @@ -85,15 +82,12 @@ ${ }`; if (process.env["BUILDKITE"]) { - spawnSync( - 'buildkite-agent', - [ - 'annotate', - '--context', 'eslint', - '--style', 'warning', - warningOutput - ] + const result = spawnSync( + 'buildkite-agent', [ 'annotate', '--context', 'eslint', '--style', 'warning' ], + { encoding: 'utf8', input: warningOutput } ); + + console.log(result); } else { console.log(warningOutput); } From 67ca35487a2f428d622db4773f6c57970611b0de Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Tue, 18 Dec 2018 12:23:48 +1100 Subject: [PATCH 05/17] debug env --- .buildkite/eslint-formatter-buildkite.js | 3 +++ .buildkite/steps/eslint.sh | 3 +++ package.json | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.buildkite/eslint-formatter-buildkite.js b/.buildkite/eslint-formatter-buildkite.js index f8d001897..2bd5d3533 100644 --- a/.buildkite/eslint-formatter-buildkite.js +++ b/.buildkite/eslint-formatter-buildkite.js @@ -1,6 +1,9 @@ const spawnSync = require('child_process').spawnSync; module.exports = function(results) { + console.log("--- DEBUG: env inside node") + console.debug(process.env); + const { warning, error } = results.reduce( function(acc, file) { if (file.errorCount > 0) { diff --git a/.buildkite/steps/eslint.sh b/.buildkite/steps/eslint.sh index 83a141dfa..1cf962173 100755 --- a/.buildkite/steps/eslint.sh +++ b/.buildkite/steps/eslint.sh @@ -1,6 +1,9 @@ #!/bin/bash set -euo pipefail +echo "--- DEBUG: Environment outside Yarn" +env + echo "+++ :eslint: Running eslint" yarn run lint diff --git a/package.json b/package.json index c2a37d85b..27f1d57d4 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "test": "NODE_ENV=test jest --colors", "test-with-coverage": "yarn test --coverage", "flow": "flow", - "lint": "ESLINT_MULTI_FORMATTERS=\"stylish;./.buildkite/eslint-formatter-buildkite.js\" eslint . -f='./.buildkite/eslint-formatter-multi.js' --color", + "lint": "echo \"--- DEBUG: env inside Yarn\"; env; ESLINT_MULTI_FORMATTERS=\"stylish;./.buildkite/eslint-formatter-buildkite.js\" eslint . -f='./.buildkite/eslint-formatter-multi.js' --color", "lint-and-fix": "ESLINT_MULTI_FORMATTERS=\"stylish;./.buildkite/eslint-formatter-buildkite.js\" eslint --fix -f='./.buildkite/eslint-formatter-multi.js' --color .", "relay-compile": "relay-compiler --schema app/graph/schema.json --src app", "prebuild": "yarn run relay-compile", From f90a9cc65be3fa6d90ce0ee2f9bc49c63cc27ef1 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Tue, 18 Dec 2018 12:48:56 +1100 Subject: [PATCH 06/17] More debug --- .buildkite/steps/eslint.sh | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.buildkite/steps/eslint.sh b/.buildkite/steps/eslint.sh index 1cf962173..366ea9a11 100755 --- a/.buildkite/steps/eslint.sh +++ b/.buildkite/steps/eslint.sh @@ -1,8 +1,8 @@ #!/bin/bash set -euo pipefail -echo "--- DEBUG: Environment outside Yarn" -env +echo "--- DEBUG: where is buildkite-agent?" +command -v buildkite-agent echo "+++ :eslint: Running eslint" yarn run lint diff --git a/package.json b/package.json index 27f1d57d4..42580a50a 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "test": "NODE_ENV=test jest --colors", "test-with-coverage": "yarn test --coverage", "flow": "flow", - "lint": "echo \"--- DEBUG: env inside Yarn\"; env; ESLINT_MULTI_FORMATTERS=\"stylish;./.buildkite/eslint-formatter-buildkite.js\" eslint . -f='./.buildkite/eslint-formatter-multi.js' --color", + "lint": "echo \"--- DEBUG: where is buildkite-agent?\"; command -v buildkite-agent; ESLINT_MULTI_FORMATTERS=\"stylish;./.buildkite/eslint-formatter-buildkite.js\" eslint . -f='./.buildkite/eslint-formatter-multi.js' --color", "lint-and-fix": "ESLINT_MULTI_FORMATTERS=\"stylish;./.buildkite/eslint-formatter-buildkite.js\" eslint --fix -f='./.buildkite/eslint-formatter-multi.js' --color .", "relay-compile": "relay-compiler --schema app/graph/schema.json --src app", "prebuild": "yarn run relay-compile", From 11f44d165c4f05a8522c76e3227c3da36c0c909c Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Tue, 18 Dec 2018 14:12:00 +1100 Subject: [PATCH 07/17] Add the agent to the Docker image --- Dockerfile | 8 ++++++++ docker-compose.yml | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2ee7a401f..ba748820e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,14 @@ EXPOSE 4890 ENV EMOJI_HOST=http://buildkite.localhost/_frontend/vendor/emojis +RUN echo "--- :package: Installing system deps" \ + # Buildkite apt sources + && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 32A37959C2FA5C3C99EFBC32A79206696452D198 \ + && echo "deb http://apt.buildkite.com/buildkite-agent unstable main" > /etc/apt/sources.list.d/buildkite.list \ + # Install all the things + && apt-get update \ + && apt-get install -y buildkite-agent + WORKDIR /frontend # Install yarn dependencies diff --git a/docker-compose.yml b/docker-compose.yml index 7b8321c03..59750c2ac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,8 +9,11 @@ services: - BUILDKITE_COMMIT - BUILDKITE_ORGANIZATION_SLUG - BUILDKITE_PIPELINE_SLUG + - BUILDKITE_BUILD_URL + - BUILDKITE_JOB_ID + - BUILDKITE_AGENT_ACCESS_TOKEN - CI volumes: - "./bundle-analysis:/frontend/bundle-analysis" - "./coverage:/frontend/coverage" - - "./dist:/host/dist" \ No newline at end of file + - "./dist:/host/dist" From 9311f62d0044ed333329acb9bf57fc3ce533d882 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Tue, 18 Dec 2018 14:37:59 +1100 Subject: [PATCH 08/17] Pull Buildkite cert over HTTPS instead of via GPG --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ba748820e..aa93a7007 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,10 @@ EXPOSE 4890 ENV EMOJI_HOST=http://buildkite.localhost/_frontend/vendor/emojis +ADD --chown=root:root https://apt.buildkite.com/keys/6452D198.asc /etc/apt/trusted.gpg.d/buildkite.asc + RUN echo "--- :package: Installing system deps" \ # Buildkite apt sources - && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 32A37959C2FA5C3C99EFBC32A79206696452D198 \ && echo "deb http://apt.buildkite.com/buildkite-agent unstable main" > /etc/apt/sources.list.d/buildkite.list \ # Install all the things && apt-get update \ From d8bf65e9bce979bf4691ed3a52667542fd22ec3b Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Tue, 18 Dec 2018 14:41:46 +1100 Subject: [PATCH 09/17] Permission fixes --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index aa93a7007..3eb751d30 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ ADD --chown=root:root https://apt.buildkite.com/keys/6452D198.asc /etc/apt/trust RUN echo "--- :package: Installing system deps" \ # Buildkite apt sources + && chmod 644 /etc/apt/trusted.gpg.d/buildkite.asc \ && echo "deb http://apt.buildkite.com/buildkite-agent unstable main" > /etc/apt/sources.list.d/buildkite.list \ # Install all the things && apt-get update \ From cfa0e8e0b0a6b45cd36aaf950b2fea72a91d6863 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Tue, 18 Dec 2018 14:42:52 +1100 Subject: [PATCH 10/17] Safety first --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3eb751d30..b2e478b53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,9 +10,9 @@ RUN echo "--- :package: Installing system deps" \ # Buildkite apt sources && chmod 644 /etc/apt/trusted.gpg.d/buildkite.asc \ && echo "deb http://apt.buildkite.com/buildkite-agent unstable main" > /etc/apt/sources.list.d/buildkite.list \ - # Install all the things + # Install buildkite-agent && apt-get update \ - && apt-get install -y buildkite-agent + && DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends buildkite-agent WORKDIR /frontend From 0ff1dc05dbe372664aed701e6c22221b22326de1 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Wed, 19 Dec 2018 13:24:40 +1100 Subject: [PATCH 11/17] Remove path debugging stanzas --- .buildkite/eslint-formatter-buildkite.js | 3 --- .buildkite/steps/eslint.sh | 3 --- package.json | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.buildkite/eslint-formatter-buildkite.js b/.buildkite/eslint-formatter-buildkite.js index 2bd5d3533..f8d001897 100644 --- a/.buildkite/eslint-formatter-buildkite.js +++ b/.buildkite/eslint-formatter-buildkite.js @@ -1,9 +1,6 @@ const spawnSync = require('child_process').spawnSync; module.exports = function(results) { - console.log("--- DEBUG: env inside node") - console.debug(process.env); - const { warning, error } = results.reduce( function(acc, file) { if (file.errorCount > 0) { diff --git a/.buildkite/steps/eslint.sh b/.buildkite/steps/eslint.sh index 366ea9a11..83a141dfa 100755 --- a/.buildkite/steps/eslint.sh +++ b/.buildkite/steps/eslint.sh @@ -1,9 +1,6 @@ #!/bin/bash set -euo pipefail -echo "--- DEBUG: where is buildkite-agent?" -command -v buildkite-agent - echo "+++ :eslint: Running eslint" yarn run lint diff --git a/package.json b/package.json index 42580a50a..c2a37d85b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "test": "NODE_ENV=test jest --colors", "test-with-coverage": "yarn test --coverage", "flow": "flow", - "lint": "echo \"--- DEBUG: where is buildkite-agent?\"; command -v buildkite-agent; ESLINT_MULTI_FORMATTERS=\"stylish;./.buildkite/eslint-formatter-buildkite.js\" eslint . -f='./.buildkite/eslint-formatter-multi.js' --color", + "lint": "ESLINT_MULTI_FORMATTERS=\"stylish;./.buildkite/eslint-formatter-buildkite.js\" eslint . -f='./.buildkite/eslint-formatter-multi.js' --color", "lint-and-fix": "ESLINT_MULTI_FORMATTERS=\"stylish;./.buildkite/eslint-formatter-buildkite.js\" eslint --fix -f='./.buildkite/eslint-formatter-multi.js' --color .", "relay-compile": "relay-compiler --schema app/graph/schema.json --src app", "prebuild": "yarn run relay-compile", From a7458bb9c8d81bb1892606665cef2f976046ebf3 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Wed, 19 Dec 2018 13:25:46 +1100 Subject: [PATCH 12/17] Print relative instead of absolute path --- .buildkite/eslint-formatter-buildkite.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.buildkite/eslint-formatter-buildkite.js b/.buildkite/eslint-formatter-buildkite.js index f8d001897..4397f6b5e 100644 --- a/.buildkite/eslint-formatter-buildkite.js +++ b/.buildkite/eslint-formatter-buildkite.js @@ -1,4 +1,5 @@ const spawnSync = require('child_process').spawnSync; +const relative = require('path').relative; module.exports = function(results) { const { warning, error } = results.reduce( @@ -26,7 +27,7 @@ module.exports = function(results) { ${ error.map(function(file) { return ` -
${file.filePath} +
${relative('.', file.filePath)} ${ file.messages.map(function(message) { @@ -63,7 +64,7 @@ ${ ${ warning.map(function(file) { return ` -
${file.filePath} +
${relative('.', file.filePath)} ${ file.messages.map(function(message) { From a6095bb6b0922ce6814308453692af4d5fc641e2 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Wed, 19 Dec 2018 13:35:39 +1100 Subject: [PATCH 13/17] Fix output of error annotation --- .buildkite/eslint-formatter-buildkite.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/eslint-formatter-buildkite.js b/.buildkite/eslint-formatter-buildkite.js index 4397f6b5e..d0620ee07 100644 --- a/.buildkite/eslint-formatter-buildkite.js +++ b/.buildkite/eslint-formatter-buildkite.js @@ -47,7 +47,7 @@ ${ if (process.env["BUILDKITE"]) { const result = spawnSync( - 'buildkite-agent', [ 'annotate', '--context', 'eslint', '--style', 'error', ], + 'buildkite-agent', [ 'annotate', '--context', 'eslint-errors', '--style', 'error', ], { encoding: 'utf8', input: errorOutput } ); @@ -84,7 +84,7 @@ ${ if (process.env["BUILDKITE"]) { const result = spawnSync( - 'buildkite-agent', [ 'annotate', '--context', 'eslint', '--style', 'warning' ], + 'buildkite-agent', [ 'annotate', '--context', 'eslint-warnings', '--style', 'warning' ], { encoding: 'utf8', input: warningOutput } ); From dcc77fdceea03295b3a1aed379fc172c5c31c11f Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Wed, 19 Dec 2018 13:50:33 +1100 Subject: [PATCH 14/17] Fix severity filtering --- .buildkite/eslint-formatter-buildkite.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/eslint-formatter-buildkite.js b/.buildkite/eslint-formatter-buildkite.js index d0620ee07..3284c9579 100644 --- a/.buildkite/eslint-formatter-buildkite.js +++ b/.buildkite/eslint-formatter-buildkite.js @@ -68,7 +68,7 @@ ${ ${ file.messages.map(function(message) { - if (message.severity > 1) { + if (message.severity < 2) { return ''; } From d0a86b0503389019428b4cfcfd0c71198ca3dea1 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Wed, 19 Dec 2018 13:54:13 +1100 Subject: [PATCH 15/17] Okay, actually fix it this time --- .buildkite/eslint-formatter-buildkite.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/eslint-formatter-buildkite.js b/.buildkite/eslint-formatter-buildkite.js index 3284c9579..586303630 100644 --- a/.buildkite/eslint-formatter-buildkite.js +++ b/.buildkite/eslint-formatter-buildkite.js @@ -31,7 +31,7 @@ ${ ${ file.messages.map(function(message) { - if (message.severity > 1) { + if (message.severity !== 2) { return ''; } @@ -68,7 +68,7 @@ ${ ${ file.messages.map(function(message) { - if (message.severity < 2) { + if (message.severity > 1) { return ''; } From 706459fddbba965c4fd421210b2f4eebbe2c5aa6 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Wed, 19 Dec 2018 14:07:35 +1100 Subject: [PATCH 16/17] Improve error handling, don't always print returned object --- .buildkite/eslint-formatter-buildkite.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.buildkite/eslint-formatter-buildkite.js b/.buildkite/eslint-formatter-buildkite.js index 586303630..bc1780c19 100644 --- a/.buildkite/eslint-formatter-buildkite.js +++ b/.buildkite/eslint-formatter-buildkite.js @@ -51,7 +51,12 @@ ${ { encoding: 'utf8', input: errorOutput } ); - console.log(result); + console.log(result.output.join('')); + console.log('Exit code: ' + result.status); + + if (result.error) { + throw result.error; + } } else { console.log(errorOutput); } @@ -88,7 +93,12 @@ ${ { encoding: 'utf8', input: warningOutput } ); - console.log(result); + console.log(result.output.join('')); + console.log('Exit code: ' + result.status); + + if (result.error) { + throw result.error; + } } else { console.log(warningOutput); } From 46d7dcde64f0c6bfd5dc0860b36e9a45c7e2431a Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Wed, 19 Dec 2018 14:08:46 +1100 Subject: [PATCH 17/17] Newlines! --- .buildkite/eslint-formatter-buildkite.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/eslint-formatter-buildkite.js b/.buildkite/eslint-formatter-buildkite.js index bc1780c19..7acc52da9 100644 --- a/.buildkite/eslint-formatter-buildkite.js +++ b/.buildkite/eslint-formatter-buildkite.js @@ -51,7 +51,7 @@ ${ { encoding: 'utf8', input: errorOutput } ); - console.log(result.output.join('')); + console.log(result.output.join('\n')); console.log('Exit code: ' + result.status); if (result.error) { @@ -93,7 +93,7 @@ ${ { encoding: 'utf8', input: warningOutput } ); - console.log(result.output.join('')); + console.log(result.output.join('\n')); console.log('Exit code: ' + result.status); if (result.error) {