oxc/npm/oxlint/configuration_schema.json
2024-10-28 14:49:16 +00:00

435 lines
No EOL
12 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Oxlintrc",
"description": "Oxlint Configuration File\n\nThis configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).\n\nUsage: `oxlint -c oxlintrc.json --import-plugin`\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 { \"$schema\": \"./node_modules/oxlint/configuration_schema.json\", \"plugins\": [\"import\", \"unicorn\"], \"env\": { \"browser\": true }, \"globals\": { \"foo\": \"readonly\" }, \"settings\": { }, \"rules\": { \"eqeqeq\": \"warn\", \"import/no-cycle\": \"error\" } } ```",
"type": "object",
"properties": {
"categories": {
"default": {},
"allOf": [
{
"$ref": "#/definitions/OxlintCategories"
}
]
},
"env": {
"description": "Environments enable and disable collections of global variables.",
"default": {
"builtin": true
},
"allOf": [
{
"$ref": "#/definitions/OxlintEnv"
}
]
},
"globals": {
"description": "Enabled or disabled specific global variables.",
"default": {},
"allOf": [
{
"$ref": "#/definitions/OxlintGlobals"
}
]
},
"plugins": {
"default": [
"react",
"unicorn",
"typescript",
"oxc"
],
"allOf": [
{
"$ref": "#/definitions/LintPlugins"
}
]
},
"rules": {
"description": "Example\n\n`.oxlintrc.json`\n\n```json { \"$schema\": \"./node_modules/oxlint/configuration_schema.json\", \"rules\": { \"eqeqeq\": \"warn\", \"import/no-cycle\": \"error\", \"prefer-const\": [\"error\", { \"ignoreReadBeforeAssign\": true }] } } ```\n\nSee [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html) for the list of rules.",
"default": {},
"allOf": [
{
"$ref": "#/definitions/OxlintRules"
}
]
},
"settings": {
"default": {
"jsx-a11y": {
"polymorphicPropName": null,
"components": {}
},
"next": {
"rootDir": []
},
"react": {
"formComponents": [],
"linkComponents": []
},
"jsdoc": {
"ignorePrivate": false,
"ignoreInternal": false,
"ignoreReplacesDocs": true,
"overrideReplacesDocs": true,
"augmentsExtendsReplacesDocs": false,
"implementsReplacesDocs": false,
"exemptDestructuredRootsFromChecks": false,
"tagNamePreference": {}
}
},
"allOf": [
{
"$ref": "#/definitions/OxlintSettings"
}
]
}
},
"definitions": {
"AllowWarnDeny": {
"oneOf": [
{
"description": "Oxlint rule.\n- \"allow\" or \"off\": Turn off the rule.\n- \"warn\": Turn the rule on as a warning (doesn't affect exit code).\n- \"error\" or \"deny\": Turn the rule on as an error (will exit with a failure code).",
"type": "string",
"enum": [
"allow",
"off",
"warn",
"error",
"deny"
]
},
{
"description": "Oxlint rule.\n \n- 0: Turn off the rule.\n- 1: Turn the rule on as a warning (doesn't affect exit code).\n- 2: Turn the rule on as an error (will exit with a failure code).",
"type": "integer",
"format": "uint32",
"maximum": 2.0,
"minimum": 0.0
}
]
},
"CustomComponent": {
"anyOf": [
{
"type": "string"
},
{
"type": "object",
"required": [
"attribute",
"name"
],
"properties": {
"attribute": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
{
"type": "object",
"required": [
"attributes",
"name"
],
"properties": {
"attributes": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
}
}
}
]
},
"DummyRule": {
"anyOf": [
{
"$ref": "#/definitions/AllowWarnDeny"
},
{
"type": "array",
"items": true
}
]
},
"DummyRuleMap": {
"description": "See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html)",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/DummyRule"
}
},
"GlobalValue": {
"type": "string",
"enum": [
"readonly",
"writeable",
"off"
]
},
"JSDocPluginSettings": {
"type": "object",
"properties": {
"augmentsExtendsReplacesDocs": {
"description": "Only for `require-(yields|returns|description|example|param|throws)` rule",
"default": false,
"type": "boolean"
},
"exemptDestructuredRootsFromChecks": {
"description": "Only for `require-param-type` and `require-param-description` rule",
"default": false,
"type": "boolean"
},
"ignoreInternal": {
"description": "For all rules but NOT apply to `empty-tags` rule",
"default": false,
"type": "boolean"
},
"ignorePrivate": {
"description": "For all rules but NOT apply to `check-access` and `empty-tags` rule",
"default": false,
"type": "boolean"
},
"ignoreReplacesDocs": {
"description": "Only for `require-(yields|returns|description|example|param|throws)` rule",
"default": true,
"type": "boolean"
},
"implementsReplacesDocs": {
"description": "Only for `require-(yields|returns|description|example|param|throws)` rule",
"default": false,
"type": "boolean"
},
"overrideReplacesDocs": {
"description": "Only for `require-(yields|returns|description|example|param|throws)` rule",
"default": true,
"type": "boolean"
},
"tagNamePreference": {
"default": {},
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/TagNamePreference"
}
}
}
},
"JSXA11yPluginSettings": {
"type": "object",
"properties": {
"components": {
"default": {},
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"polymorphicPropName": {
"type": [
"string",
"null"
]
}
}
},
"LintPlugins": {
"type": "array",
"items": {
"type": "string"
}
},
"NextPluginSettings": {
"type": "object",
"properties": {
"rootDir": {
"default": [],
"allOf": [
{
"$ref": "#/definitions/OneOrMany_for_String"
}
]
}
}
},
"OneOrMany_for_String": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"OxlintCategories": {
"title": "Rule Categories",
"description": "Configure an entire category of rules all at once.\n\nRules enabled or disabled this way will be overwritten by individual rules in the `rules` field.\n\n# Example\n```json\n{\n \"$schema\": \"./node_modules/oxlint/configuration_schema.json\",\n \"categories\": {\n \"correctness\": \"warn\"\n },\n \"rules\": {\n \"eslint/no-unused-vars\": \"error\"\n }\n}\n```",
"examples": [
{
"correctness": "warn"
}
],
"type": "object",
"properties": {
"correctness": {
"$ref": "#/definitions/AllowWarnDeny"
},
"nursery": {
"$ref": "#/definitions/AllowWarnDeny"
},
"pedantic": {
"$ref": "#/definitions/AllowWarnDeny"
},
"perf": {
"$ref": "#/definitions/AllowWarnDeny"
},
"restriction": {
"$ref": "#/definitions/AllowWarnDeny"
},
"style": {
"$ref": "#/definitions/AllowWarnDeny"
},
"suspicious": {
"$ref": "#/definitions/AllowWarnDeny"
}
}
},
"OxlintEnv": {
"description": "Predefine global variables.\n\nEnvironments specify what global variables are predefined. See [ESLint's list of environments](https://eslint.org/docs/v8.x/use/configure/language-options#specifying-environments) for what environments are available and what each one provides.",
"type": "object",
"additionalProperties": {
"type": "boolean"
}
},
"OxlintGlobals": {
"description": "Add or remove global variables.\n\nFor each global variable, set the corresponding value equal to `\"writable\"` to allow the variable to be overwritten or `\"readonly\"` to disallow overwriting.\n\nGlobals can be disabled by setting their value to `\"off\"`. For example, in an environment where most Es2015 globals are available but `Promise` is unavailable, you might use this config:\n\n```json\n\n{ \"$schema\": \"./node_modules/oxlint/configuration_schema.json\", \"env\": { \"es6\": true }, \"globals\": { \"Promise\": \"off\" } }\n\n```\n\nYou may also use `\"readable\"` or `false` to represent `\"readonly\"`, and `\"writeable\"` or `true` to represent `\"writable\"`.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/GlobalValue"
}
},
"OxlintRules": {
"$ref": "#/definitions/DummyRuleMap"
},
"OxlintSettings": {
"description": "Shared settings for plugins",
"type": "object",
"properties": {
"jsdoc": {
"default": {
"ignorePrivate": false,
"ignoreInternal": false,
"ignoreReplacesDocs": true,
"overrideReplacesDocs": true,
"augmentsExtendsReplacesDocs": false,
"implementsReplacesDocs": false,
"exemptDestructuredRootsFromChecks": false,
"tagNamePreference": {}
},
"allOf": [
{
"$ref": "#/definitions/JSDocPluginSettings"
}
]
},
"jsx-a11y": {
"default": {
"polymorphicPropName": null,
"components": {}
},
"allOf": [
{
"$ref": "#/definitions/JSXA11yPluginSettings"
}
]
},
"next": {
"default": {
"rootDir": []
},
"allOf": [
{
"$ref": "#/definitions/NextPluginSettings"
}
]
},
"react": {
"default": {
"formComponents": [],
"linkComponents": []
},
"allOf": [
{
"$ref": "#/definitions/ReactPluginSettings"
}
]
}
}
},
"ReactPluginSettings": {
"type": "object",
"properties": {
"formComponents": {
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/CustomComponent"
}
},
"linkComponents": {
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/CustomComponent"
}
}
}
},
"TagNamePreference": {
"anyOf": [
{
"type": "string"
},
{
"type": "object",
"required": [
"message",
"replacement"
],
"properties": {
"message": {
"type": "string"
},
"replacement": {
"type": "string"
}
}
},
{
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string"
}
}
},
{
"type": "boolean"
}
]
}
}
}