mirror of
				https://git.openwrt.org/project/luci.git
				synced 2025-10-31 09:38:43 +08:00 
			
		
		
		
	ci: lint JSON files using ESLint
Add GitHub Actions CI which lints json files using official ESLint json plugin. Signed-off-by: Yanase Yuki <dev@zpc.st>
This commit is contained in:
		
							
								
								
									
										33
									
								
								.github/workflows/eslint.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								.github/workflows/eslint.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,33 @@ | ||||
| --- | ||||
| name: "LuCI repo ESLint JSON Analysis" | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     branches: [ "master" ] | ||||
|     path: | ||||
|       - '**/*.json' | ||||
|   pull_request: | ||||
|     branches: [ "master" ] | ||||
|     path: | ||||
|       - '**/*.json' | ||||
| permissions: {} | ||||
|  | ||||
| jobs: | ||||
|   eslint: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Check out repository | ||||
|         uses: actions/checkout@v4 | ||||
|  | ||||
|       - name: Set up Node.js | ||||
|         uses: actions/setup-node@v4 | ||||
|         with: | ||||
|           node-version: latest | ||||
|  | ||||
|       - name: Install ESLint | ||||
|         run: npm install --no-audit --no-fund --save-dev eslint@latest @eslint/json@latest | ||||
|  | ||||
|       # Currently, we lint JSON only. | ||||
|       - name: Run ESLint | ||||
|         run: npx eslint **/*.json | ||||
|  | ||||
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -17,4 +17,5 @@ modules/luci-compat/src/plural_formula.c | ||||
| modules/luci-compat/src/plural_formula.h | ||||
| docs/jsapi/* | ||||
| !docs/jsapi/README.md | ||||
| **eslint.config** | ||||
| **eslint.config** | ||||
| !eslint.config.mjs | ||||
|  | ||||
							
								
								
									
										13
									
								
								eslint.config.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								eslint.config.mjs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| import { defineConfig } from "eslint/config"; | ||||
| import json from "@eslint/json"; | ||||
|  | ||||
| export default defineConfig([ | ||||
| 	{ | ||||
| 		files: ["**/*.json"], | ||||
| 		ignores: ["package-lock.json"], | ||||
| 		plugins: { json }, | ||||
| 		language: "json/json", | ||||
| 		extends: ["json/recommended"], | ||||
| 	}, | ||||
| ]); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Yanase Yuki
					Yanase Yuki