mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
508 lines
No EOL
17 KiB
JSON
508 lines
No EOL
17 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\", \"typescript\", \"unicorn\"], \"env\": { \"browser\": true }, \"globals\": { \"foo\": \"readonly\" }, \"settings\": { }, \"rules\": { \"eqeqeq\": \"warn\", \"import/no-cycle\": \"error\" }, \"overrides\": [ { \"files\": [\"*.test.ts\", \"*.spec.ts\"], \"rules\": { \"@typescript-eslint/no-explicit-any\": \"off\" } } ] } ```",
|
|
"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"
|
|
}
|
|
]
|
|
},
|
|
"ignorePatterns": {
|
|
"description": "Globs to ignore during linting. These are resolved from the configuration file path.",
|
|
"default": [],
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"overrides": {
|
|
"description": "Add, remove, or otherwise reconfigure rules for specific files or groups of files.",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/OxlintOverrides"
|
|
}
|
|
]
|
|
},
|
|
"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"
|
|
}
|
|
},
|
|
"GlobSet": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"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": {
|
|
"description": "Configure JSX A11y plugin rules.\n\nSee [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y#configurations)'s configuration for a full reference.",
|
|
"type": "object",
|
|
"properties": {
|
|
"components": {
|
|
"description": "To have your custom components be checked as DOM elements, you can provide a mapping of your component names to the DOM element name.\n\nExample:\n\n```json { \"settings\": { \"jsx-a11y\": { \"components\": { \"Link\": \"a\", \"IconButton\": \"button\" } } } } ```",
|
|
"default": {},
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"polymorphicPropName": {
|
|
"description": "An optional setting that define the prop your code uses to create polymorphic components. This setting will be used to determine the element type in rules that require semantic context.\n\nFor example, if you set the `polymorphicPropName` to `as`, then this element:\n\n```jsx <Box as=\"h3\">Hello</Box> ```\n\nWill be treated as an `h3`. If not set, this component will be treated as a `Box`.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"LintPlugins": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"NextPluginSettings": {
|
|
"description": "Configure Next.js plugin rules.",
|
|
"type": "object",
|
|
"properties": {
|
|
"rootDir": {
|
|
"description": "The root directory of the Next.js project.\n\nThis is particularly useful when you have a monorepo and your Next.js project is in a subfolder.\n\nExample:\n\n```json { \"settings\": { \"next\": { \"rootDir\": \"apps/dashboard/\" } } } ```",
|
|
"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"
|
|
}
|
|
},
|
|
"OxlintOverride": {
|
|
"type": "object",
|
|
"required": [
|
|
"files"
|
|
],
|
|
"properties": {
|
|
"files": {
|
|
"description": "A list of glob patterns to override.\n\n## Example `[ \"*.test.ts\", \"*.spec.ts\" ]`",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/GlobSet"
|
|
}
|
|
]
|
|
},
|
|
"plugins": {
|
|
"description": "Optionally change what plugins are enabled for this override. When omitted, the base config's plugins are used.",
|
|
"default": null,
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/LintPlugins"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"rules": {
|
|
"default": {},
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/OxlintRules"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"OxlintOverrides": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/OxlintOverride"
|
|
}
|
|
},
|
|
"OxlintRules": {
|
|
"$ref": "#/definitions/DummyRuleMap"
|
|
},
|
|
"OxlintSettings": {
|
|
"title": "Oxlint Plugin Settings",
|
|
"description": "Configure the behavior of linter plugins.\n\nHere's an example if you're using Next.js in a monorepo:\n\n```json { \"settings\": { \"next\": { \"rootDir\": \"apps/dashboard/\" }, \"react\": { \"linkComponents\": [ { \"name\": \"Link\", \"linkAttribute\": \"to\" } ] }, \"jsx-a11y\": { \"components\": { \"Link\": \"a\", \"Button\": \"button\" } } } } ```",
|
|
"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": {
|
|
"description": "Configure React plugin rules.\n\nDerived from [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react#configuration-legacy-eslintrc-)",
|
|
"type": "object",
|
|
"properties": {
|
|
"formComponents": {
|
|
"description": "Components used as alternatives to `<form>` for forms, such as `<Formik>`.\n\nExample:\n\n```jsonc { \"settings\": { \"react\": { \"formComponents\": [ \"CustomForm\", // OtherForm is considered a form component and has an endpoint attribute { \"name\": \"OtherForm\", \"formAttribute\": \"endpoint\" }, // allows specifying multiple properties if necessary { \"name\": \"Form\", \"formAttribute\": [\"registerEndpoint\", \"loginEndpoint\"] } ] } } } ```",
|
|
"default": [],
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/CustomComponent"
|
|
}
|
|
},
|
|
"linkComponents": {
|
|
"description": "Components used as alternatives to `<a>` for linking, such as `<Link>`.\n\nExample:\n\n```jsonc { \"settings\": { \"react\": { \"linkComponents\": [ \"HyperLink\", // Use `linkAttribute` for components that use a different prop name // than `href`. { \"name\": \"MyLink\", \"linkAttribute\": \"to\" }, // allows specifying multiple properties if necessary { \"name\": \"Link\", \"linkAttribute\": [\"to\", \"href\"] } ] } } } ```",
|
|
"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"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
} |