diff --git a/src/options.js b/src/options.js index a6556dd..de4d0cc 100644 --- a/src/options.js +++ b/src/options.js @@ -1,5 +1,3 @@ -import schema from './options.json' with { type: 'json' }; - /** @typedef {import("eslint").ESLint.Options} ESLintOptions */ /** @typedef {import('eslint').ESLint.LintResult} LintResult */ /** @typedef {import('eslint').ESLint.LintResultData} LintResultData */ @@ -55,6 +53,20 @@ const removedOptionMessages = { quiet: "Use `severity.warning: 'off'` to hide ESLint warnings.", }; +const pluginOnlyOptionKeys = [ + 'configType', + 'context', + 'eslintPath', + 'exclude', + 'resourceQueryExclude', + 'files', + 'formatter', + 'lintDirtyModulesOnly', + 'lintAllFiles', + 'severity', + 'outputReport', +]; + /** * @param {Options} pluginOptions * @returns {PluginOptions} @@ -95,11 +107,7 @@ function getESLintOptions(loaderOptions) { const eslintOptions = { ...loaderOptions }; - // Keep the fix option because it is common to both the loader and ESLint. - const { fix, extensions, ...eslintOnlyOptions } = schema.properties; - - // No need to guard the for-in because schema.properties has hardcoded keys. - for (const option in eslintOnlyOptions) { + for (const option of pluginOnlyOptionKeys) { // @ts-ignore delete eslintOptions[option]; } diff --git a/src/options.json b/src/options.json deleted file mode 100644 index 5f57fd8..0000000 --- a/src/options.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "type": "object", - "additionalProperties": true, - "properties": { - "configType": { - "description": "Specify the type of configuration to use with ESLint, `flat` or `eslintrc`.", - "type": "string" - }, - "context": { - "description": "A string indicating the root of your files.", - "type": "string" - }, - "eslintPath": { - "description": "Path to `eslint` instance that will be used for linting. If the `eslintPath` is a folder like a official eslint, or specify a `formatter` option. now you don't have to install `eslint`.", - "type": "string" - }, - "exclude": { - "description": "Specify the files and/or directories to exclude. Must be relative to `options.context`.", - "anyOf": [{ "type": "string" }, { "type": "array" }] - }, - "resourceQueryExclude": { - "description": "Specify the resource query to exclude.", - "anyOf": [{ "instanceof": "RegExp" }, { "type": "array" }] - }, - "files": { - "description": "Specify the files and/or directories to traverse. Must be relative to `options.context`.", - "anyOf": [{ "type": "string" }, { "type": "array" }] - }, - "extensions": { - "description": "Specify extensions that should be checked.", - "anyOf": [{ "type": "string" }, { "type": "array" }] - }, - "fix": { - "description": "Will enable ESLint autofix feature", - "type": "boolean" - }, - "formatter": { - "description": "Accepts a function that will have one argument: an array of eslint messages (object). The function must return the output as a string.", - "anyOf": [{ "type": "string" }, { "instanceof": "Function" }] - }, - "lintDirtyModulesOnly": { - "description": "Lint only changed files, skip lint on start.", - "type": "boolean" - }, - "lintAllFiles": { - "description": "Lint all files matching the `files` and `extensions` patterns, regardless of whether they are part of the compilation. Useful for multi-environment builds where you want to check the entire codebase.", - "type": "boolean" - }, - "severity": { - "description": "Controls how ESLint errors and warnings are emitted as Rspack diagnostics.", - "type": "object", - "additionalProperties": false, - "properties": { - "error": { - "description": "Rspack diagnostic level for ESLint errors.", - "enum": ["error", "warning", "off"] - }, - "warning": { - "description": "Rspack diagnostic level for ESLint warnings.", - "enum": ["error", "warning", "off"] - } - } - }, - "outputReport": { - "description": "Write the output of the errors to a file, for example a checkstyle xml file for use for reporting on Jenkins CI", - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "additionalProperties": false, - "properties": { - "filePath": { - "description": "The `filePath` is relative to the webpack config: output.path", - "anyOf": [{ "type": "string" }] - }, - "formatter": { - "description": "You can pass in a different formatter for the output file, if none is passed in the default/configured formatter will be used", - "anyOf": [{ "type": "string" }, { "instanceof": "Function" }] - } - } - } - ] - } - } -}