feat(vscode): provide config's schema to oxlint config files (#4826)

Updates the VSCode plugin client to automatically provide our
auto-generated
JSON schema to `\.?oxlint(rc)?(\.json)?` files.
This commit is contained in:
Don Isaac 2024-08-11 21:15:47 -04:00 committed by GitHub
parent 096ac7bee5
commit cc922f4c89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 30 additions and 6 deletions

View file

@ -28,7 +28,7 @@ use crate::{
///
/// ::: danger NOTE
///
/// Only the `.json` format is supported.
/// Only the `.json` format is supported. You can use comments in configuration files.
///
/// :::
///

View file

@ -5,7 +5,7 @@ expression: json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "OxlintConfig",
"description": "Oxlint Configuration File\n\nThis configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).\n\nUsage: `oxlint -c oxlintrc.json`\n\n::: danger NOTE\n\nOnly the `.json` format is supported.\n\n:::\n\nExample\n\n`.oxlintrc.json`\n\n```json { \"env\": { \"browser\": true }, \"globals\": { \"foo\": \"readonly\" }, \"settings\": { }, \"rules\": { \"eqeqeq\": \"warn\" } } ```",
"description": "Oxlint Configuration File\n\nThis configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).\n\nUsage: `oxlint -c oxlintrc.json`\n\n::: danger NOTE\n\nOnly the `.json` format is supported. You can use comments in configuration files.\n\n:::\n\nExample\n\n`.oxlintrc.json`\n\n```json { \"env\": { \"browser\": true }, \"globals\": { \"foo\": \"readonly\" }, \"settings\": { }, \"rules\": { \"eqeqeq\": \"warn\" } } ```",
"type": "object",
"properties": {
"env": {

View file

@ -101,7 +101,31 @@
"description": "Path to ESlint configuration."
}
}
}
},
"jsonValidation": [
{
"fileMatch": [
"oxlintrc.json",
"oxlint.json",
".oxlintrc.json",
".oxlint.json",
".oxlintrc"
],
"url": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json"
}
],
"languages": [
{
"id": "jsonc",
"filenames": [
"oxlintrc.json",
"oxlint.json",
".oxlintrc.json",
".oxlint.json",
".oxlintrc"
]
}
]
},
"scripts": {
"preinstall": "[ -f icon.png ] || curl https://cdn.jsdelivr.net/gh/oxc-project/oxc-assets/square.png --output icon.png",
@ -130,4 +154,4 @@
"vsce": {
"dependencies": false
}
}
}

View file

@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "OxlintConfig",
"description": "Oxlint Configuration File\n\nThis configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).\n\nUsage: `oxlint -c oxlintrc.json`\n\n::: danger NOTE\n\nOnly the `.json` format is supported.\n\n:::\n\nExample\n\n`.oxlintrc.json`\n\n```json { \"env\": { \"browser\": true }, \"globals\": { \"foo\": \"readonly\" }, \"settings\": { }, \"rules\": { \"eqeqeq\": \"warn\" } } ```",
"description": "Oxlint Configuration File\n\nThis configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).\n\nUsage: `oxlint -c oxlintrc.json`\n\n::: danger NOTE\n\nOnly the `.json` format is supported. You can use comments in configuration files.\n\n:::\n\nExample\n\n`.oxlintrc.json`\n\n```json { \"env\": { \"browser\": true }, \"globals\": { \"foo\": \"readonly\" }, \"settings\": { }, \"rules\": { \"eqeqeq\": \"warn\" } } ```",
"type": "object",
"properties": {
"env": {

View file

@ -10,7 +10,7 @@ Usage: `oxlint -c oxlintrc.json`
::: danger NOTE
Only the `.json` format is supported.
Only the `.json` format is supported. You can use comments in configuration files.
:::