From 8d512e910ced44af97dd8c28e8c7b856d1be5009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Harper?= Date: Thu, 18 Apr 2024 10:15:17 -0400 Subject: [PATCH] fix JSON validation GitHub workflow --- .eslintrc | 4 ---- .github/workflows/validate-json.yml | 15 +++++---------- eslint.config.js | 10 ++++++++++ 3 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 .eslintrc create mode 100644 eslint.config.js diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 630bcf3..0000000 --- a/.eslintrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "root": true, - "extends": ["plugin:json/recommended"] -} \ No newline at end of file diff --git a/.github/workflows/validate-json.yml b/.github/workflows/validate-json.yml index 8d59153..f01f361 100644 --- a/.github/workflows/validate-json.yml +++ b/.github/workflows/validate-json.yml @@ -1,5 +1,6 @@ name: Validate people.json on: + workflow_dispatch: push: paths: - 'people.json' @@ -9,21 +10,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout this repository - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.0 - name: Setting up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4.0.2 with: - node-version: '18' + node-version: 'v20.12.2' - - name: Installing eslint & eslint-plugin-json + - name: Installing eslint-plugin-json run: npm i eslint-plugin-json - name: Validate the JSON run: npx eslint people.json - - - name: Installing ajv CLI - run: npm i -g ajv-cli - - - name: Validate the JSON Schema - run: ajv validate -s schema.json -d people.json --spec=draft2020 diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..276b2df --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,10 @@ +const json = require('eslint-plugin-json'); + +module.exports = [ + { + files: ['**/*.json'], + plugins: { json }, + processor: json.processors['.json'], + rules: json.configs.recommended.rules, + }, +]