From 899cdfda4ed3cc1e6e530af7a24bc1616f5abf37 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 17 Apr 2020 11:00:52 +0200 Subject: [PATCH] CI: Run prettier to check for JS code formatting --- .github/workflows/lint.yml | 31 +++++++++++++++++++++++++++++++ js/package.json | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..ee7e34f6b --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,31 @@ +name: Lint code + +on: + push: + paths: + - 'js/src/**' + pull_request: + paths: + - 'js/src/**' + +jobs: + prettier: + runs-on: ubuntu-latest + + name: Lint JS code with Prettier + + steps: + - uses: actions/checkout@master + + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: "12" + + - name: Install JS dependencies + run: npm ci + working-directory: ./js + + - name: Check JS code for formatting + run: node_modules/.bin/prettier --check src + working-directory: ./js diff --git a/js/package.json b/js/package.json index 7fcfeb16d..9c3a91b07 100644 --- a/js/package.json +++ b/js/package.json @@ -26,7 +26,8 @@ "scripts": { "dev": "webpack --mode development --watch", "build": "webpack --mode production", - "format": "prettier --write src" + "format": "prettier --write src", + "format-check": "prettier --check src" }, "husky": { "hooks": {