This example demonstrates the use of Cloud Build to do style checking with eslint.
To build and run manually with Docker run
docker build -t eslint .
docker run -w /app eslint
To run with Cloud Build use the command
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.