Last active
October 5, 2018 22:26
-
-
Save alexamies/8e7aa81d1078ceadc2298e0df92f9865 to your computer and use it in GitHub Desktop.
Revisions
-
alexpamies renamed this gist
Oct 5, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
alexpamies renamed this gist
Sep 18, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ docker build -t eslint . docker run -w /app eslint ``` To run with Cloud Build use the command ``` gcloud builds submit . --config=cloudbuild.yaml ``` -
alexpamies created this gist
Sep 18, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ { "extends": "google" } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ FROM node:10.10.0 RUN mkdir /app COPY *.js /app/ COPY *.json /app/ RUN npm install -g eslint eslint-config-google CMD ["/usr/local/bin/npm", "run", "lint"] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ # Cloud Builder JavaScript Lint Example This example demonstrates the use of [Cloud Build](https://cloud.google.com/cloud-build/docs/) to do style checking with [eslint](https://eslint.org/). To build and run manually with Docker run ``` docker build -t eslint . docker run -w /app eslint ``` To run with Cloud Build run ``` gcloud builds submit . --config=cloudbuild.yaml ``` You will see that there are several style errors reported for the the sum.js file, including . Edit sum.js to be like this: ``` /** * Add two numbers together * @param {number} a - The first operand * @param {number} b - The second operand * @return {number} The sum of the two operands */ function sum(a, b) { return a + b; } console.log('1 + 1 = ' + sum(1, 1)); ``` Then run cloud build again. It should succeed this time. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ steps: - name: 'gcr.io/cloud-builders/docker' args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/eslint', '.' ] - name: gcr.io/cloud-builders/docker args: ['run', '-w', '/app', 'gcr.io/$PROJECT_ID/eslint'] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ { "name": "javascript", "version": "1.0.0", "description": "", "main": "sum.js", "scripts": { "lint":"eslint ." }, "author": "", "license": "ISC", "devDependencies": { "eslint": "^5.5.0", "eslint-config-google": "^0.10.0" } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ function sum(a, b) { sum = a + b return sum }