mirror of
https://github.com/jlengrand/coffeechat.git
synced 2026-03-10 08:11:20 +00:00
fix JSON validation GitHub workflow
This commit is contained in:
15
.github/workflows/validate-json.yml
vendored
15
.github/workflows/validate-json.yml
vendored
@@ -1,5 +1,6 @@
|
|||||||
name: Validate people.json
|
name: Validate people.json
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- 'people.json'
|
- 'people.json'
|
||||||
@@ -9,21 +10,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout this repository
|
- name: Checkout this repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4.1.0
|
||||||
|
|
||||||
- name: Setting up Node.js
|
- name: Setting up Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4.0.2
|
||||||
with:
|
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
|
run: npm i eslint-plugin-json
|
||||||
|
|
||||||
- name: Validate the JSON
|
- name: Validate the JSON
|
||||||
run: npx eslint people.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
|
|
||||||
|
|||||||
10
eslint.config.js
Normal file
10
eslint.config.js
Normal file
@@ -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,
|
||||||
|
},
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user