From 036ee57ad1c8f277aaa50b0c91877df1146b661a Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Thu, 13 Apr 2023 17:40:32 +0930 Subject: [PATCH 01/16] feat: improve rule schemas, add test to validate schemas, add tooling to generate schema types --- .github/workflows/ci.yml | 1 + packages/eslint-plugin/package.json | 2 + .../eslint-plugin/src/rules/array-type.ts | 39 +- .../eslint-plugin/src/rules/ban-ts-comment.ts | 66 +- packages/eslint-plugin/src/rules/ban-types.ts | 58 +- .../rules/explicit-member-accessibility.ts | 89 +- .../src/rules/lines-around-comment.ts | 164 +- .../src/rules/lines-between-class-members.ts | 20 +- .../src/rules/no-restricted-imports.ts | 115 +- .../src/rules/parameter-properties.ts | 57 +- .../src/rules/prefer-readonly.ts | 2 +- .../adjacent-overload-signatures.shot | 14 + .../tests/schema-snapshots/array-type.shot | 40 + .../schema-snapshots/await-thenable.shot | 14 + .../schema-snapshots/ban-ts-comment.shot | 53 + .../schema-snapshots/ban-tslint-comment.shot | 14 + .../tests/schema-snapshots/ban-types.shot | 87 + .../tests/schema-snapshots/block-spacing.shot | 14 + .../tests/schema-snapshots/brace-style.shot | 28 + .../class-literal-property-style.shot | 14 + .../tests/schema-snapshots/comma-dangle.shot | 75 + .../tests/schema-snapshots/comma-spacing.shot | 28 + .../consistent-generic-constructors.shot | 14 + .../consistent-indexed-object-style.shot | 14 + .../consistent-type-assertions.shot | 44 + .../consistent-type-definitions.shot | 14 + .../consistent-type-exports.shot | 26 + .../consistent-type-imports.shot | 30 + .../schema-snapshots/default-param-last.shot | 14 + .../tests/schema-snapshots/dot-notation.shot | 43 + .../explicit-function-return-type.shot | 73 + .../explicit-member-accessibility.shot | 74 + .../explicit-module-boundary-types.shot | 57 + .../schema-snapshots/func-call-spacing.shot | 48 + .../schema-snapshots/init-declarations.shot | 48 + .../tests/schema-snapshots/key-spacing.shot | 168 + .../schema-snapshots/keyword-spacing.shot | 864 ++++ .../lines-around-comment.shot | 76 + .../lines-between-class-members.shot | 30 + .../member-delimiter-style.shot | 122 + .../schema-snapshots/member-ordering.shot | 3719 +++++++++++++++++ .../method-signature-style.shot | 14 + .../schema-snapshots/naming-convention.shot | 3473 +++++++++++++++ .../no-array-constructor.shot | 14 + .../schema-snapshots/no-base-to-string.shot | 26 + .../no-confusing-non-null-assertion.shot | 14 + .../no-confusing-void-expression.shot | 28 + .../no-dupe-class-members.shot | 14 + .../no-duplicate-enum-values.shot | 14 + .../no-duplicate-type-constituents.shot | 28 + .../schema-snapshots/no-dynamic-delete.shot | 14 + .../schema-snapshots/no-empty-function.shot | 62 + .../schema-snapshots/no-empty-interface.shot | 24 + .../schema-snapshots/no-explicit-any.shot | 36 + .../no-extra-non-null-assertion.shot | 14 + .../schema-snapshots/no-extra-parens.shot | 68 + .../tests/schema-snapshots/no-extra-semi.shot | 14 + .../schema-snapshots/no-extraneous-class.shot | 48 + .../no-floating-promises.shot | 36 + .../schema-snapshots/no-for-in-array.shot | 14 + .../schema-snapshots/no-implied-eval.shot | 14 + .../no-import-type-side-effects.shot | 14 + .../schema-snapshots/no-inferrable-types.shot | 28 + .../schema-snapshots/no-invalid-this.shot | 26 + .../no-invalid-void-type.shot | 33 + .../tests/schema-snapshots/no-loop-func.shot | 14 + .../no-loss-of-precision.shot | 14 + .../schema-snapshots/no-magic-numbers.shot | 53 + .../no-meaningless-void-operator.shot | 24 + .../schema-snapshots/no-misused-new.shot | 14 + .../schema-snapshots/no-misused-promises.shot | 52 + .../schema-snapshots/no-mixed-enums.shot | 14 + .../tests/schema-snapshots/no-namespace.shot | 36 + ...-non-null-asserted-nullish-coalescing.shot | 14 + .../no-non-null-asserted-optional-chain.shot | 14 + .../no-non-null-assertion.shot | 14 + .../tests/schema-snapshots/no-redeclare.shot | 28 + .../no-redundant-type-constituents.shot | 14 + .../schema-snapshots/no-require-imports.shot | 14 + .../no-restricted-imports.shot | 147 + .../tests/schema-snapshots/no-shadow.shot | 36 + .../tests/schema-snapshots/no-this-alias.shot | 37 + .../schema-snapshots/no-throw-literal.shot | 28 + .../tests/schema-snapshots/no-type-alias.shot | 116 + ...o-unnecessary-boolean-literal-compare.shot | 36 + .../no-unnecessary-condition.shot | 36 + .../no-unnecessary-qualifier.shot | 14 + .../no-unnecessary-type-arguments.shot | 14 + .../no-unnecessary-type-assertion.shot | 30 + .../no-unnecessary-type-constraint.shot | 14 + .../schema-snapshots/no-unsafe-argument.shot | 14 + .../no-unsafe-assignment.shot | 14 + .../schema-snapshots/no-unsafe-call.shot | 14 + .../no-unsafe-declaration-merging.shot | 14 + .../no-unsafe-enum-comparison.shot | 14 + .../no-unsafe-member-access.shot | 14 + .../schema-snapshots/no-unsafe-return.shot | 14 + .../no-unused-expressions.shot | 32 + .../schema-snapshots/no-unused-vars.shot | 46 + .../no-use-before-define.shot | 44 + .../no-useless-constructor.shot | 14 + .../no-useless-empty-export.shot | 14 + .../schema-snapshots/no-var-requires.shot | 14 + .../non-nullable-type-assertion-style.shot | 14 + .../object-curly-spacing.shot | 30 + .../padding-line-between-statements.shot | 264 ++ .../parameter-properties.shot | 54 + .../schema-snapshots/prefer-as-const.shot | 14 + .../prefer-enum-initializers.shot | 14 + .../tests/schema-snapshots/prefer-for-of.shot | 14 + .../prefer-function-type.shot | 14 + .../schema-snapshots/prefer-includes.shot | 14 + .../prefer-literal-enum-member.shot | 24 + .../prefer-namespace-keyword.shot | 14 + .../prefer-nullish-coalescing.shot | 34 + .../prefer-optional-chain.shot | 14 + .../prefer-readonly-parameter-types.shot | 114 + .../schema-snapshots/prefer-readonly.shot | 24 + .../prefer-reduce-type-parameter.shot | 14 + .../schema-snapshots/prefer-regexp-exec.shot | 14 + .../prefer-return-this-type.shot | 14 + .../prefer-string-starts-ends-with.shot | 14 + .../prefer-ts-expect-error.shot | 14 + .../promise-function-async.shot | 45 + .../tests/schema-snapshots/quotes.shot | 38 + .../require-array-sort-compare.shot | 29 + .../tests/schema-snapshots/require-await.shot | 14 + .../restrict-plus-operands.shot | 36 + .../restrict-template-expressions.shot | 59 + .../tests/schema-snapshots/return-await.shot | 14 + .../tests/schema-snapshots/semi.shot | 69 + .../sort-type-constituents.shot | 71 + .../schema-snapshots/space-before-blocks.shot | 36 + .../space-before-function-paren.shot | 36 + .../schema-snapshots/space-infix-ops.shot | 24 + .../strict-boolean-expressions.shot | 44 + .../switch-exhaustiveness-check.shot | 14 + .../triple-slash-reference.shot | 30 + .../type-annotation-spacing.shot | 108 + .../tests/schema-snapshots/typedef.shot | 39 + .../schema-snapshots/unbound-method.shot | 30 + .../schema-snapshots/unified-signatures.shot | 30 + packages/eslint-plugin/tests/schemas.test.ts | 130 + packages/eslint-plugin/tsconfig.json | 1 + packages/repo-tools/package.json | 3 +- packages/repo-tools/tsconfig.build.json | 6 +- packages/repo-tools/tsconfig.json | 2 +- .../rule-schema-to-typescript-types/README.md | 9 + .../jest.config.js | 8 + .../package.json | 44 + .../project.json | 18 + .../src/index.ts | 470 +++ .../tsconfig.build.json | 11 + .../tsconfig.json | 9 + .../type-utils/src/TypeOrValueSpecifier.ts | 9 +- packages/type-utils/src/isTypeReadonly.ts | 3 +- packages/website/package.json | 2 +- .../website/plugins/generated-rule-docs.ts | 69 +- yarn.lock | 220 +- 159 files changed, 13600 insertions(+), 537 deletions(-) create mode 100644 packages/eslint-plugin/tests/schema-snapshots/adjacent-overload-signatures.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/array-type.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/await-thenable.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/ban-tslint-comment.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/ban-types.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/block-spacing.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/brace-style.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/class-literal-property-style.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/consistent-type-definitions.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/default-param-last.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-array-constructor.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-confusing-non-null-assertion.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-dupe-class-members.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-duplicate-enum-values.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-dynamic-delete.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-explicit-any.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-extra-non-null-assertion.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-extra-semi.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-extraneous-class.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-for-in-array.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-implied-eval.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-import-type-side-effects.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-invalid-this.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-loop-func.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-loss-of-precision.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-misused-new.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-mixed-enums.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-namespace.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-nullish-coalescing.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-optional-chain.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-non-null-assertion.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-redundant-type-constituents.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-require-imports.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-this-alias.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-throw-literal.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-qualifier.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-arguments.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-assertion.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-constraint.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unsafe-argument.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unsafe-assignment.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unsafe-call.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unsafe-declaration-merging.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unsafe-enum-comparison.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unsafe-member-access.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unsafe-return.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-useless-constructor.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-useless-empty-export.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/no-var-requires.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/non-nullable-type-assertion-style.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/object-curly-spacing.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-as-const.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-enum-initializers.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-for-of.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-function-type.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-includes.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-namespace-keyword.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-optional-chain.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-reduce-type-parameter.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-regexp-exec.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-return-this-type.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-string-starts-ends-with.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/prefer-ts-expect-error.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/quotes.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/require-array-sort-compare.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/require-await.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/return-await.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/semi.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/space-infix-ops.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/switch-exhaustiveness-check.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/typedef.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/unbound-method.shot create mode 100644 packages/eslint-plugin/tests/schema-snapshots/unified-signatures.shot create mode 100644 packages/eslint-plugin/tests/schemas.test.ts create mode 100644 packages/rule-schema-to-typescript-types/README.md create mode 100644 packages/rule-schema-to-typescript-types/jest.config.js create mode 100644 packages/rule-schema-to-typescript-types/package.json create mode 100644 packages/rule-schema-to-typescript-types/project.json create mode 100644 packages/rule-schema-to-typescript-types/src/index.ts create mode 100644 packages/rule-schema-to-typescript-types/tsconfig.build.json create mode 100644 packages/rule-schema-to-typescript-types/tsconfig.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6536fe37b7af..b5bebd18b49d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -145,6 +145,7 @@ jobs: 'eslint-plugin-tslint', 'parser', 'repo-tools', + 'rule-schema-to-typescript-types', 'scope-manager', 'type-utils', 'typescript-estree', diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 3a18f5526a26..be9923052bae 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -71,7 +71,9 @@ "@types/marked": "*", "@types/natural-compare-lite": "^1.4.0", "@types/prettier": "*", + "@typescript-eslint/rule-schema-to-typescript-types": "5.58.0", "cross-fetch": "*", + "jest-specific-snapshot": "*", "json-schema": "*", "markdown-table": "^3.0.2", "marked": "^4.0.15", diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index f30aebae1efb..dba2d7be00fe 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -105,30 +105,27 @@ export default util.createRule({ errorStringGenericSimple: "Array type using '{{readonlyPrefix}}{{type}}[]' is forbidden for non-simple types. Use '{{className}}<{{type}}>' instead.", }, - schema: { - $defs: { - arrayOption: { - enum: ['array', 'generic', 'array-simple'], + schema: [ + { + $defs: { + arrayOption: { + enum: ['array', 'generic', 'array-simple'], + }, }, - }, - prefixItems: [ - { - properties: { - default: { - $ref: '#/$defs/arrayOption', - description: 'The array type expected for mutable cases...', - }, - readonly: { - $ref: '#/$defs/arrayOption', - description: - 'The array type expected for readonly cases. If omitted, the value for `default` will be used.', - }, + properties: { + default: { + $ref: '#/items/0/$defs/arrayOption', + description: 'The array type expected for mutable cases...', + }, + readonly: { + $ref: '#/items/0/$defs/arrayOption', + description: + 'The array type expected for readonly cases. If omitted, the value for `default` will be used.', }, - type: 'object', }, - ], - type: 'array', - }, + type: 'object', + }, + ], }, defaultOptions: [ { diff --git a/packages/eslint-plugin/src/rules/ban-ts-comment.ts b/packages/eslint-plugin/src/rules/ban-ts-comment.ts index 818c23968eb2..2c2e68855056 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-comment.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-comment.ts @@ -39,45 +39,41 @@ export default util.createRule<[Options], MessageIds>({ tsDirectiveCommentDescriptionNotMatchPattern: 'The description for the "@ts-{{directive}}" directive must match the {{format}} format.', }, - schema: { - $defs: { - directiveConfigSchema: { - oneOf: [ - { - type: 'boolean', - default: true, - }, - { - enum: ['allow-with-description'], - }, - { - type: 'object', - properties: { - descriptionFormat: { type: 'string' }, + schema: [ + { + $defs: { + directiveConfigSchema: { + oneOf: [ + { + type: 'boolean', + default: true, }, - }, - ], + { + enum: ['allow-with-description'], + }, + { + type: 'object', + properties: { + descriptionFormat: { type: 'string' }, + }, + }, + ], + }, }, - }, - prefixItems: [ - { - properties: { - 'ts-expect-error': { - $ref: '#/$defs/directiveConfigSchema', - }, - 'ts-ignore': { $ref: '#/$defs/directiveConfigSchema' }, - 'ts-nocheck': { $ref: '#/$defs/directiveConfigSchema' }, - 'ts-check': { $ref: '#/$defs/directiveConfigSchema' }, - minimumDescriptionLength: { - type: 'number', - default: defaultMinimumDescriptionLength, - }, + properties: { + 'ts-expect-error': { $ref: '#/items/0/$defs/directiveConfigSchema' }, + 'ts-ignore': { $ref: '#/items/0/$defs/directiveConfigSchema' }, + 'ts-nocheck': { $ref: '#/items/0/$defs/directiveConfigSchema' }, + 'ts-check': { $ref: '#/items/0/$defs/directiveConfigSchema' }, + minimumDescriptionLength: { + type: 'number', + default: defaultMinimumDescriptionLength, }, - additionalProperties: false, }, - ], - type: 'array', - }, + type: 'object', + additionalProperties: false, + }, + ], }, defaultOptions: [ { diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index 8ba3c18198e0..8029233c1508 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -6,7 +6,7 @@ import * as util from '../util'; type Types = Record< string, | null - | false + | boolean | string | { message: string; @@ -34,9 +34,9 @@ function stringifyNode( } function getCustomMessage( - bannedType: null | string | { message?: string; fixWith?: string }, + bannedType: null | true | string | { message?: string; fixWith?: string }, ): string { - if (bannedType == null) { + if (bannedType == null || bannedType === true) { return ''; } @@ -128,24 +128,50 @@ export default util.createRule({ }, schema: [ { + $defs: { + banConfig: { + oneOf: [ + { + type: 'null', + description: 'Bans the type with the default message', + }, + { + enum: [false], + description: + 'Un-bans the type (useful when paired with `extendDefaults`)', + }, + { + enum: [true], + description: 'Bans the type with the default message', + }, + { + type: 'string', + description: 'Bans the type with a custom message', + }, + { + type: 'object', + description: 'Bans a type', + properties: { + message: { + type: 'string', + description: 'Custom error message', + }, + fixWith: { + type: 'string', + description: 'Type to autofix replace with.', + }, + }, + additionalProperties: false, + }, + ], + }, + }, type: 'object', properties: { types: { type: 'object', additionalProperties: { - oneOf: [ - { type: 'null' }, - { type: 'boolean' }, - { type: 'string' }, - { - type: 'object', - properties: { - message: { type: 'string' }, - fixWith: { type: 'string' }, - }, - additionalProperties: false, - }, - ], + $ref: '#/items/0/$defs/banConfig', }, }, extendDefaults: { diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index efaece677b14..71a85b4e701b 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -27,23 +27,6 @@ type MessageIds = | 'missingAccessibility' | 'addExplicitAccessibility'; -const accessibilityLevel = { - oneOf: [ - { - const: 'explicit', - description: 'Always require an accessor.', - }, - { - const: 'no-public', - description: 'Require an accessor except when public.', - }, - { - const: 'off', - description: 'Never check whether there is an accessor.', - }, - ], -}; - export default util.createRule({ name: 'explicit-member-accessibility', meta: { @@ -62,41 +45,53 @@ export default util.createRule({ 'Public accessibility modifier on {{type}} {{name}}.', addExplicitAccessibility: "Add '{{ type }}' accessibility modifier", }, - schema: { - $defs: { - accessibilityLevel, - }, - prefixItems: [ - { - type: 'object', - properties: { - accessibility: { $ref: '#/$defs/accessibilityLevel' }, - overrides: { - type: 'object', - properties: { - accessors: { $ref: '#/$defs/accessibilityLevel' }, - constructors: { $ref: '#/$defs/accessibilityLevel' }, - methods: { $ref: '#/$defs/accessibilityLevel' }, - properties: { $ref: '#/$defs/accessibilityLevel' }, - parameterProperties: { - $ref: '#/$defs/accessibilityLevel', - }, + schema: [ + { + $defs: { + accessibilityLevel: { + oneOf: [ + { + enum: ['explicit'], + description: 'Always require an accessor.', }, - - additionalProperties: false, - }, - ignoredMethodNames: { - type: 'array', - items: { - type: 'string', + { + enum: ['no-public'], + description: 'Require an accessor except when public.', + }, + { + enum: ['off'], + description: 'Never check whether there is an accessor.', }, + ], + }, + }, + type: 'object', + properties: { + accessibility: { $ref: '#/items/0/$defs/accessibilityLevel' }, + overrides: { + type: 'object', + properties: { + accessors: { $ref: '#/items/0/$defs/accessibilityLevel' }, + constructors: { $ref: '#/items/0/$defs/accessibilityLevel' }, + methods: { $ref: '#/items/0/$defs/accessibilityLevel' }, + properties: { $ref: '#/items/0/$defs/accessibilityLevel' }, + parameterProperties: { + $ref: '#/items/0/$defs/accessibilityLevel', + }, + }, + + additionalProperties: false, + }, + ignoredMethodNames: { + type: 'array', + items: { + type: 'string', }, }, - additionalProperties: false, }, - ], - type: 'array', - }, + additionalProperties: false, + }, + ], }, defaultOptions: [{ accessibility: 'explicit' }], create(context, [option]) { diff --git a/packages/eslint-plugin/src/rules/lines-around-comment.ts b/packages/eslint-plugin/src/rules/lines-around-comment.ts index fa09177865f6..a868b2a4510d 100644 --- a/packages/eslint-plugin/src/rules/lines-around-comment.ts +++ b/packages/eslint-plugin/src/rules/lines-around-comment.ts @@ -50,89 +50,91 @@ export default util.createRule({ description: 'Require empty lines around comments', extendsBaseRule: true, }, - schema: { - type: 'array', - items: [ - { - type: 'object', - properties: { - beforeBlockComment: { - type: 'boolean', - default: true, - }, - afterBlockComment: { - type: 'boolean', - default: false, - }, - beforeLineComment: { - type: 'boolean', - default: false, - }, - afterLineComment: { - type: 'boolean', - default: false, - }, - allowBlockStart: { - type: 'boolean', - default: false, - }, - allowBlockEnd: { - type: 'boolean', - default: false, - }, - allowClassStart: { - type: 'boolean', - }, - allowClassEnd: { - type: 'boolean', - }, - allowObjectStart: { - type: 'boolean', - }, - allowObjectEnd: { - type: 'boolean', - }, - allowArrayStart: { - type: 'boolean', - }, - allowArrayEnd: { - type: 'boolean', - }, - allowInterfaceStart: { - type: 'boolean', - }, - allowInterfaceEnd: { - type: 'boolean', - }, - allowTypeStart: { - type: 'boolean', - }, - allowTypeEnd: { - type: 'boolean', - }, - allowEnumStart: { - type: 'boolean', - }, - allowEnumEnd: { - type: 'boolean', - }, - allowModuleStart: { - type: 'boolean', - }, - allowModuleEnd: { - type: 'boolean', - }, - ignorePattern: { - type: 'string', - }, - applyDefaultIgnorePatterns: { - type: 'boolean', + schema: [ + { + type: 'array', + items: [ + { + type: 'object', + properties: { + beforeBlockComment: { + type: 'boolean', + default: true, + }, + afterBlockComment: { + type: 'boolean', + default: false, + }, + beforeLineComment: { + type: 'boolean', + default: false, + }, + afterLineComment: { + type: 'boolean', + default: false, + }, + allowBlockStart: { + type: 'boolean', + default: false, + }, + allowBlockEnd: { + type: 'boolean', + default: false, + }, + allowClassStart: { + type: 'boolean', + }, + allowClassEnd: { + type: 'boolean', + }, + allowObjectStart: { + type: 'boolean', + }, + allowObjectEnd: { + type: 'boolean', + }, + allowArrayStart: { + type: 'boolean', + }, + allowArrayEnd: { + type: 'boolean', + }, + allowInterfaceStart: { + type: 'boolean', + }, + allowInterfaceEnd: { + type: 'boolean', + }, + allowTypeStart: { + type: 'boolean', + }, + allowTypeEnd: { + type: 'boolean', + }, + allowEnumStart: { + type: 'boolean', + }, + allowEnumEnd: { + type: 'boolean', + }, + allowModuleStart: { + type: 'boolean', + }, + allowModuleEnd: { + type: 'boolean', + }, + ignorePattern: { + type: 'string', + }, + applyDefaultIgnorePatterns: { + type: 'boolean', + }, }, + additionalProperties: false, }, - additionalProperties: false, - }, - ], - }, + ], + }, + ], fixable: baseRule.meta.fixable, hasSuggestions: baseRule.meta.hasSuggestions, messages: baseRule.meta.messages, diff --git a/packages/eslint-plugin/src/rules/lines-between-class-members.ts b/packages/eslint-plugin/src/rules/lines-between-class-members.ts index 6a8cd7358623..1b2266900ef5 100644 --- a/packages/eslint-plugin/src/rules/lines-between-class-members.ts +++ b/packages/eslint-plugin/src/rules/lines-between-class-members.ts @@ -9,16 +9,20 @@ const baseRule = getESLintCoreRule('lines-between-class-members'); type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; -const schema = util.deepMerge( - { ...baseRule.meta.schema }, - { - 1: { - exceptAfterOverload: { - type: 'boolean', - default: true, +const schema = Object.values( + util.deepMerge( + { ...baseRule.meta.schema }, + { + 1: { + properties: { + exceptAfterOverload: { + type: 'boolean', + default: true, + }, + }, }, }, - }, + ), ); export default util.createRule({ diff --git a/packages/eslint-plugin/src/rules/no-restricted-imports.ts b/packages/eslint-plugin/src/rules/no-restricted-imports.ts index 48bf8f55c2d0..a1981e772bbd 100644 --- a/packages/eslint-plugin/src/rules/no-restricted-imports.ts +++ b/packages/eslint-plugin/src/rules/no-restricted-imports.ts @@ -1,4 +1,5 @@ import type { TSESTree } from '@typescript-eslint/utils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import type { ArrayOfStringOrObject, ArrayOfStringOrObjectPatterns, @@ -10,7 +11,7 @@ import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule, } from '../util'; -import { createRule, deepMerge } from '../util'; +import { createRule } from '../util'; import { getESLintCoreRule } from '../util/getESLintCoreRule'; const baseRule = getESLintCoreRule('no-restricted-imports'); @@ -18,48 +19,86 @@ const baseRule = getESLintCoreRule('no-restricted-imports'); export type Options = InferOptionsTypeFromRule; export type MessageIds = InferMessageIdsTypeFromRule; -const allowTypeImportsOptionSchema = { - allowTypeImports: { - type: 'boolean', - default: false, - }, -}; -const schemaForMergeArrayOfStringsOrObjects = { +const arrayOfStringsOrObjects: JSONSchema4 = { + type: 'array', items: { anyOf: [ - {}, + { type: 'string' }, { - properties: allowTypeImportsOptionSchema, + type: 'object', + properties: { + name: { type: 'string' }, + message: { + type: 'string', + minLength: 1, + }, + importNames: { + type: 'array', + items: { + type: 'string', + }, + }, + allowTypeImports: { + type: 'boolean', + default: false, + }, + }, + additionalProperties: false, + required: ['name'], }, ], }, + uniqueItems: true, }; -const schemaForMergeArrayOfStringsOrObjectPatterns = { +const arrayOfStringsOrObjectPatterns: JSONSchema4 = { anyOf: [ - {}, { + type: 'array', items: { - properties: allowTypeImportsOptionSchema, + type: 'string', }, + uniqueItems: true, }, - ], -}; -const schema = deepMerge( - { ...baseRule.meta.schema }, - { - anyOf: [ - schemaForMergeArrayOfStringsOrObjects, - { - items: { - properties: { - paths: schemaForMergeArrayOfStringsOrObjects, - patterns: schemaForMergeArrayOfStringsOrObjectPatterns, + { + type: 'array', + items: { + type: 'object', + properties: { + importNames: { + type: 'array', + items: { + type: 'string', + }, + minItems: 1, + uniqueItems: true, + }, + group: { + type: 'array', + items: { + type: 'string', + }, + minItems: 1, + uniqueItems: true, + }, + message: { + type: 'string', + minLength: 1, + }, + caseSensitive: { + type: 'boolean', + }, + allowTypeImports: { + type: 'boolean', + default: false, }, }, + additionalProperties: false, + required: ['group'], }, - ], - }, -); + uniqueItems: true, + }, + ], +}; function isObjectOfPaths( obj: unknown, @@ -114,7 +153,25 @@ export default createRule({ }, messages: baseRule.meta.messages, fixable: baseRule.meta.fixable, - schema, + schema: { + anyOf: [ + arrayOfStringsOrObjects, + { + type: 'array', + items: [ + { + type: 'object', + properties: { + paths: arrayOfStringsOrObjects, + patterns: arrayOfStringsOrObjectPatterns, + }, + additionalProperties: false, + }, + ], + additionalItems: false, + }, + ], + }, }, defaultOptions: [], create(context) { diff --git a/packages/eslint-plugin/src/rules/parameter-properties.ts b/packages/eslint-plugin/src/rules/parameter-properties.ts index 2d75a9c7b6ea..10c15b061779 100644 --- a/packages/eslint-plugin/src/rules/parameter-properties.ts +++ b/packages/eslint-plugin/src/rules/parameter-properties.ts @@ -37,40 +37,37 @@ export default util.createRule({ preferParameterProperty: 'Property {{parameter}} should be declared as a parameter property.', }, - schema: { - $defs: { - modifier: { - enum: [ - 'readonly', - 'private', - 'protected', - 'public', - 'private readonly', - 'protected readonly', - 'public readonly', - ], + schema: [ + { + $defs: { + modifier: { + enum: [ + 'readonly', + 'private', + 'protected', + 'public', + 'private readonly', + 'protected readonly', + 'public readonly', + ], + }, }, - }, - prefixItems: [ - { - type: 'object', - properties: { - allow: { - type: 'array', - items: { - $ref: '#/$defs/modifier', - }, - minItems: 1, - }, - prefer: { - enum: ['class-property', 'parameter-property'], + type: 'object', + properties: { + allow: { + type: 'array', + items: { + $ref: '#/items/0/$defs/modifier', }, + minItems: 1, + }, + prefer: { + enum: ['class-property', 'parameter-property'], }, - additionalProperties: false, }, - ], - type: 'array', - }, + additionalProperties: false, + }, + ], }, defaultOptions: [ { diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 0f83d598d292..1f177251dbc8 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -35,7 +35,7 @@ export default util.createRule({ }, schema: [ { - allowAdditionalProperties: false, + additionalProperties: false, properties: { onlyInlineLambdas: { type: 'boolean', diff --git a/packages/eslint-plugin/tests/schema-snapshots/adjacent-overload-signatures.shot b/packages/eslint-plugin/tests/schema-snapshots/adjacent-overload-signatures.shot new file mode 100644 index 000000000000..ee8e4edeee5c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/adjacent-overload-signatures.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes adjacent-overload-signatures 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/array-type.shot b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot new file mode 100644 index 000000000000..67477ffd9074 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes array-type 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "arrayOption": { "enum": ["array", "generic", "array-simple"] } + }, + "properties": { + "default": { + "$ref": "#/items/0/$defs/arrayOption", + "description": "The array type expected for mutable cases..." + }, + "readonly": { + "$ref": "#/items/0/$defs/arrayOption", + "description": "The array type expected for readonly cases. If omitted, the value for \`default\` will be used." + } + }, + "type": "object" + } +] + + +# TYPES: + +type ArrayOption = 'array' | 'generic' | 'array-simple'; + +type Options = [ + { + /** The array type expected for mutable cases... */ + default?: ArrayOption; + /** The array type expected for readonly cases. If omitted, the value for \`default\` will be used. */ + readonly?: ArrayOption; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/await-thenable.shot b/packages/eslint-plugin/tests/schema-snapshots/await-thenable.shot new file mode 100644 index 000000000000..ac87bfd93ca0 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/await-thenable.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes await-thenable 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot new file mode 100644 index 000000000000..0001d59850ca --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes ban-ts-comment 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "directiveConfigSchema": { + "oneOf": [ + { "type": "boolean", "default": true }, + { "enum": ["allow-with-description"] }, + { + "type": "object", + "properties": { "descriptionFormat": { "type": "string" } } + } + ] + } + }, + "properties": { + "ts-expect-error": { "$ref": "#/items/0/$defs/directiveConfigSchema" }, + "ts-ignore": { "$ref": "#/items/0/$defs/directiveConfigSchema" }, + "ts-nocheck": { "$ref": "#/items/0/$defs/directiveConfigSchema" }, + "ts-check": { "$ref": "#/items/0/$defs/directiveConfigSchema" }, + "minimumDescriptionLength": { "type": "number", "default": 3 } + }, + "type": "object", + "additionalProperties": false + } +] + + +# TYPES: + +type DirectiveConfigSchema = + | boolean + | 'allow-with-description' + | { + descriptionFormat?: string; + }; + +type Options = [ + { + 'ts-expect-error'?: DirectiveConfigSchema; + 'ts-ignore'?: DirectiveConfigSchema; + 'ts-nocheck'?: DirectiveConfigSchema; + 'ts-check'?: DirectiveConfigSchema; + minimumDescriptionLength?: number; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-tslint-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-tslint-comment.shot new file mode 100644 index 000000000000..2a45126d7835 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-tslint-comment.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes ban-tslint-comment 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot new file mode 100644 index 000000000000..73de7400fb6f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes ban-types 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "banConfig": { + "oneOf": [ + { + "type": "null", + "description": "Bans the type with the default message" + }, + { + "enum": [false], + "description": "Un-bans the type (useful when paired with \`extendDefaults\`)" + }, + { + "enum": [true], + "description": "Bans the type with the default message" + }, + { + "type": "string", + "description": "Bans the type with a custom message" + }, + { + "type": "object", + "description": "Bans a type", + "properties": { + "message": { + "type": "string", + "description": "Custom error message" + }, + "fixWith": { + "type": "string", + "description": "Type to autofix replace with." + } + }, + "additionalProperties": false + } + ] + } + }, + "type": "object", + "properties": { + "types": { + "type": "object", + "additionalProperties": { "$ref": "#/items/0/$defs/banConfig" } + }, + "extendDefaults": { "type": "boolean" } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type BanConfig = + /** Bans the type with the default message */ + | null + /** Un-bans the type (useful when paired with \`extendDefaults\`) */ + | false + /** Bans the type with the default message */ + | true + /** Bans the type with a custom message */ + | string + /** Bans a type */ + | { + /** Custom error message */ + message?: string; + /** Type to autofix replace with. */ + fixWith?: string; + }; + +type Options = [ + { + types?: { + [k: string]: BanConfig; + }; + extendDefaults?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/block-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/block-spacing.shot new file mode 100644 index 000000000000..247de3e16eb9 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/block-spacing.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes block-spacing 1`] = ` +" +# SCHEMA: + +[{ "enum": ["always", "never"] }] + + +# TYPES: + +type Options = ['always' | 'never']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot b/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot new file mode 100644 index 000000000000..f31093b13108 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes brace-style 1`] = ` +" +# SCHEMA: + +[ + { "enum": ["1tbs", "stroustrup", "allman"] }, + { + "type": "object", + "properties": { + "allowSingleLine": { "type": "boolean", "default": false } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + '1tbs' | 'stroustrup' | 'allman', + { + allowSingleLine?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/class-literal-property-style.shot b/packages/eslint-plugin/tests/schema-snapshots/class-literal-property-style.shot new file mode 100644 index 000000000000..25b73d52301e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/class-literal-property-style.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes class-literal-property-style 1`] = ` +" +# SCHEMA: + +[{ "enum": ["fields", "getters"] }] + + +# TYPES: + +type Options = ['fields' | 'getters']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot b/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot new file mode 100644 index 000000000000..dc66921aab1f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot @@ -0,0 +1,75 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes comma-dangle 1`] = ` +" +# SCHEMA: + +{ + "$defs": { + "value": { + "enum": ["always-multiline", "always", "never", "only-multiline"] + }, + "valueWithIgnore": { + "enum": [ + "always-multiline", + "always", + "never", + "only-multiline", + "ignore" + ] + } + }, + "type": "array", + "items": [ + { + "oneOf": [ + { "$ref": "#/$defs/value" }, + { + "type": "object", + "properties": { + "arrays": { "$ref": "#/$defs/valueWithIgnore" }, + "objects": { "$ref": "#/$defs/valueWithIgnore" }, + "imports": { "$ref": "#/$defs/valueWithIgnore" }, + "exports": { "$ref": "#/$defs/valueWithIgnore" }, + "functions": { "$ref": "#/$defs/valueWithIgnore" }, + "enums": { "$ref": "#/$defs/valueWithIgnore" }, + "generics": { "$ref": "#/$defs/valueWithIgnore" }, + "tuples": { "$ref": "#/$defs/valueWithIgnore" } + }, + "additionalProperties": false + } + ] + } + ], + "additionalProperties": false +} + + +# TYPES: + +type Value = 'always-multiline' | 'always' | 'never' | 'only-multiline'; + +type ValueWithIgnore = + | 'always-multiline' + | 'always' + | 'never' + | 'only-multiline' + | 'ignore'; + +type Options = + | [] + | [ + | Value + | { + arrays?: ValueWithIgnore; + objects?: ValueWithIgnore; + imports?: ValueWithIgnore; + exports?: ValueWithIgnore; + functions?: ValueWithIgnore; + enums?: ValueWithIgnore; + generics?: ValueWithIgnore; + tuples?: ValueWithIgnore; + }, + ]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot new file mode 100644 index 000000000000..88f8d825f50e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes comma-spacing 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "before": { "type": "boolean", "default": false }, + "after": { "type": "boolean", "default": true } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + before?: boolean; + after?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot new file mode 100644 index 000000000000..2f5b28c241e3 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-generic-constructors 1`] = ` +" +# SCHEMA: + +[{ "enum": ["type-annotation", "constructor"] }] + + +# TYPES: + +type Options = ['type-annotation' | 'constructor']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot new file mode 100644 index 000000000000..33a9fad4b1f8 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-indexed-object-style 1`] = ` +" +# SCHEMA: + +[{ "enum": ["record", "index-signature"] }] + + +# TYPES: + +type Options = ['record' | 'index-signature']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot new file mode 100644 index 000000000000..65f37e6895a2 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-type-assertions 1`] = ` +" +# SCHEMA: + +[ + { + "oneOf": [ + { + "type": "object", + "properties": { "assertionStyle": { "enum": ["never"] } }, + "additionalProperties": false, + "required": ["assertionStyle"] + }, + { + "type": "object", + "properties": { + "assertionStyle": { "enum": ["as", "angle-bracket"] }, + "objectLiteralTypeAssertions": { + "enum": ["allow", "allow-as-parameter", "never"] + } + }, + "additionalProperties": false, + "required": ["assertionStyle"] + } + ] + } +] + + +# TYPES: + +type Options = [ + | { + assertionStyle: 'never'; + } + | { + assertionStyle: 'as' | 'angle-bracket'; + objectLiteralTypeAssertions?: 'allow' | 'allow-as-parameter' | 'never'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-definitions.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-definitions.shot new file mode 100644 index 000000000000..39e80f8d4a97 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-definitions.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-type-definitions 1`] = ` +" +# SCHEMA: + +[{ "enum": ["interface", "type"] }] + + +# TYPES: + +type Options = ['interface' | 'type']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot new file mode 100644 index 000000000000..25760e3e56d2 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot @@ -0,0 +1,26 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-type-exports 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "fixMixedExportsWithInlineTypeSpecifier": { "type": "boolean" } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + fixMixedExportsWithInlineTypeSpecifier?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot new file mode 100644 index 000000000000..37b33c09b7b2 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-type-imports 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "prefer": { "enum": ["type-imports", "no-type-imports"] }, + "disallowTypeAnnotations": { "type": "boolean" }, + "fixStyle": { "enum": ["separate-type-imports", "inline-type-imports"] } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + prefer?: 'type-imports' | 'no-type-imports'; + disallowTypeAnnotations?: boolean; + fixStyle?: 'separate-type-imports' | 'inline-type-imports'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/default-param-last.shot b/packages/eslint-plugin/tests/schema-snapshots/default-param-last.shot new file mode 100644 index 000000000000..dccc93166449 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/default-param-last.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes default-param-last 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot new file mode 100644 index 000000000000..fef2c18492c0 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot @@ -0,0 +1,43 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes dot-notation 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowKeywords": { "type": "boolean", "default": true }, + "allowPattern": { "type": "string", "default": "" }, + "allowPrivateClassPropertyAccess": { + "type": "boolean", + "default": false + }, + "allowProtectedClassPropertyAccess": { + "type": "boolean", + "default": false + }, + "allowIndexSignaturePropertyAccess": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + allowKeywords?: boolean; + allowPattern?: string; + allowPrivateClassPropertyAccess?: boolean; + allowProtectedClassPropertyAccess?: boolean; + allowIndexSignaturePropertyAccess?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot new file mode 100644 index 000000000000..025e18a2b90e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot @@ -0,0 +1,73 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes explicit-function-return-type 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowConciseArrowFunctionExpressionsStartingWithVoid": { + "description": "Whether to allow arrow functions that start with the \`void\` keyword.", + "type": "boolean" + }, + "allowExpressions": { + "description": "Whether to ignore function expressions (functions which are not part of a declaration).", + "type": "boolean" + }, + "allowHigherOrderFunctions": { + "description": "Whether to ignore functions immediately returning another function expression.", + "type": "boolean" + }, + "allowTypedFunctionExpressions": { + "description": "Whether to ignore type annotations on the variable of function expressions.", + "type": "boolean" + }, + "allowDirectConstAssertionInArrowFunctions": { + "description": "Whether to ignore arrow functions immediately returning a \`as const\` value.", + "type": "boolean" + }, + "allowFunctionsWithoutTypeParameters": { + "description": "Whether to ignore functions that don't have generic type parameters.", + "type": "boolean" + }, + "allowedNames": { + "description": "An array of function/method names that will not have their arguments or return values checked.", + "items": { "type": "string" }, + "type": "array" + }, + "allowIIFEs": { + "description": "Whether to ignore immediately invoked function expressions (IIFEs).", + "type": "boolean" + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow arrow functions that start with the \`void\` keyword. */ + allowConciseArrowFunctionExpressionsStartingWithVoid?: boolean; + /** Whether to ignore function expressions (functions which are not part of a declaration). */ + allowExpressions?: boolean; + /** Whether to ignore functions immediately returning another function expression. */ + allowHigherOrderFunctions?: boolean; + /** Whether to ignore type annotations on the variable of function expressions. */ + allowTypedFunctionExpressions?: boolean; + /** Whether to ignore arrow functions immediately returning a \`as const\` value. */ + allowDirectConstAssertionInArrowFunctions?: boolean; + /** Whether to ignore functions that don't have generic type parameters. */ + allowFunctionsWithoutTypeParameters?: boolean; + /** An array of function/method names that will not have their arguments or return values checked. */ + allowedNames?: string[]; + /** Whether to ignore immediately invoked function expressions (IIFEs). */ + allowIIFEs?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot new file mode 100644 index 000000000000..aab5824e3d01 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes explicit-member-accessibility 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "accessibilityLevel": { + "oneOf": [ + { + "enum": ["explicit"], + "description": "Always require an accessor." + }, + { + "enum": ["no-public"], + "description": "Require an accessor except when public." + }, + { + "enum": ["off"], + "description": "Never check whether there is an accessor." + } + ] + } + }, + "type": "object", + "properties": { + "accessibility": { "$ref": "#/items/0/$defs/accessibilityLevel" }, + "overrides": { + "type": "object", + "properties": { + "accessors": { "$ref": "#/items/0/$defs/accessibilityLevel" }, + "constructors": { "$ref": "#/items/0/$defs/accessibilityLevel" }, + "methods": { "$ref": "#/items/0/$defs/accessibilityLevel" }, + "properties": { "$ref": "#/items/0/$defs/accessibilityLevel" }, + "parameterProperties": { + "$ref": "#/items/0/$defs/accessibilityLevel" + } + }, + "additionalProperties": false + }, + "ignoredMethodNames": { "type": "array", "items": { "type": "string" } } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type AccessibilityLevel = + /** Always require an accessor. */ + | 'explicit' + /** Require an accessor except when public. */ + | 'no-public' + /** Never check whether there is an accessor. */ + | 'off'; + +type Options = [ + { + accessibility?: AccessibilityLevel; + overrides?: { + accessors?: AccessibilityLevel; + constructors?: AccessibilityLevel; + methods?: AccessibilityLevel; + properties?: AccessibilityLevel; + parameterProperties?: AccessibilityLevel; + }; + ignoredMethodNames?: string[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot new file mode 100644 index 000000000000..2976d3a3a643 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes explicit-module-boundary-types 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowArgumentsExplicitlyTypedAsAny": { + "description": "Whether to ignore arguments that are explicitly typed as \`any\`.", + "type": "boolean" + }, + "allowDirectConstAssertionInArrowFunctions": { + "description": "Whether to ignore return type annotations on body-less arrow functions that return an \`as const\` type assertion.\\nYou must still type the parameters of the function.", + "type": "boolean" + }, + "allowedNames": { + "description": "An array of function/method names that will not have their arguments or return values checked.", + "items": { "type": "string" }, + "type": "array" + }, + "allowHigherOrderFunctions": { + "description": "Whether to ignore return type annotations on functions immediately returning another function expression.\\nYou must still type the parameters of the function.", + "type": "boolean" + }, + "allowTypedFunctionExpressions": { + "description": "Whether to ignore type annotations on the variable of a function expresion.", + "type": "boolean" + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to ignore arguments that are explicitly typed as \`any\`. */ + allowArgumentsExplicitlyTypedAsAny?: boolean; + /** Whether to ignore return type annotations on body-less arrow functions that return an \`as const\` type assertion. +You must still type the parameters of the function. */ + allowDirectConstAssertionInArrowFunctions?: boolean; + /** An array of function/method names that will not have their arguments or return values checked. */ + allowedNames?: string[]; + /** Whether to ignore return type annotations on functions immediately returning another function expression. +You must still type the parameters of the function. */ + allowHigherOrderFunctions?: boolean; + /** Whether to ignore type annotations on the variable of a function expresion. */ + allowTypedFunctionExpressions?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot new file mode 100644 index 000000000000..bbdc29d02f8a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes func-call-spacing 1`] = ` +" +# SCHEMA: + +{ + "anyOf": [ + { + "type": "array", + "items": [{ "enum": ["never"] }], + "minItems": 0, + "maxItems": 1 + }, + { + "type": "array", + "items": [ + { "enum": ["always"] }, + { + "type": "object", + "properties": { "allowNewlines": { "type": "boolean" } }, + "additionalProperties": false + } + ], + "minItems": 0, + "maxItems": 2 + } + ] +} + + +# TYPES: + +type Options = + | ([] | ['never', ...unknown[]]) + | ( + | [] + | ['always'] + | [ + 'always', + { + allowNewlines?: boolean; + }, + ...unknown[], + ] + ); +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot b/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot new file mode 100644 index 000000000000..2ee376fd1ea2 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes init-declarations 1`] = ` +" +# SCHEMA: + +{ + "anyOf": [ + { + "type": "array", + "items": [{ "enum": ["always"] }], + "minItems": 0, + "maxItems": 1 + }, + { + "type": "array", + "items": [ + { "enum": ["never"] }, + { + "type": "object", + "properties": { "ignoreForLoopInit": { "type": "boolean" } }, + "additionalProperties": false + } + ], + "minItems": 0, + "maxItems": 2 + } + ] +} + + +# TYPES: + +type Options = + | ([] | ['always', ...unknown[]]) + | ( + | [] + | ['never'] + | [ + 'never', + { + ignoreForLoopInit?: boolean; + }, + ...unknown[], + ] + ); +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot new file mode 100644 index 000000000000..a5d1a139a900 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot @@ -0,0 +1,168 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes key-spacing 1`] = ` +" +# SCHEMA: + +[ + { + "anyOf": [ + { + "type": "object", + "properties": { + "align": { + "anyOf": [ + { "enum": ["colon", "value"] }, + { + "type": "object", + "properties": { + "mode": { "enum": ["strict", "minimum"] }, + "on": { "enum": ["colon", "value"] }, + "beforeColon": { "type": "boolean" }, + "afterColon": { "type": "boolean" } + }, + "additionalProperties": false + } + ] + }, + "mode": { "enum": ["strict", "minimum"] }, + "beforeColon": { "type": "boolean" }, + "afterColon": { "type": "boolean" } + }, + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "singleLine": { + "type": "object", + "properties": { + "mode": { "enum": ["strict", "minimum"] }, + "beforeColon": { "type": "boolean" }, + "afterColon": { "type": "boolean" } + }, + "additionalProperties": false + }, + "multiLine": { + "type": "object", + "properties": { + "align": { + "anyOf": [ + { "enum": ["colon", "value"] }, + { + "type": "object", + "properties": { + "mode": { "enum": ["strict", "minimum"] }, + "on": { "enum": ["colon", "value"] }, + "beforeColon": { "type": "boolean" }, + "afterColon": { "type": "boolean" } + }, + "additionalProperties": false + } + ] + }, + "mode": { "enum": ["strict", "minimum"] }, + "beforeColon": { "type": "boolean" }, + "afterColon": { "type": "boolean" } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "singleLine": { + "type": "object", + "properties": { + "mode": { "enum": ["strict", "minimum"] }, + "beforeColon": { "type": "boolean" }, + "afterColon": { "type": "boolean" } + }, + "additionalProperties": false + }, + "multiLine": { + "type": "object", + "properties": { + "mode": { "enum": ["strict", "minimum"] }, + "beforeColon": { "type": "boolean" }, + "afterColon": { "type": "boolean" } + }, + "additionalProperties": false + }, + "align": { + "type": "object", + "properties": { + "mode": { "enum": ["strict", "minimum"] }, + "on": { "enum": ["colon", "value"] }, + "beforeColon": { "type": "boolean" }, + "afterColon": { "type": "boolean" } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } +] + + +# TYPES: + +type Options = [ + | { + align?: + | ('colon' | 'value') + | { + mode?: 'strict' | 'minimum'; + on?: 'colon' | 'value'; + beforeColon?: boolean; + afterColon?: boolean; + }; + mode?: 'strict' | 'minimum'; + beforeColon?: boolean; + afterColon?: boolean; + } + | { + singleLine?: { + mode?: 'strict' | 'minimum'; + beforeColon?: boolean; + afterColon?: boolean; + }; + multiLine?: { + align?: + | ('colon' | 'value') + | { + mode?: 'strict' | 'minimum'; + on?: 'colon' | 'value'; + beforeColon?: boolean; + afterColon?: boolean; + }; + mode?: 'strict' | 'minimum'; + beforeColon?: boolean; + afterColon?: boolean; + }; + } + | { + singleLine?: { + mode?: 'strict' | 'minimum'; + beforeColon?: boolean; + afterColon?: boolean; + }; + multiLine?: { + mode?: 'strict' | 'minimum'; + beforeColon?: boolean; + afterColon?: boolean; + }; + align?: { + mode?: 'strict' | 'minimum'; + on?: 'colon' | 'value'; + beforeColon?: boolean; + afterColon?: boolean; + }; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot new file mode 100644 index 000000000000..a2db15c9cfef --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot @@ -0,0 +1,864 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes keyword-spacing 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "before": { "type": "boolean", "default": true }, + "after": { "type": "boolean", "default": true }, + "overrides": { + "type": "object", + "properties": { + "abstract": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "as": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "async": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "await": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "boolean": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "break": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "byte": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "case": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "catch": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "char": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "class": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "const": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "continue": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "debugger": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "default": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "delete": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "do": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "double": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "else": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "enum": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "export": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "extends": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "false": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "final": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "finally": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "float": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "for": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "from": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "function": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "get": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "goto": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "if": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "implements": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "import": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "in": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "instanceof": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "int": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "interface": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "let": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "long": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "native": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "new": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "null": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "of": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "package": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "private": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "protected": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "public": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "return": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "set": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "short": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "static": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "super": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "switch": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "synchronized": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "this": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "throw": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "throws": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "transient": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "true": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "try": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "typeof": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "var": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "void": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "volatile": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "while": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "with": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "yield": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "type": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + before?: boolean; + after?: boolean; + overrides?: { + abstract?: { + before?: boolean; + after?: boolean; + }; + as?: { + before?: boolean; + after?: boolean; + }; + async?: { + before?: boolean; + after?: boolean; + }; + await?: { + before?: boolean; + after?: boolean; + }; + boolean?: { + before?: boolean; + after?: boolean; + }; + break?: { + before?: boolean; + after?: boolean; + }; + byte?: { + before?: boolean; + after?: boolean; + }; + case?: { + before?: boolean; + after?: boolean; + }; + catch?: { + before?: boolean; + after?: boolean; + }; + char?: { + before?: boolean; + after?: boolean; + }; + class?: { + before?: boolean; + after?: boolean; + }; + const?: { + before?: boolean; + after?: boolean; + }; + continue?: { + before?: boolean; + after?: boolean; + }; + debugger?: { + before?: boolean; + after?: boolean; + }; + default?: { + before?: boolean; + after?: boolean; + }; + delete?: { + before?: boolean; + after?: boolean; + }; + do?: { + before?: boolean; + after?: boolean; + }; + double?: { + before?: boolean; + after?: boolean; + }; + else?: { + before?: boolean; + after?: boolean; + }; + enum?: { + before?: boolean; + after?: boolean; + }; + export?: { + before?: boolean; + after?: boolean; + }; + extends?: { + before?: boolean; + after?: boolean; + }; + false?: { + before?: boolean; + after?: boolean; + }; + final?: { + before?: boolean; + after?: boolean; + }; + finally?: { + before?: boolean; + after?: boolean; + }; + float?: { + before?: boolean; + after?: boolean; + }; + for?: { + before?: boolean; + after?: boolean; + }; + from?: { + before?: boolean; + after?: boolean; + }; + function?: { + before?: boolean; + after?: boolean; + }; + get?: { + before?: boolean; + after?: boolean; + }; + goto?: { + before?: boolean; + after?: boolean; + }; + if?: { + before?: boolean; + after?: boolean; + }; + implements?: { + before?: boolean; + after?: boolean; + }; + import?: { + before?: boolean; + after?: boolean; + }; + in?: { + before?: boolean; + after?: boolean; + }; + instanceof?: { + before?: boolean; + after?: boolean; + }; + int?: { + before?: boolean; + after?: boolean; + }; + interface?: { + before?: boolean; + after?: boolean; + }; + let?: { + before?: boolean; + after?: boolean; + }; + long?: { + before?: boolean; + after?: boolean; + }; + native?: { + before?: boolean; + after?: boolean; + }; + new?: { + before?: boolean; + after?: boolean; + }; + null?: { + before?: boolean; + after?: boolean; + }; + of?: { + before?: boolean; + after?: boolean; + }; + package?: { + before?: boolean; + after?: boolean; + }; + private?: { + before?: boolean; + after?: boolean; + }; + protected?: { + before?: boolean; + after?: boolean; + }; + public?: { + before?: boolean; + after?: boolean; + }; + return?: { + before?: boolean; + after?: boolean; + }; + set?: { + before?: boolean; + after?: boolean; + }; + short?: { + before?: boolean; + after?: boolean; + }; + static?: { + before?: boolean; + after?: boolean; + }; + super?: { + before?: boolean; + after?: boolean; + }; + switch?: { + before?: boolean; + after?: boolean; + }; + synchronized?: { + before?: boolean; + after?: boolean; + }; + this?: { + before?: boolean; + after?: boolean; + }; + throw?: { + before?: boolean; + after?: boolean; + }; + throws?: { + before?: boolean; + after?: boolean; + }; + transient?: { + before?: boolean; + after?: boolean; + }; + true?: { + before?: boolean; + after?: boolean; + }; + try?: { + before?: boolean; + after?: boolean; + }; + typeof?: { + before?: boolean; + after?: boolean; + }; + var?: { + before?: boolean; + after?: boolean; + }; + void?: { + before?: boolean; + after?: boolean; + }; + volatile?: { + before?: boolean; + after?: boolean; + }; + while?: { + before?: boolean; + after?: boolean; + }; + with?: { + before?: boolean; + after?: boolean; + }; + yield?: { + before?: boolean; + after?: boolean; + }; + type?: { + before?: boolean; + after?: boolean; + }; + }; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot new file mode 100644 index 000000000000..7545c75a486a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes lines-around-comment 1`] = ` +" +# SCHEMA: + +[ + { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "beforeBlockComment": { "type": "boolean", "default": true }, + "afterBlockComment": { "type": "boolean", "default": false }, + "beforeLineComment": { "type": "boolean", "default": false }, + "afterLineComment": { "type": "boolean", "default": false }, + "allowBlockStart": { "type": "boolean", "default": false }, + "allowBlockEnd": { "type": "boolean", "default": false }, + "allowClassStart": { "type": "boolean" }, + "allowClassEnd": { "type": "boolean" }, + "allowObjectStart": { "type": "boolean" }, + "allowObjectEnd": { "type": "boolean" }, + "allowArrayStart": { "type": "boolean" }, + "allowArrayEnd": { "type": "boolean" }, + "allowInterfaceStart": { "type": "boolean" }, + "allowInterfaceEnd": { "type": "boolean" }, + "allowTypeStart": { "type": "boolean" }, + "allowTypeEnd": { "type": "boolean" }, + "allowEnumStart": { "type": "boolean" }, + "allowEnumEnd": { "type": "boolean" }, + "allowModuleStart": { "type": "boolean" }, + "allowModuleEnd": { "type": "boolean" }, + "ignorePattern": { "type": "string" }, + "applyDefaultIgnorePatterns": { "type": "boolean" } + }, + "additionalProperties": false + } + ] + } +] + + +# TYPES: + +type Options = [ + | [] + | [ + { + beforeBlockComment?: boolean; + afterBlockComment?: boolean; + beforeLineComment?: boolean; + afterLineComment?: boolean; + allowBlockStart?: boolean; + allowBlockEnd?: boolean; + allowClassStart?: boolean; + allowClassEnd?: boolean; + allowObjectStart?: boolean; + allowObjectEnd?: boolean; + allowArrayStart?: boolean; + allowArrayEnd?: boolean; + allowInterfaceStart?: boolean; + allowInterfaceEnd?: boolean; + allowTypeStart?: boolean; + allowTypeEnd?: boolean; + allowEnumStart?: boolean; + allowEnumEnd?: boolean; + allowModuleStart?: boolean; + allowModuleEnd?: boolean; + ignorePattern?: string; + applyDefaultIgnorePatterns?: boolean; + }, + ], +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot b/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot new file mode 100644 index 000000000000..b84068c5a69d --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes lines-between-class-members 1`] = ` +" +# SCHEMA: + +[ + { "enum": ["always", "never"] }, + { + "type": "object", + "properties": { + "exceptAfterSingleLine": { "type": "boolean", "default": false }, + "exceptAfterOverload": { "type": "boolean", "default": true } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + 'always' | 'never', + { + exceptAfterSingleLine?: boolean; + exceptAfterOverload?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot b/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot new file mode 100644 index 000000000000..d3ba79226c98 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot @@ -0,0 +1,122 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes member-delimiter-style 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "multiline": { + "type": "object", + "properties": { + "delimiter": { "enum": ["none", "semi", "comma"] }, + "requireLast": { "type": "boolean" } + }, + "additionalProperties": false + }, + "singleline": { + "type": "object", + "properties": { + "delimiter": { "enum": ["semi", "comma"] }, + "requireLast": { "type": "boolean" } + }, + "additionalProperties": false + }, + "overrides": { + "type": "object", + "properties": { + "interface": { + "type": "object", + "properties": { + "multiline": { + "type": "object", + "properties": { + "delimiter": { "enum": ["none", "semi", "comma"] }, + "requireLast": { "type": "boolean" } + }, + "additionalProperties": false + }, + "singleline": { + "type": "object", + "properties": { + "delimiter": { "enum": ["semi", "comma"] }, + "requireLast": { "type": "boolean" } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "typeLiteral": { + "type": "object", + "properties": { + "multiline": { + "type": "object", + "properties": { + "delimiter": { "enum": ["none", "semi", "comma"] }, + "requireLast": { "type": "boolean" } + }, + "additionalProperties": false + }, + "singleline": { + "type": "object", + "properties": { + "delimiter": { "enum": ["semi", "comma"] }, + "requireLast": { "type": "boolean" } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "multilineDetection": { "enum": ["brackets", "last-member"] } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + multiline?: { + delimiter?: 'none' | 'semi' | 'comma'; + requireLast?: boolean; + }; + singleline?: { + delimiter?: 'semi' | 'comma'; + requireLast?: boolean; + }; + overrides?: { + interface?: { + multiline?: { + delimiter?: 'none' | 'semi' | 'comma'; + requireLast?: boolean; + }; + singleline?: { + delimiter?: 'semi' | 'comma'; + requireLast?: boolean; + }; + }; + typeLiteral?: { + multiline?: { + delimiter?: 'none' | 'semi' | 'comma'; + requireLast?: boolean; + }; + singleline?: { + delimiter?: 'semi' | 'comma'; + requireLast?: boolean; + }; + }; + }; + multilineDetection?: 'brackets' | 'last-member'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot new file mode 100644 index 000000000000..7b3e0b5bf2b6 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot @@ -0,0 +1,3719 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes member-ordering 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "default": { + "oneOf": [ + { "type": "string", "enum": ["never"] }, + { + "type": "array", + "items": { + "oneOf": [ + { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + }, + { + "type": "array", + "items": { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + } + } + ] + } + }, + { + "type": "object", + "properties": { + "memberTypes": { + "oneOf": [ + { + "type": "array", + "items": { + "oneOf": [ + { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + }, + { + "type": "array", + "items": { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + } + } + ] + } + }, + { "type": "string", "enum": ["never"] } + ] + }, + "order": { + "type": "string", + "enum": [ + "alphabetically", + "alphabetically-case-insensitive", + "as-written", + "natural", + "natural-case-insensitive" + ] + }, + "optionalityOrder": { + "type": "string", + "enum": ["optional-first", "required-first"] + } + }, + "additionalProperties": false + } + ] + }, + "classes": { + "oneOf": [ + { "type": "string", "enum": ["never"] }, + { + "type": "array", + "items": { + "oneOf": [ + { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + }, + { + "type": "array", + "items": { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + } + } + ] + } + }, + { + "type": "object", + "properties": { + "memberTypes": { + "oneOf": [ + { + "type": "array", + "items": { + "oneOf": [ + { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + }, + { + "type": "array", + "items": { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + } + } + ] + } + }, + { "type": "string", "enum": ["never"] } + ] + }, + "order": { + "type": "string", + "enum": [ + "alphabetically", + "alphabetically-case-insensitive", + "as-written", + "natural", + "natural-case-insensitive" + ] + }, + "optionalityOrder": { + "type": "string", + "enum": ["optional-first", "required-first"] + } + }, + "additionalProperties": false + } + ] + }, + "classExpressions": { + "oneOf": [ + { "type": "string", "enum": ["never"] }, + { + "type": "array", + "items": { + "oneOf": [ + { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + }, + { + "type": "array", + "items": { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + } + } + ] + } + }, + { + "type": "object", + "properties": { + "memberTypes": { + "oneOf": [ + { + "type": "array", + "items": { + "oneOf": [ + { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + }, + { + "type": "array", + "items": { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "public-readonly-field", + "public-decorated-readonly-field", + "decorated-readonly-field", + "static-readonly-field", + "public-static-readonly-field", + "instance-readonly-field", + "public-instance-readonly-field", + "abstract-readonly-field", + "public-abstract-readonly-field", + "protected-readonly-field", + "protected-decorated-readonly-field", + "protected-static-readonly-field", + "protected-instance-readonly-field", + "protected-abstract-readonly-field", + "private-readonly-field", + "private-decorated-readonly-field", + "private-static-readonly-field", + "private-instance-readonly-field", + "#private-readonly-field", + "#private-static-readonly-field", + "#private-instance-readonly-field", + "field", + "public-field", + "public-decorated-field", + "decorated-field", + "static-field", + "public-static-field", + "instance-field", + "public-instance-field", + "abstract-field", + "public-abstract-field", + "protected-field", + "protected-decorated-field", + "protected-static-field", + "protected-instance-field", + "protected-abstract-field", + "private-field", + "private-decorated-field", + "private-static-field", + "private-instance-field", + "#private-field", + "#private-static-field", + "#private-instance-field", + "method", + "public-method", + "public-decorated-method", + "decorated-method", + "static-method", + "public-static-method", + "instance-method", + "public-instance-method", + "abstract-method", + "public-abstract-method", + "protected-method", + "protected-decorated-method", + "protected-static-method", + "protected-instance-method", + "protected-abstract-method", + "private-method", + "private-decorated-method", + "private-static-method", + "private-instance-method", + "#private-method", + "#private-static-method", + "#private-instance-method", + "call-signature", + "constructor", + "public-constructor", + "protected-constructor", + "private-constructor", + "get", + "public-get", + "public-decorated-get", + "decorated-get", + "static-get", + "public-static-get", + "instance-get", + "public-instance-get", + "abstract-get", + "public-abstract-get", + "protected-get", + "protected-decorated-get", + "protected-static-get", + "protected-instance-get", + "protected-abstract-get", + "private-get", + "private-decorated-get", + "private-static-get", + "private-instance-get", + "#private-get", + "#private-static-get", + "#private-instance-get", + "set", + "public-set", + "public-decorated-set", + "decorated-set", + "static-set", + "public-static-set", + "instance-set", + "public-instance-set", + "abstract-set", + "public-abstract-set", + "protected-set", + "protected-decorated-set", + "protected-static-set", + "protected-instance-set", + "protected-abstract-set", + "private-set", + "private-decorated-set", + "private-static-set", + "private-instance-set", + "#private-set", + "#private-static-set", + "#private-instance-set", + "static-initialization", + "static-static-initialization", + "public-static-static-initialization", + "instance-static-initialization", + "public-instance-static-initialization", + "abstract-static-initialization", + "public-abstract-static-initialization", + "protected-static-static-initialization", + "protected-instance-static-initialization", + "protected-abstract-static-initialization", + "private-static-static-initialization", + "private-instance-static-initialization", + "#private-static-static-initialization", + "#private-instance-static-initialization" + ] + } + } + ] + } + }, + { "type": "string", "enum": ["never"] } + ] + }, + "order": { + "type": "string", + "enum": [ + "alphabetically", + "alphabetically-case-insensitive", + "as-written", + "natural", + "natural-case-insensitive" + ] + }, + "optionalityOrder": { + "type": "string", + "enum": ["optional-first", "required-first"] + } + }, + "additionalProperties": false + } + ] + }, + "interfaces": { + "oneOf": [ + { "type": "string", "enum": ["never"] }, + { + "type": "array", + "items": { + "oneOf": [ + { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "field", + "method", + "constructor" + ] + }, + { + "type": "array", + "items": { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "field", + "method", + "constructor" + ] + } + } + ] + } + }, + { + "type": "object", + "properties": { + "memberTypes": { + "oneOf": [ + { + "type": "array", + "items": { + "oneOf": [ + { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "field", + "method", + "constructor" + ] + }, + { + "type": "array", + "items": { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "field", + "method", + "constructor" + ] + } + } + ] + } + }, + { "type": "string", "enum": ["never"] } + ] + }, + "order": { + "type": "string", + "enum": [ + "alphabetically", + "alphabetically-case-insensitive", + "as-written", + "natural", + "natural-case-insensitive" + ] + }, + "optionalityOrder": { + "type": "string", + "enum": ["optional-first", "required-first"] + } + }, + "additionalProperties": false + } + ] + }, + "typeLiterals": { + "oneOf": [ + { "type": "string", "enum": ["never"] }, + { + "type": "array", + "items": { + "oneOf": [ + { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "field", + "method", + "constructor" + ] + }, + { + "type": "array", + "items": { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "field", + "method", + "constructor" + ] + } + } + ] + } + }, + { + "type": "object", + "properties": { + "memberTypes": { + "oneOf": [ + { + "type": "array", + "items": { + "oneOf": [ + { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "field", + "method", + "constructor" + ] + }, + { + "type": "array", + "items": { + "enum": [ + "readonly-signature", + "signature", + "readonly-field", + "field", + "method", + "constructor" + ] + } + } + ] + } + }, + { "type": "string", "enum": ["never"] } + ] + }, + "order": { + "type": "string", + "enum": [ + "alphabetically", + "alphabetically-case-insensitive", + "as-written", + "natural", + "natural-case-insensitive" + ] + }, + "optionalityOrder": { + "type": "string", + "enum": ["optional-first", "required-first"] + } + }, + "additionalProperties": false + } + ] + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + default?: + | 'never' + | ( + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + ) + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + )[] + )[] + | { + memberTypes?: + | ( + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + ) + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + )[] + )[] + | 'never'; + order?: + | 'alphabetically' + | 'alphabetically-case-insensitive' + | 'as-written' + | 'natural' + | 'natural-case-insensitive'; + optionalityOrder?: 'optional-first' | 'required-first'; + }; + classes?: + | 'never' + | ( + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + ) + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + )[] + )[] + | { + memberTypes?: + | ( + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + ) + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + )[] + )[] + | 'never'; + order?: + | 'alphabetically' + | 'alphabetically-case-insensitive' + | 'as-written' + | 'natural' + | 'natural-case-insensitive'; + optionalityOrder?: 'optional-first' | 'required-first'; + }; + classExpressions?: + | 'never' + | ( + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + ) + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + )[] + )[] + | { + memberTypes?: + | ( + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + ) + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'public-readonly-field' + | 'public-decorated-readonly-field' + | 'decorated-readonly-field' + | 'static-readonly-field' + | 'public-static-readonly-field' + | 'instance-readonly-field' + | 'public-instance-readonly-field' + | 'abstract-readonly-field' + | 'public-abstract-readonly-field' + | 'protected-readonly-field' + | 'protected-decorated-readonly-field' + | 'protected-static-readonly-field' + | 'protected-instance-readonly-field' + | 'protected-abstract-readonly-field' + | 'private-readonly-field' + | 'private-decorated-readonly-field' + | 'private-static-readonly-field' + | 'private-instance-readonly-field' + | '#private-readonly-field' + | '#private-static-readonly-field' + | '#private-instance-readonly-field' + | 'field' + | 'public-field' + | 'public-decorated-field' + | 'decorated-field' + | 'static-field' + | 'public-static-field' + | 'instance-field' + | 'public-instance-field' + | 'abstract-field' + | 'public-abstract-field' + | 'protected-field' + | 'protected-decorated-field' + | 'protected-static-field' + | 'protected-instance-field' + | 'protected-abstract-field' + | 'private-field' + | 'private-decorated-field' + | 'private-static-field' + | 'private-instance-field' + | '#private-field' + | '#private-static-field' + | '#private-instance-field' + | 'method' + | 'public-method' + | 'public-decorated-method' + | 'decorated-method' + | 'static-method' + | 'public-static-method' + | 'instance-method' + | 'public-instance-method' + | 'abstract-method' + | 'public-abstract-method' + | 'protected-method' + | 'protected-decorated-method' + | 'protected-static-method' + | 'protected-instance-method' + | 'protected-abstract-method' + | 'private-method' + | 'private-decorated-method' + | 'private-static-method' + | 'private-instance-method' + | '#private-method' + | '#private-static-method' + | '#private-instance-method' + | 'call-signature' + | 'constructor' + | 'public-constructor' + | 'protected-constructor' + | 'private-constructor' + | 'get' + | 'public-get' + | 'public-decorated-get' + | 'decorated-get' + | 'static-get' + | 'public-static-get' + | 'instance-get' + | 'public-instance-get' + | 'abstract-get' + | 'public-abstract-get' + | 'protected-get' + | 'protected-decorated-get' + | 'protected-static-get' + | 'protected-instance-get' + | 'protected-abstract-get' + | 'private-get' + | 'private-decorated-get' + | 'private-static-get' + | 'private-instance-get' + | '#private-get' + | '#private-static-get' + | '#private-instance-get' + | 'set' + | 'public-set' + | 'public-decorated-set' + | 'decorated-set' + | 'static-set' + | 'public-static-set' + | 'instance-set' + | 'public-instance-set' + | 'abstract-set' + | 'public-abstract-set' + | 'protected-set' + | 'protected-decorated-set' + | 'protected-static-set' + | 'protected-instance-set' + | 'protected-abstract-set' + | 'private-set' + | 'private-decorated-set' + | 'private-static-set' + | 'private-instance-set' + | '#private-set' + | '#private-static-set' + | '#private-instance-set' + | 'static-initialization' + | 'static-static-initialization' + | 'public-static-static-initialization' + | 'instance-static-initialization' + | 'public-instance-static-initialization' + | 'abstract-static-initialization' + | 'public-abstract-static-initialization' + | 'protected-static-static-initialization' + | 'protected-instance-static-initialization' + | 'protected-abstract-static-initialization' + | 'private-static-static-initialization' + | 'private-instance-static-initialization' + | '#private-static-static-initialization' + | '#private-instance-static-initialization' + )[] + )[] + | 'never'; + order?: + | 'alphabetically' + | 'alphabetically-case-insensitive' + | 'as-written' + | 'natural' + | 'natural-case-insensitive'; + optionalityOrder?: 'optional-first' | 'required-first'; + }; + interfaces?: + | 'never' + | ( + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'field' + | 'method' + | 'constructor' + ) + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'field' + | 'method' + | 'constructor' + )[] + )[] + | { + memberTypes?: + | ( + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'field' + | 'method' + | 'constructor' + ) + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'field' + | 'method' + | 'constructor' + )[] + )[] + | 'never'; + order?: + | 'alphabetically' + | 'alphabetically-case-insensitive' + | 'as-written' + | 'natural' + | 'natural-case-insensitive'; + optionalityOrder?: 'optional-first' | 'required-first'; + }; + typeLiterals?: + | 'never' + | ( + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'field' + | 'method' + | 'constructor' + ) + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'field' + | 'method' + | 'constructor' + )[] + )[] + | { + memberTypes?: + | ( + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'field' + | 'method' + | 'constructor' + ) + | ( + | 'readonly-signature' + | 'signature' + | 'readonly-field' + | 'field' + | 'method' + | 'constructor' + )[] + )[] + | 'never'; + order?: + | 'alphabetically' + | 'alphabetically-case-insensitive' + | 'as-written' + | 'natural' + | 'natural-case-insensitive'; + optionalityOrder?: 'optional-first' | 'required-first'; + }; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot b/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot new file mode 100644 index 000000000000..c5e3ee644d1b --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes method-signature-style 1`] = ` +" +# SCHEMA: + +[{ "enum": ["property", "method"] }] + + +# TYPES: + +type Options = ['property' | 'method']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot new file mode 100644 index 000000000000..ec017b3cefe0 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot @@ -0,0 +1,3473 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes naming-convention 1`] = ` +" +# SCHEMA: + +{ + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "default", + "variableLike", + "memberLike", + "typeLike", + "method", + "property", + "variable", + "function", + "parameter", + "parameterProperty", + "accessor", + "enumMember", + "classMethod", + "objectLiteralMethod", + "typeMethod", + "classProperty", + "objectLiteralProperty", + "typeProperty", + "class", + "interface", + "typeAlias", + "enum", + "typeParameter" + ] + }, + "additionalItems": false + }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "const", + "readonly", + "static", + "public", + "protected", + "private", + "#private", + "abstract", + "destructured", + "global", + "exported", + "unused", + "requiresQuotes", + "override", + "async" + ] + }, + "additionalItems": false + }, + "types": { + "type": "array", + "items": { + "type": "string", + "enum": ["boolean", "string", "number", "function", "array"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["default"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "const", + "readonly", + "static", + "public", + "protected", + "private", + "#private", + "abstract", + "destructured", + "global", + "exported", + "unused", + "requiresQuotes", + "override", + "async" + ] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["variableLike"] }, + "modifiers": { + "type": "array", + "items": { "type": "string", "enum": ["unused", "async"] }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["variable"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "const", + "destructured", + "exported", + "global", + "unused", + "async" + ] + }, + "additionalItems": false + }, + "types": { + "type": "array", + "items": { + "type": "string", + "enum": ["boolean", "string", "number", "function", "array"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["function"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": ["exported", "global", "unused", "async"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["parameter"] }, + "modifiers": { + "type": "array", + "items": { "type": "string", "enum": ["destructured", "unused"] }, + "additionalItems": false + }, + "types": { + "type": "array", + "items": { + "type": "string", + "enum": ["boolean", "string", "number", "function", "array"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["memberLike"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "abstract", + "private", + "#private", + "protected", + "public", + "readonly", + "requiresQuotes", + "static", + "override", + "async" + ] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["classProperty"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "abstract", + "private", + "#private", + "protected", + "public", + "readonly", + "requiresQuotes", + "static", + "override" + ] + }, + "additionalItems": false + }, + "types": { + "type": "array", + "items": { + "type": "string", + "enum": ["boolean", "string", "number", "function", "array"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["objectLiteralProperty"] }, + "modifiers": { + "type": "array", + "items": { "type": "string", "enum": ["public", "requiresQuotes"] }, + "additionalItems": false + }, + "types": { + "type": "array", + "items": { + "type": "string", + "enum": ["boolean", "string", "number", "function", "array"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["typeProperty"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": ["public", "readonly", "requiresQuotes"] + }, + "additionalItems": false + }, + "types": { + "type": "array", + "items": { + "type": "string", + "enum": ["boolean", "string", "number", "function", "array"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["parameterProperty"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": ["private", "protected", "public", "readonly"] + }, + "additionalItems": false + }, + "types": { + "type": "array", + "items": { + "type": "string", + "enum": ["boolean", "string", "number", "function", "array"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["property"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "abstract", + "private", + "#private", + "protected", + "public", + "readonly", + "requiresQuotes", + "static", + "override", + "async" + ] + }, + "additionalItems": false + }, + "types": { + "type": "array", + "items": { + "type": "string", + "enum": ["boolean", "string", "number", "function", "array"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["classMethod"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "abstract", + "private", + "#private", + "protected", + "public", + "requiresQuotes", + "static", + "override", + "async" + ] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["objectLiteralMethod"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": ["public", "requiresQuotes", "async"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["typeMethod"] }, + "modifiers": { + "type": "array", + "items": { "type": "string", "enum": ["public", "requiresQuotes"] }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["method"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "abstract", + "private", + "#private", + "protected", + "public", + "requiresQuotes", + "static", + "override", + "async" + ] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["accessor"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "abstract", + "private", + "protected", + "public", + "requiresQuotes", + "static", + "override" + ] + }, + "additionalItems": false + }, + "types": { + "type": "array", + "items": { + "type": "string", + "enum": ["boolean", "string", "number", "function", "array"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["enumMember"] }, + "modifiers": { + "type": "array", + "items": { "type": "string", "enum": ["requiresQuotes"] }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["typeLike"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": ["abstract", "exported", "unused"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["class"] }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": ["abstract", "exported", "unused"] + }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["interface"] }, + "modifiers": { + "type": "array", + "items": { "type": "string", "enum": ["exported", "unused"] }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["typeAlias"] }, + "modifiers": { + "type": "array", + "items": { "type": "string", "enum": ["exported", "unused"] }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["enum"] }, + "modifiers": { + "type": "array", + "items": { "type": "string", "enum": ["exported", "unused"] }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "format": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "additionalItems": false + }, + { "type": "null" } + ] + }, + "custom": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "leadingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "trailingUnderscore": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "prefix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "suffix": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "failureMessage": { "type": "string" }, + "filter": { + "oneOf": [ + { "type": "string", "minLength": 1 }, + { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + } + ] + }, + "selector": { "type": "string", "enum": ["typeParameter"] }, + "modifiers": { + "type": "array", + "items": { "type": "string", "enum": ["unused"] }, + "additionalItems": false + } + }, + "required": ["selector", "format"], + "additionalProperties": false + } + ] + }, + "additionalItems": false +} + + +# TYPES: + +type Options = ( + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: ( + | 'default' + | 'variableLike' + | 'memberLike' + | 'typeLike' + | 'method' + | 'property' + | 'variable' + | 'function' + | 'parameter' + | 'parameterProperty' + | 'accessor' + | 'enumMember' + | 'classMethod' + | 'objectLiteralMethod' + | 'typeMethod' + | 'classProperty' + | 'objectLiteralProperty' + | 'typeProperty' + | 'class' + | 'interface' + | 'typeAlias' + | 'enum' + | 'typeParameter' + )[]; + modifiers?: ( + | 'const' + | 'readonly' + | 'static' + | 'public' + | 'protected' + | 'private' + | '#private' + | 'abstract' + | 'destructured' + | 'global' + | 'exported' + | 'unused' + | 'requiresQuotes' + | 'override' + | 'async' + )[]; + types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'default'; + modifiers?: ( + | 'const' + | 'readonly' + | 'static' + | 'public' + | 'protected' + | 'private' + | '#private' + | 'abstract' + | 'destructured' + | 'global' + | 'exported' + | 'unused' + | 'requiresQuotes' + | 'override' + | 'async' + )[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'variableLike'; + modifiers?: ('unused' | 'async')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'variable'; + modifiers?: ( + | 'const' + | 'destructured' + | 'exported' + | 'global' + | 'unused' + | 'async' + )[]; + types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'function'; + modifiers?: ('exported' | 'global' | 'unused' | 'async')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'parameter'; + modifiers?: ('destructured' | 'unused')[]; + types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'memberLike'; + modifiers?: ( + | 'abstract' + | 'private' + | '#private' + | 'protected' + | 'public' + | 'readonly' + | 'requiresQuotes' + | 'static' + | 'override' + | 'async' + )[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'classProperty'; + modifiers?: ( + | 'abstract' + | 'private' + | '#private' + | 'protected' + | 'public' + | 'readonly' + | 'requiresQuotes' + | 'static' + | 'override' + )[]; + types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'objectLiteralProperty'; + modifiers?: ('public' | 'requiresQuotes')[]; + types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'typeProperty'; + modifiers?: ('public' | 'readonly' | 'requiresQuotes')[]; + types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'parameterProperty'; + modifiers?: ('private' | 'protected' | 'public' | 'readonly')[]; + types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'property'; + modifiers?: ( + | 'abstract' + | 'private' + | '#private' + | 'protected' + | 'public' + | 'readonly' + | 'requiresQuotes' + | 'static' + | 'override' + | 'async' + )[]; + types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'classMethod'; + modifiers?: ( + | 'abstract' + | 'private' + | '#private' + | 'protected' + | 'public' + | 'requiresQuotes' + | 'static' + | 'override' + | 'async' + )[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'objectLiteralMethod'; + modifiers?: ('public' | 'requiresQuotes' | 'async')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'typeMethod'; + modifiers?: ('public' | 'requiresQuotes')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'method'; + modifiers?: ( + | 'abstract' + | 'private' + | '#private' + | 'protected' + | 'public' + | 'requiresQuotes' + | 'static' + | 'override' + | 'async' + )[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'accessor'; + modifiers?: ( + | 'abstract' + | 'private' + | 'protected' + | 'public' + | 'requiresQuotes' + | 'static' + | 'override' + )[]; + types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'enumMember'; + modifiers?: ('requiresQuotes')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'typeLike'; + modifiers?: ('abstract' | 'exported' | 'unused')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'class'; + modifiers?: ('abstract' | 'exported' | 'unused')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'interface'; + modifiers?: ('exported' | 'unused')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'typeAlias'; + modifiers?: ('exported' | 'unused')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'enum'; + modifiers?: ('exported' | 'unused')[]; + } + | { + format: + | ( + | 'camelCase' + | 'strictCamelCase' + | 'PascalCase' + | 'StrictPascalCase' + | 'snake_case' + | 'UPPER_CASE' + )[] + | null; + custom?: { + match: boolean; + regex: string; + }; + leadingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + trailingUnderscore?: + | 'forbid' + | 'allow' + | 'require' + | 'requireDouble' + | 'allowDouble' + | 'allowSingleOrDouble'; + prefix?: string[]; + suffix?: string[]; + failureMessage?: string; + filter?: + | string + | { + match: boolean; + regex: string; + }; + selector: 'typeParameter'; + modifiers?: ('unused')[]; + } +)[]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-array-constructor.shot b/packages/eslint-plugin/tests/schema-snapshots/no-array-constructor.shot new file mode 100644 index 000000000000..fddb0ea6c636 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-array-constructor.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-array-constructor 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot b/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot new file mode 100644 index 000000000000..41253c2afd32 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot @@ -0,0 +1,26 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-base-to-string 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "ignoredTypeNames": { "type": "array", "items": { "type": "string" } } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + ignoredTypeNames?: string[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-confusing-non-null-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-non-null-assertion.shot new file mode 100644 index 000000000000..6f0b386771ad --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-non-null-assertion.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-confusing-non-null-assertion 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot new file mode 100644 index 000000000000..2aa1a9d0161c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-confusing-void-expression 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "ignoreArrowShorthand": { "type": "boolean" }, + "ignoreVoidOperator": { "type": "boolean" } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + ignoreArrowShorthand?: boolean; + ignoreVoidOperator?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-dupe-class-members.shot b/packages/eslint-plugin/tests/schema-snapshots/no-dupe-class-members.shot new file mode 100644 index 000000000000..3860df1d232c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-dupe-class-members.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-dupe-class-members 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-enum-values.shot b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-enum-values.shot new file mode 100644 index 000000000000..466f69dde1e6 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-enum-values.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-duplicate-enum-values 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot new file mode 100644 index 000000000000..4fea0452f152 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-duplicate-type-constituents 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "type": "object", + "properties": { + "ignoreIntersections": { "type": "boolean" }, + "ignoreUnions": { "type": "boolean" } + } + } +] + + +# TYPES: + +type Options = [ + { + ignoreIntersections?: boolean; + ignoreUnions?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-dynamic-delete.shot b/packages/eslint-plugin/tests/schema-snapshots/no-dynamic-delete.shot new file mode 100644 index 000000000000..3a77da1e1ca7 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-dynamic-delete.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-dynamic-delete 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot b/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot new file mode 100644 index 000000000000..fa3716efd597 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-empty-function 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allow": { + "type": "array", + "items": { + "enum": [ + "functions", + "arrowFunctions", + "generatorFunctions", + "methods", + "generatorMethods", + "getters", + "setters", + "constructors", + "private-constructors", + "protected-constructors", + "asyncFunctions", + "asyncMethods", + "decoratedFunctions", + "overrideMethods" + ] + }, + "uniqueItems": true + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + allow?: ( + | 'functions' + | 'arrowFunctions' + | 'generatorFunctions' + | 'methods' + | 'generatorMethods' + | 'getters' + | 'setters' + | 'constructors' + | 'private-constructors' + | 'protected-constructors' + | 'asyncFunctions' + | 'asyncMethods' + | 'decoratedFunctions' + | 'overrideMethods' + )[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot b/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot new file mode 100644 index 000000000000..324d9dadff98 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-empty-interface 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "additionalProperties": false, + "properties": { "allowSingleExtends": { "type": "boolean" } } + } +] + + +# TYPES: + +type Options = [ + { + allowSingleExtends?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-explicit-any.shot b/packages/eslint-plugin/tests/schema-snapshots/no-explicit-any.shot new file mode 100644 index 000000000000..fdb1ddf910c8 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-explicit-any.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-explicit-any 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "additionalProperties": false, + "properties": { + "fixToUnknown": { + "description": "Whether to enable auto-fixing in which the \`any\` type is converted to the \`unknown\` type.", + "type": "boolean" + }, + "ignoreRestArgs": { + "description": "Whether to ignore rest parameter arrays.", + "type": "boolean" + } + } + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to enable auto-fixing in which the \`any\` type is converted to the \`unknown\` type. */ + fixToUnknown?: boolean; + /** Whether to ignore rest parameter arrays. */ + ignoreRestArgs?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-non-null-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-non-null-assertion.shot new file mode 100644 index 000000000000..1bdd3183789f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-non-null-assertion.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-extra-non-null-assertion 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot new file mode 100644 index 000000000000..07e519d8474f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot @@ -0,0 +1,68 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-extra-parens 1`] = ` +" +# SCHEMA: + +{ + "anyOf": [ + { + "type": "array", + "items": [{ "enum": ["functions"] }], + "minItems": 0, + "maxItems": 1 + }, + { + "type": "array", + "items": [ + { "enum": ["all"] }, + { + "type": "object", + "properties": { + "conditionalAssign": { "type": "boolean" }, + "nestedBinaryExpressions": { "type": "boolean" }, + "returnAssign": { "type": "boolean" }, + "ignoreJSX": { + "enum": ["none", "all", "single-line", "multi-line"] + }, + "enforceForArrowConditionals": { "type": "boolean" }, + "enforceForSequenceExpressions": { "type": "boolean" }, + "enforceForNewInMemberExpressions": { "type": "boolean" }, + "enforceForFunctionPrototypeMethods": { "type": "boolean" }, + "allowParensAfterCommentPattern": { "type": "string" } + }, + "additionalProperties": false + } + ], + "minItems": 0, + "maxItems": 2 + } + ] +} + + +# TYPES: + +type Options = + | ([] | ['functions', ...unknown[]]) + | ( + | [] + | ['all'] + | [ + 'all', + { + conditionalAssign?: boolean; + nestedBinaryExpressions?: boolean; + returnAssign?: boolean; + ignoreJSX?: 'none' | 'all' | 'single-line' | 'multi-line'; + enforceForArrowConditionals?: boolean; + enforceForSequenceExpressions?: boolean; + enforceForNewInMemberExpressions?: boolean; + enforceForFunctionPrototypeMethods?: boolean; + allowParensAfterCommentPattern?: string; + }, + ...unknown[], + ] + ); +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-semi.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-semi.shot new file mode 100644 index 000000000000..dc3b391ba2ff --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-semi.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-extra-semi 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extraneous-class.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extraneous-class.shot new file mode 100644 index 000000000000..d1c635f49215 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extraneous-class.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-extraneous-class 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "additionalProperties": false, + "properties": { + "allowConstructorOnly": { + "description": "Whether to allow extraneous classes that contain only a constructor.", + "type": "boolean" + }, + "allowEmpty": { + "description": "Whether to allow extraneous classes that have no body (i.e. are empty).", + "type": "boolean" + }, + "allowStaticOnly": { + "description": "Whether to allow extraneous classes that only contain static members.", + "type": "boolean" + }, + "allowWithDecorator": { + "description": "Whether to allow extraneous classes that include a decorator.", + "type": "boolean" + } + } + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow extraneous classes that contain only a constructor. */ + allowConstructorOnly?: boolean; + /** Whether to allow extraneous classes that have no body (i.e. are empty). */ + allowEmpty?: boolean; + /** Whether to allow extraneous classes that only contain static members. */ + allowStaticOnly?: boolean; + /** Whether to allow extraneous classes that include a decorator. */ + allowWithDecorator?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot b/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot new file mode 100644 index 000000000000..e0d7912480b8 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-floating-promises 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "ignoreVoid": { + "description": "Whether to ignore \`void\` expressions.", + "type": "boolean" + }, + "ignoreIIFE": { + "description": "Whether to ignore async IIFEs (Immediately Invocated Function Expressions).", + "type": "boolean" + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to ignore \`void\` expressions. */ + ignoreVoid?: boolean; + /** Whether to ignore async IIFEs (Immediately Invocated Function Expressions). */ + ignoreIIFE?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-for-in-array.shot b/packages/eslint-plugin/tests/schema-snapshots/no-for-in-array.shot new file mode 100644 index 000000000000..f5942d6181c2 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-for-in-array.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-for-in-array 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-implied-eval.shot b/packages/eslint-plugin/tests/schema-snapshots/no-implied-eval.shot new file mode 100644 index 000000000000..32ce767e8131 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-implied-eval.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-implied-eval 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-import-type-side-effects.shot b/packages/eslint-plugin/tests/schema-snapshots/no-import-type-side-effects.shot new file mode 100644 index 000000000000..02d339242576 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-import-type-side-effects.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-import-type-side-effects 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot b/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot new file mode 100644 index 000000000000..cfddb353a5b4 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-inferrable-types 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "ignoreParameters": { "type": "boolean" }, + "ignoreProperties": { "type": "boolean" } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + ignoreParameters?: boolean; + ignoreProperties?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-this.shot b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-this.shot new file mode 100644 index 000000000000..68b915024f8f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-this.shot @@ -0,0 +1,26 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-invalid-this 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "capIsConstructor": { "type": "boolean", "default": true } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + capIsConstructor?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot new file mode 100644 index 000000000000..89ed05252f0a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-invalid-void-type 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowInGenericTypeArguments": { + "oneOf": [ + { "type": "boolean" }, + { "type": "array", "items": { "type": "string" }, "minLength": 1 } + ] + }, + "allowAsThisParameter": { "type": "boolean" } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + allowInGenericTypeArguments?: boolean | string[]; + allowAsThisParameter?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-loop-func.shot b/packages/eslint-plugin/tests/schema-snapshots/no-loop-func.shot new file mode 100644 index 000000000000..1509d5ece1b2 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-loop-func.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-loop-func 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-loss-of-precision.shot b/packages/eslint-plugin/tests/schema-snapshots/no-loss-of-precision.shot new file mode 100644 index 000000000000..54ee68e2e891 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-loss-of-precision.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-loss-of-precision 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot new file mode 100644 index 000000000000..dcf2177742d4 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-magic-numbers 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "detectObjects": { "type": "boolean", "default": false }, + "enforceConst": { "type": "boolean", "default": false }, + "ignore": { + "type": "array", + "items": { + "anyOf": [ + { "type": "number" }, + { "type": "string", "pattern": "^[+-]?(?:0|[1-9][0-9]*)n$" } + ] + }, + "uniqueItems": true + }, + "ignoreArrayIndexes": { "type": "boolean", "default": false }, + "ignoreDefaultValues": { "type": "boolean", "default": false }, + "ignoreClassFieldInitialValues": { "type": "boolean", "default": false }, + "ignoreNumericLiteralTypes": { "type": "boolean" }, + "ignoreEnums": { "type": "boolean" }, + "ignoreReadonlyClassProperties": { "type": "boolean" }, + "ignoreTypeIndexes": { "type": "boolean" } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + detectObjects?: boolean; + enforceConst?: boolean; + ignore?: (number | string)[]; + ignoreArrayIndexes?: boolean; + ignoreDefaultValues?: boolean; + ignoreClassFieldInitialValues?: boolean; + ignoreNumericLiteralTypes?: boolean; + ignoreEnums?: boolean; + ignoreReadonlyClassProperties?: boolean; + ignoreTypeIndexes?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot b/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot new file mode 100644 index 000000000000..158ac751246c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-meaningless-void-operator 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { "checkNever": { "type": "boolean", "default": false } }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + checkNever?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-misused-new.shot b/packages/eslint-plugin/tests/schema-snapshots/no-misused-new.shot new file mode 100644 index 000000000000..52ae6ae98c0a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-misused-new.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-misused-new 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot b/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot new file mode 100644 index 000000000000..5981e1ab0fb3 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot @@ -0,0 +1,52 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-misused-promises 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "checksConditionals": { "type": "boolean" }, + "checksVoidReturn": { + "oneOf": [ + { "type": "boolean" }, + { + "additionalProperties": false, + "properties": { + "arguments": { "type": "boolean" }, + "attributes": { "type": "boolean" }, + "properties": { "type": "boolean" }, + "returns": { "type": "boolean" }, + "variables": { "type": "boolean" } + }, + "type": "object" + } + ] + }, + "checksSpreads": { "type": "boolean" } + } + } +] + + +# TYPES: + +type Options = [ + { + checksConditionals?: boolean; + checksVoidReturn?: + | boolean + | { + arguments?: boolean; + attributes?: boolean; + properties?: boolean; + returns?: boolean; + variables?: boolean; + }; + checksSpreads?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-mixed-enums.shot b/packages/eslint-plugin/tests/schema-snapshots/no-mixed-enums.shot new file mode 100644 index 000000000000..ce6f15629800 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-mixed-enums.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-mixed-enums 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-namespace.shot b/packages/eslint-plugin/tests/schema-snapshots/no-namespace.shot new file mode 100644 index 000000000000..07d55607e3ca --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-namespace.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-namespace 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowDeclarations": { + "description": "Whether to allow \`declare\` with custom TypeScript namespaces.", + "type": "boolean" + }, + "allowDefinitionFiles": { + "description": "Whether to allow \`declare\` with custom TypeScript namespaces inside definition files.", + "type": "boolean" + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow \`declare\` with custom TypeScript namespaces. */ + allowDeclarations?: boolean; + /** Whether to allow \`declare\` with custom TypeScript namespaces inside definition files. */ + allowDefinitionFiles?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-nullish-coalescing.shot b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-nullish-coalescing.shot new file mode 100644 index 000000000000..ce0bfb40fe44 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-nullish-coalescing.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-non-null-asserted-nullish-coalescing 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-optional-chain.shot b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-optional-chain.shot new file mode 100644 index 000000000000..27c579c858c0 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-optional-chain.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-non-null-asserted-optional-chain 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-assertion.shot new file mode 100644 index 000000000000..f292b46e3065 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-assertion.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-non-null-assertion 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot b/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot new file mode 100644 index 000000000000..81f9be90ffdb --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-redeclare 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "builtinGlobals": { "type": "boolean" }, + "ignoreDeclarationMerge": { "type": "boolean" } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + builtinGlobals?: boolean; + ignoreDeclarationMerge?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-redundant-type-constituents.shot b/packages/eslint-plugin/tests/schema-snapshots/no-redundant-type-constituents.shot new file mode 100644 index 000000000000..e80f262a7ce3 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-redundant-type-constituents.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-redundant-type-constituents 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-require-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/no-require-imports.shot new file mode 100644 index 000000000000..bdb7cb325381 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-require-imports.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-require-imports 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot new file mode 100644 index 000000000000..e7b948d93f63 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot @@ -0,0 +1,147 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-restricted-imports 1`] = ` +" +# SCHEMA: + +{ + "anyOf": [ + { + "type": "array", + "items": { + "anyOf": [ + { "type": "string" }, + { + "type": "object", + "properties": { + "name": { "type": "string" }, + "message": { "type": "string", "minLength": 1 }, + "importNames": { "type": "array", "items": { "type": "string" } }, + "allowTypeImports": { "type": "boolean", "default": false } + }, + "additionalProperties": false, + "required": ["name"] + } + ] + }, + "uniqueItems": true + }, + { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "paths": { + "type": "array", + "items": { + "anyOf": [ + { "type": "string" }, + { + "type": "object", + "properties": { + "name": { "type": "string" }, + "message": { "type": "string", "minLength": 1 }, + "importNames": { + "type": "array", + "items": { "type": "string" } + }, + "allowTypeImports": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false, + "required": ["name"] + } + ] + }, + "uniqueItems": true + }, + "patterns": { + "anyOf": [ + { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "importNames": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "uniqueItems": true + }, + "group": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "uniqueItems": true + }, + "message": { "type": "string", "minLength": 1 }, + "caseSensitive": { "type": "boolean" }, + "allowTypeImports": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false, + "required": ["group"] + }, + "uniqueItems": true + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalItems": false + } + ] +} + + +# TYPES: + +type Options = + | ( + | string + | { + name: string; + message?: string; + importNames?: string[]; + allowTypeImports?: boolean; + } + )[] + | ( + | [] + | [ + { + paths?: ( + | string + | { + name: string; + message?: string; + importNames?: string[]; + allowTypeImports?: boolean; + } + )[]; + patterns?: + | string[] + | { + importNames?: [string, ...string[]]; + group: [string, ...string[]]; + message?: string; + caseSensitive?: boolean; + allowTypeImports?: boolean; + }[]; + }, + ] + ); +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot b/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot new file mode 100644 index 000000000000..6c6230c8a451 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-shadow 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "builtinGlobals": { "type": "boolean" }, + "hoist": { "enum": ["all", "functions", "never"] }, + "allow": { "type": "array", "items": { "type": "string" } }, + "ignoreOnInitialization": { "type": "boolean" }, + "ignoreTypeValueShadow": { "type": "boolean" }, + "ignoreFunctionTypeParameterNameValueShadow": { "type": "boolean" } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + builtinGlobals?: boolean; + hoist?: 'all' | 'functions' | 'never'; + allow?: string[]; + ignoreOnInitialization?: boolean; + ignoreTypeValueShadow?: boolean; + ignoreFunctionTypeParameterNameValueShadow?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-this-alias.shot b/packages/eslint-plugin/tests/schema-snapshots/no-this-alias.shot new file mode 100644 index 000000000000..1e6fd33384e6 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-this-alias.shot @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-this-alias 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "additionalProperties": false, + "properties": { + "allowDestructuring": { + "description": "Whether to ignore destructurings, such as \`const { props, state } = this\`.", + "type": "boolean" + }, + "allowedNames": { + "description": "Names to ignore, such as [\\"self\\"] for \`const self = this;\`.", + "type": "array", + "items": { "type": "string" } + } + } + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to ignore destructurings, such as \`const { props, state } = this\`. */ + allowDestructuring?: boolean; + /** Names to ignore, such as ["self"] for \`const self = this;\`. */ + allowedNames?: string[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-throw-literal.shot b/packages/eslint-plugin/tests/schema-snapshots/no-throw-literal.shot new file mode 100644 index 000000000000..e85ccf93c931 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-throw-literal.shot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-throw-literal 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowThrowingAny": { "type": "boolean" }, + "allowThrowingUnknown": { "type": "boolean" } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + allowThrowingAny?: boolean; + allowThrowingUnknown?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot new file mode 100644 index 000000000000..c5f5ef21d921 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-type-alias 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowAliases": { + "description": "Whether to allow direct one-to-one type aliases.", + "enum": [ + "always", + "never", + "in-unions", + "in-intersections", + "in-unions-and-intersections" + ] + }, + "allowCallbacks": { + "description": "Whether to allow type aliases for callbacks.", + "enum": ["always", "never"] + }, + "allowConditionalTypes": { + "description": "Whether to allow type aliases for conditional types.", + "enum": ["always", "never"] + }, + "allowConstructors": { + "description": "Whether to allow type aliases with constructors.", + "enum": ["always", "never"] + }, + "allowLiterals": { + "description": "Whether to allow type aliases with object literal types.", + "enum": [ + "always", + "never", + "in-unions", + "in-intersections", + "in-unions-and-intersections" + ] + }, + "allowMappedTypes": { + "description": "Whether to allow type aliases with mapped types.", + "enum": [ + "always", + "never", + "in-unions", + "in-intersections", + "in-unions-and-intersections" + ] + }, + "allowTupleTypes": { + "description": "Whether to allow type aliases with tuple types.", + "enum": [ + "always", + "never", + "in-unions", + "in-intersections", + "in-unions-and-intersections" + ] + }, + "allowGenerics": { + "description": "Whether to allow type aliases with generic types.", + "enum": ["always", "never"] + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow direct one-to-one type aliases. */ + allowAliases?: + | 'always' + | 'never' + | 'in-unions' + | 'in-intersections' + | 'in-unions-and-intersections'; + /** Whether to allow type aliases for callbacks. */ + allowCallbacks?: 'always' | 'never'; + /** Whether to allow type aliases for conditional types. */ + allowConditionalTypes?: 'always' | 'never'; + /** Whether to allow type aliases with constructors. */ + allowConstructors?: 'always' | 'never'; + /** Whether to allow type aliases with object literal types. */ + allowLiterals?: + | 'always' + | 'never' + | 'in-unions' + | 'in-intersections' + | 'in-unions-and-intersections'; + /** Whether to allow type aliases with mapped types. */ + allowMappedTypes?: + | 'always' + | 'never' + | 'in-unions' + | 'in-intersections' + | 'in-unions-and-intersections'; + /** Whether to allow type aliases with tuple types. */ + allowTupleTypes?: + | 'always' + | 'never' + | 'in-unions' + | 'in-intersections' + | 'in-unions-and-intersections'; + /** Whether to allow type aliases with generic types. */ + allowGenerics?: 'always' | 'never'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot new file mode 100644 index 000000000000..855b4fc6627e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-boolean-literal-compare 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowComparingNullableBooleansToTrue": { + "description": "Whether to allow comparisons between nullable boolean variables and \`true\`.", + "type": "boolean" + }, + "allowComparingNullableBooleansToFalse": { + "description": "Whether to allow comparisons between nullable boolean variables and \`false\`.", + "type": "boolean" + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow comparisons between nullable boolean variables and \`true\`. */ + allowComparingNullableBooleansToTrue?: boolean; + /** Whether to allow comparisons between nullable boolean variables and \`false\`. */ + allowComparingNullableBooleansToFalse?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot new file mode 100644 index 000000000000..e38f876cca21 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-condition 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowConstantLoopConditions": { + "description": "Whether to ignore constant loop conditions, such as \`while (true)\`.", + "type": "boolean" + }, + "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": { + "description": "Whether to not error when running with a tsconfig that has strictNullChecks turned.", + "type": "boolean" + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to ignore constant loop conditions, such as \`while (true)\`. */ + allowConstantLoopConditions?: boolean; + /** Whether to not error when running with a tsconfig that has strictNullChecks turned. */ + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-qualifier.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-qualifier.shot new file mode 100644 index 000000000000..728930a1d9cc --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-qualifier.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-qualifier 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-arguments.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-arguments.shot new file mode 100644 index 000000000000..275c98ba22fd --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-arguments.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-type-arguments 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-assertion.shot new file mode 100644 index 000000000000..3e20bd213047 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-assertion.shot @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-type-assertion 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "typesToIgnore": { + "description": "A list of type names to ignore.", + "type": "array", + "items": { "type": "string" } + } + } + } +] + + +# TYPES: + +type Options = [ + { + /** A list of type names to ignore. */ + typesToIgnore?: string[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-constraint.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-constraint.shot new file mode 100644 index 000000000000..2a2fbcd8b92e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-constraint.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-type-constraint 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-argument.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-argument.shot new file mode 100644 index 000000000000..9acbeed8bf21 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-argument.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-argument 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-assignment.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-assignment.shot new file mode 100644 index 000000000000..0df27b8f4bd5 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-assignment.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-assignment 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-call.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-call.shot new file mode 100644 index 000000000000..6c7d5b0a83ab --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-call.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-call 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-declaration-merging.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-declaration-merging.shot new file mode 100644 index 000000000000..559a8bc7fe7f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-declaration-merging.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-declaration-merging 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-enum-comparison.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-enum-comparison.shot new file mode 100644 index 000000000000..1fc8fd77fbc0 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-enum-comparison.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-enum-comparison 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-member-access.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-member-access.shot new file mode 100644 index 000000000000..bf7c89189dc6 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-member-access.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-member-access 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-return.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-return.shot new file mode 100644 index 000000000000..a66f82fae7ac --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-return.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-return 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot new file mode 100644 index 000000000000..2bb77b1795c0 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unused-expressions 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowShortCircuit": { "type": "boolean", "default": false }, + "allowTernary": { "type": "boolean", "default": false }, + "allowTaggedTemplates": { "type": "boolean", "default": false }, + "enforceForJSX": { "type": "boolean", "default": false } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + allowShortCircuit?: boolean; + allowTernary?: boolean; + allowTaggedTemplates?: boolean; + enforceForJSX?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot new file mode 100644 index 000000000000..29e754709f07 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unused-vars 1`] = ` +" +# SCHEMA: + +[ + { + "oneOf": [ + { "enum": ["all", "local"] }, + { + "type": "object", + "properties": { + "vars": { "enum": ["all", "local"] }, + "varsIgnorePattern": { "type": "string" }, + "args": { "enum": ["all", "after-used", "none"] }, + "ignoreRestSiblings": { "type": "boolean" }, + "argsIgnorePattern": { "type": "string" }, + "caughtErrors": { "enum": ["all", "none"] }, + "caughtErrorsIgnorePattern": { "type": "string" }, + "destructuredArrayIgnorePattern": { "type": "string" } + }, + "additionalProperties": false + } + ] + } +] + + +# TYPES: + +type Options = [ + | ('all' | 'local') + | { + vars?: 'all' | 'local'; + varsIgnorePattern?: string; + args?: 'all' | 'after-used' | 'none'; + ignoreRestSiblings?: boolean; + argsIgnorePattern?: string; + caughtErrors?: 'all' | 'none'; + caughtErrorsIgnorePattern?: string; + destructuredArrayIgnorePattern?: string; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot new file mode 100644 index 000000000000..9cb5d62aa255 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-use-before-define 1`] = ` +" +# SCHEMA: + +[ + { + "oneOf": [ + { "enum": ["nofunc"] }, + { + "type": "object", + "properties": { + "functions": { "type": "boolean" }, + "classes": { "type": "boolean" }, + "enums": { "type": "boolean" }, + "variables": { "type": "boolean" }, + "typedefs": { "type": "boolean" }, + "ignoreTypeReferences": { "type": "boolean" }, + "allowNamedExports": { "type": "boolean" } + }, + "additionalProperties": false + } + ] + } +] + + +# TYPES: + +type Options = [ + | 'nofunc' + | { + functions?: boolean; + classes?: boolean; + enums?: boolean; + variables?: boolean; + typedefs?: boolean; + ignoreTypeReferences?: boolean; + allowNamedExports?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-useless-constructor.shot b/packages/eslint-plugin/tests/schema-snapshots/no-useless-constructor.shot new file mode 100644 index 000000000000..59fac39b876b --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-useless-constructor.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-useless-constructor 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-useless-empty-export.shot b/packages/eslint-plugin/tests/schema-snapshots/no-useless-empty-export.shot new file mode 100644 index 000000000000..40b42b0fa7eb --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-useless-empty-export.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-useless-empty-export 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-var-requires.shot b/packages/eslint-plugin/tests/schema-snapshots/no-var-requires.shot new file mode 100644 index 000000000000..992833a20ae3 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-var-requires.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-var-requires 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/non-nullable-type-assertion-style.shot b/packages/eslint-plugin/tests/schema-snapshots/non-nullable-type-assertion-style.shot new file mode 100644 index 000000000000..483a62f5f09d --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/non-nullable-type-assertion-style.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes non-nullable-type-assertion-style 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/object-curly-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/object-curly-spacing.shot new file mode 100644 index 000000000000..ee7f267a7f65 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/object-curly-spacing.shot @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes object-curly-spacing 1`] = ` +" +# SCHEMA: + +[ + { "enum": ["always", "never"] }, + { + "type": "object", + "properties": { + "arraysInObjects": { "type": "boolean" }, + "objectsInObjects": { "type": "boolean" } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + 'always' | 'never', + { + arraysInObjects?: boolean; + objectsInObjects?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot new file mode 100644 index 000000000000..b0e47c104105 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot @@ -0,0 +1,264 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes padding-line-between-statements 1`] = ` +" +# SCHEMA: + +{ + "$defs": { + "paddingType": { "enum": ["any", "never", "always"] }, + "statementType": { + "anyOf": [ + { + "enum": [ + "*", + "block-like", + "exports", + "require", + "directive", + "expression", + "iife", + "multiline-block-like", + "multiline-expression", + "multiline-const", + "multiline-let", + "multiline-var", + "singleline-const", + "singleline-let", + "singleline-var", + "block", + "empty", + "function", + "break", + "case", + "class", + "const", + "continue", + "debugger", + "default", + "do", + "export", + "for", + "if", + "import", + "let", + "return", + "switch", + "throw", + "try", + "var", + "while", + "with", + "interface", + "type" + ] + }, + { + "type": "array", + "items": { + "enum": [ + "*", + "block-like", + "exports", + "require", + "directive", + "expression", + "iife", + "multiline-block-like", + "multiline-expression", + "multiline-const", + "multiline-let", + "multiline-var", + "singleline-const", + "singleline-let", + "singleline-var", + "block", + "empty", + "function", + "break", + "case", + "class", + "const", + "continue", + "debugger", + "default", + "do", + "export", + "for", + "if", + "import", + "let", + "return", + "switch", + "throw", + "try", + "var", + "while", + "with", + "interface", + "type" + ] + }, + "minItems": 1, + "uniqueItems": true, + "additionalItems": false + } + ] + } + }, + "type": "array", + "items": { + "type": "object", + "properties": { + "blankLine": { "$ref": "#/$defs/paddingType" }, + "prev": { "$ref": "#/$defs/statementType" }, + "next": { "$ref": "#/$defs/statementType" } + }, + "additionalProperties": false, + "required": ["blankLine", "prev", "next"] + }, + "additionalItems": false +} + + +# TYPES: + +type PaddingType = 'any' | 'never' | 'always'; + +type StatementType = + | ( + | '*' + | 'block-like' + | 'exports' + | 'require' + | 'directive' + | 'expression' + | 'iife' + | 'multiline-block-like' + | 'multiline-expression' + | 'multiline-const' + | 'multiline-let' + | 'multiline-var' + | 'singleline-const' + | 'singleline-let' + | 'singleline-var' + | 'block' + | 'empty' + | 'function' + | 'break' + | 'case' + | 'class' + | 'const' + | 'continue' + | 'debugger' + | 'default' + | 'do' + | 'export' + | 'for' + | 'if' + | 'import' + | 'let' + | 'return' + | 'switch' + | 'throw' + | 'try' + | 'var' + | 'while' + | 'with' + | 'interface' + | 'type' + ) + | [ + ( + | '*' + | 'block-like' + | 'exports' + | 'require' + | 'directive' + | 'expression' + | 'iife' + | 'multiline-block-like' + | 'multiline-expression' + | 'multiline-const' + | 'multiline-let' + | 'multiline-var' + | 'singleline-const' + | 'singleline-let' + | 'singleline-var' + | 'block' + | 'empty' + | 'function' + | 'break' + | 'case' + | 'class' + | 'const' + | 'continue' + | 'debugger' + | 'default' + | 'do' + | 'export' + | 'for' + | 'if' + | 'import' + | 'let' + | 'return' + | 'switch' + | 'throw' + | 'try' + | 'var' + | 'while' + | 'with' + | 'interface' + | 'type' + ), + ...( + | '*' + | 'block-like' + | 'exports' + | 'require' + | 'directive' + | 'expression' + | 'iife' + | 'multiline-block-like' + | 'multiline-expression' + | 'multiline-const' + | 'multiline-let' + | 'multiline-var' + | 'singleline-const' + | 'singleline-let' + | 'singleline-var' + | 'block' + | 'empty' + | 'function' + | 'break' + | 'case' + | 'class' + | 'const' + | 'continue' + | 'debugger' + | 'default' + | 'do' + | 'export' + | 'for' + | 'if' + | 'import' + | 'let' + | 'return' + | 'switch' + | 'throw' + | 'try' + | 'var' + | 'while' + | 'with' + | 'interface' + | 'type' + )[], + ]; + +type Options = { + blankLine: PaddingType; + prev: StatementType; + next: StatementType; +}[]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot b/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot new file mode 100644 index 000000000000..5ba7133dd3c9 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot @@ -0,0 +1,54 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes parameter-properties 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "modifier": { + "enum": [ + "readonly", + "private", + "protected", + "public", + "private readonly", + "protected readonly", + "public readonly" + ] + } + }, + "type": "object", + "properties": { + "allow": { + "type": "array", + "items": { "$ref": "#/items/0/$defs/modifier" }, + "minItems": 1 + }, + "prefer": { "enum": ["class-property", "parameter-property"] } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Modifier = + | 'readonly' + | 'private' + | 'protected' + | 'public' + | 'private readonly' + | 'protected readonly' + | 'public readonly'; + +type Options = [ + { + allow?: [Modifier, ...Modifier[]]; + prefer?: 'class-property' | 'parameter-property'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-as-const.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-as-const.shot new file mode 100644 index 000000000000..1e687c2a354e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-as-const.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-as-const 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-enum-initializers.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-enum-initializers.shot new file mode 100644 index 000000000000..281bbd737c0d --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-enum-initializers.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-enum-initializers 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-for-of.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-for-of.shot new file mode 100644 index 000000000000..07e7b0510c44 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-for-of.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-for-of 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-function-type.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-function-type.shot new file mode 100644 index 000000000000..5c28dbbe392d --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-function-type.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-function-type 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-includes.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-includes.shot new file mode 100644 index 000000000000..0315e76ddaa7 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-includes.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-includes 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot new file mode 100644 index 000000000000..2af3296291ee --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-literal-enum-member 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { "allowBitwiseExpressions": { "type": "boolean" } }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + allowBitwiseExpressions?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-namespace-keyword.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-namespace-keyword.shot new file mode 100644 index 000000000000..6ef076952a87 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-namespace-keyword.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-namespace-keyword 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot new file mode 100644 index 000000000000..026ab583d675 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot @@ -0,0 +1,34 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-nullish-coalescing 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "ignoreConditionalTests": { "type": "boolean" }, + "ignoreTernaryTests": { "type": "boolean" }, + "ignoreMixedLogicalExpressions": { "type": "boolean" }, + "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": { + "type": "boolean" + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + ignoreConditionalTests?: boolean; + ignoreTernaryTests?: boolean; + ignoreMixedLogicalExpressions?: boolean; + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-optional-chain.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-optional-chain.shot new file mode 100644 index 000000000000..4f5b7623fd8e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-optional-chain.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-optional-chain 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot new file mode 100644 index 000000000000..307123536446 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot @@ -0,0 +1,114 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-readonly-parameter-types 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "additionalProperties": false, + "properties": { + "allow": { + "type": "array", + "items": { + "oneOf": [ + { "type": "string" }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "from": { "type": "string", "enum": ["file"] }, + "name": { + "oneOf": [ + { "type": "string" }, + { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { "type": "string" } + } + ] + }, + "path": { "type": "string" } + }, + "required": ["from", "name"] + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "from": { "type": "string", "enum": ["lib"] }, + "name": { + "oneOf": [ + { "type": "string" }, + { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { "type": "string" } + } + ] + } + }, + "required": ["from", "name"] + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "from": { "type": "string", "enum": ["package"] }, + "name": { + "oneOf": [ + { "type": "string" }, + { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { "type": "string" } + } + ] + }, + "package": { "type": "string" } + }, + "required": ["from", "name", "package"] + } + ] + } + }, + "checkParameterProperties": { "type": "boolean" }, + "ignoreInferredTypes": { "type": "boolean" }, + "treatMethodsAsReadonly": { "type": "boolean" } + } + } +] + + +# TYPES: + +type Options = [ + { + allow?: ( + | string + | { + from: 'file'; + name: string | [string, ...string[]]; + path?: string; + } + | { + from: 'lib'; + name: string | [string, ...string[]]; + } + | { + from: 'package'; + name: string | [string, ...string[]]; + package: string; + } + )[]; + checkParameterProperties?: boolean; + ignoreInferredTypes?: boolean; + treatMethodsAsReadonly?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot new file mode 100644 index 000000000000..6badcd0c30e8 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-readonly 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { "onlyInlineLambdas": { "type": "boolean" } }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + onlyInlineLambdas?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-reduce-type-parameter.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-reduce-type-parameter.shot new file mode 100644 index 000000000000..d3aa7a0217f4 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-reduce-type-parameter.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-reduce-type-parameter 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-regexp-exec.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-regexp-exec.shot new file mode 100644 index 000000000000..7a34c3792696 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-regexp-exec.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-regexp-exec 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-return-this-type.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-return-this-type.shot new file mode 100644 index 000000000000..043d5a211b5b --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-return-this-type.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-return-this-type 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-string-starts-ends-with.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-string-starts-ends-with.shot new file mode 100644 index 000000000000..d05465a64ca6 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-string-starts-ends-with.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-string-starts-ends-with 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-ts-expect-error.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-ts-expect-error.shot new file mode 100644 index 000000000000..44fe6704b60d --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-ts-expect-error.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-ts-expect-error 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot b/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot new file mode 100644 index 000000000000..428f27957eca --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot @@ -0,0 +1,45 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes promise-function-async 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowAny": { + "description": "Whether to consider \`any\` and \`unknown\` to be Promises.", + "type": "boolean" + }, + "allowedPromiseNames": { + "description": "Any extra names of classes or interfaces to be considered Promises.", + "type": "array", + "items": { "type": "string" } + }, + "checkArrowFunctions": { "type": "boolean" }, + "checkFunctionDeclarations": { "type": "boolean" }, + "checkFunctionExpressions": { "type": "boolean" }, + "checkMethodDeclarations": { "type": "boolean" } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to consider \`any\` and \`unknown\` to be Promises. */ + allowAny?: boolean; + /** Any extra names of classes or interfaces to be considered Promises. */ + allowedPromiseNames?: string[]; + checkArrowFunctions?: boolean; + checkFunctionDeclarations?: boolean; + checkFunctionExpressions?: boolean; + checkMethodDeclarations?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/quotes.shot b/packages/eslint-plugin/tests/schema-snapshots/quotes.shot new file mode 100644 index 000000000000..4da8b202c825 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/quotes.shot @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes quotes 1`] = ` +" +# SCHEMA: + +[ + { "enum": ["single", "double", "backtick"] }, + { + "anyOf": [ + { "enum": ["avoid-escape"] }, + { + "type": "object", + "properties": { + "avoidEscape": { "type": "boolean" }, + "allowTemplateLiterals": { "type": "boolean" } + }, + "additionalProperties": false + } + ] + } +] + + +# TYPES: + +type Options = [ + 'single' | 'double' | 'backtick', + ( + | 'avoid-escape' + | { + avoidEscape?: boolean; + allowTemplateLiterals?: boolean; + } + ), +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/require-array-sort-compare.shot b/packages/eslint-plugin/tests/schema-snapshots/require-array-sort-compare.shot new file mode 100644 index 000000000000..195dc21d269a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/require-array-sort-compare.shot @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes require-array-sort-compare 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "ignoreStringArrays": { + "description": "Whether to ignore arrays in which all elements are strings.", + "type": "boolean" + } + } + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to ignore arrays in which all elements are strings. */ + ignoreStringArrays?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/require-await.shot b/packages/eslint-plugin/tests/schema-snapshots/require-await.shot new file mode 100644 index 000000000000..61fb0467b290 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/require-await.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes require-await 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot b/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot new file mode 100644 index 000000000000..377143509c43 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes restrict-plus-operands 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "additionalProperties": false, + "properties": { + "checkCompoundAssignments": { + "description": "Whether to check compound assignments such as \`+=\`.", + "type": "boolean" + }, + "allowAny": { + "description": "Whether to allow \`any\` typed values.", + "type": "boolean" + } + } + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to check compound assignments such as \`+=\`. */ + checkCompoundAssignments?: boolean; + /** Whether to allow \`any\` typed values. */ + allowAny?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot new file mode 100644 index 000000000000..095a1fed10be --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes restrict-template-expressions 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowNumber": { + "description": "Whether to allow \`number\` typed values in template expressions.", + "type": "boolean" + }, + "allowBoolean": { + "description": "Whether to allow \`boolean\` typed values in template expressions.", + "type": "boolean" + }, + "allowAny": { + "description": "Whether to allow \`any\` typed values in template expressions.", + "type": "boolean" + }, + "allowNullish": { + "description": "Whether to allow \`nullish\` typed values in template expressions.", + "type": "boolean" + }, + "allowRegExp": { + "description": "Whether to allow \`regexp\` typed values in template expressions.", + "type": "boolean" + }, + "allowNever": { + "description": "Whether to allow \`never\` typed values in template expressions.", + "type": "boolean" + } + } + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow \`number\` typed values in template expressions. */ + allowNumber?: boolean; + /** Whether to allow \`boolean\` typed values in template expressions. */ + allowBoolean?: boolean; + /** Whether to allow \`any\` typed values in template expressions. */ + allowAny?: boolean; + /** Whether to allow \`nullish\` typed values in template expressions. */ + allowNullish?: boolean; + /** Whether to allow \`regexp\` typed values in template expressions. */ + allowRegExp?: boolean; + /** Whether to allow \`never\` typed values in template expressions. */ + allowNever?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/return-await.shot b/packages/eslint-plugin/tests/schema-snapshots/return-await.shot new file mode 100644 index 000000000000..6ce1aca3c309 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/return-await.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes return-await 1`] = ` +" +# SCHEMA: + +[{ "enum": ["in-try-catch", "always", "never"] }] + + +# TYPES: + +type Options = ['in-try-catch' | 'always' | 'never']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/semi.shot b/packages/eslint-plugin/tests/schema-snapshots/semi.shot new file mode 100644 index 000000000000..a782b4ba6d1f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/semi.shot @@ -0,0 +1,69 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes semi 1`] = ` +" +# SCHEMA: + +{ + "anyOf": [ + { + "type": "array", + "items": [ + { "enum": ["never"] }, + { + "type": "object", + "properties": { + "beforeStatementContinuationChars": { + "enum": ["always", "any", "never"] + } + }, + "additionalProperties": false + } + ], + "minItems": 0, + "maxItems": 2 + }, + { + "type": "array", + "items": [ + { "enum": ["always"] }, + { + "type": "object", + "properties": { "omitLastInOneLineBlock": { "type": "boolean" } }, + "additionalProperties": false + } + ], + "minItems": 0, + "maxItems": 2 + } + ] +} + + +# TYPES: + +type Options = + | ( + | [] + | ['never'] + | [ + 'never', + { + beforeStatementContinuationChars?: 'always' | 'any' | 'never'; + }, + ...unknown[], + ] + ) + | ( + | [] + | ['always'] + | [ + 'always', + { + omitLastInOneLineBlock?: boolean; + }, + ...unknown[], + ] + ); +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot b/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot new file mode 100644 index 000000000000..7930323d4469 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot @@ -0,0 +1,71 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes sort-type-constituents 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "checkIntersections": { + "description": "Whether to check intersection types.", + "type": "boolean" + }, + "checkUnions": { + "description": "Whether to check union types.", + "type": "boolean" + }, + "groupOrder": { + "description": "Ordering of the groups.", + "type": "array", + "items": { + "type": "string", + "enum": [ + "conditional", + "function", + "import", + "intersection", + "keyword", + "nullish", + "literal", + "named", + "object", + "operator", + "tuple", + "union" + ] + } + } + } + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to check intersection types. */ + checkIntersections?: boolean; + /** Whether to check union types. */ + checkUnions?: boolean; + /** Ordering of the groups. */ + groupOrder?: ( + | 'conditional' + | 'function' + | 'import' + | 'intersection' + | 'keyword' + | 'nullish' + | 'literal' + | 'named' + | 'object' + | 'operator' + | 'tuple' + | 'union' + )[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot b/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot new file mode 100644 index 000000000000..2bbb220294db --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes space-before-blocks 1`] = ` +" +# SCHEMA: + +[ + { + "oneOf": [ + { "enum": ["always", "never"] }, + { + "type": "object", + "properties": { + "keywords": { "enum": ["always", "never", "off"] }, + "functions": { "enum": ["always", "never", "off"] }, + "classes": { "enum": ["always", "never", "off"] } + }, + "additionalProperties": false + } + ] + } +] + + +# TYPES: + +type Options = [ + | ('always' | 'never') + | { + keywords?: 'always' | 'never' | 'off'; + functions?: 'always' | 'never' | 'off'; + classes?: 'always' | 'never' | 'off'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot b/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot new file mode 100644 index 000000000000..ae290a78fff9 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes space-before-function-paren 1`] = ` +" +# SCHEMA: + +[ + { + "oneOf": [ + { "enum": ["always", "never"] }, + { + "type": "object", + "properties": { + "anonymous": { "enum": ["always", "never", "ignore"] }, + "named": { "enum": ["always", "never", "ignore"] }, + "asyncArrow": { "enum": ["always", "never", "ignore"] } + }, + "additionalProperties": false + } + ] + } +] + + +# TYPES: + +type Options = [ + | ('always' | 'never') + | { + anonymous?: 'always' | 'never' | 'ignore'; + named?: 'always' | 'never' | 'ignore'; + asyncArrow?: 'always' | 'never' | 'ignore'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-infix-ops.shot b/packages/eslint-plugin/tests/schema-snapshots/space-infix-ops.shot new file mode 100644 index 000000000000..e96e7675636a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/space-infix-ops.shot @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes space-infix-ops 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { "int32Hint": { "type": "boolean", "default": false } }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + int32Hint?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot new file mode 100644 index 000000000000..020ee99ac9c9 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes strict-boolean-expressions 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "allowString": { "type": "boolean" }, + "allowNumber": { "type": "boolean" }, + "allowNullableObject": { "type": "boolean" }, + "allowNullableBoolean": { "type": "boolean" }, + "allowNullableString": { "type": "boolean" }, + "allowNullableNumber": { "type": "boolean" }, + "allowNullableEnum": { "type": "boolean" }, + "allowAny": { "type": "boolean" }, + "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": { + "type": "boolean" + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + allowString?: boolean; + allowNumber?: boolean; + allowNullableObject?: boolean; + allowNullableBoolean?: boolean; + allowNullableString?: boolean; + allowNullableNumber?: boolean; + allowNullableEnum?: boolean; + allowAny?: boolean; + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/switch-exhaustiveness-check.shot b/packages/eslint-plugin/tests/schema-snapshots/switch-exhaustiveness-check.shot new file mode 100644 index 000000000000..b9d9916dc427 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/switch-exhaustiveness-check.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes switch-exhaustiveness-check 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot b/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot new file mode 100644 index 000000000000..318312764efe --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes triple-slash-reference 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "lib": { "enum": ["always", "never"] }, + "path": { "enum": ["always", "never"] }, + "types": { "enum": ["always", "never", "prefer-import"] } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + lib?: 'always' | 'never'; + path?: 'always' | 'never'; + types?: 'always' | 'never' | 'prefer-import'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot new file mode 100644 index 000000000000..0623badd3db2 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot @@ -0,0 +1,108 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes type-annotation-spacing 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" }, + "overrides": { + "type": "object", + "properties": { + "colon": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "arrow": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "variable": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "parameter": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "property": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + }, + "returnType": { + "type": "object", + "properties": { + "before": { "type": "boolean" }, + "after": { "type": "boolean" } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + before?: boolean; + after?: boolean; + overrides?: { + colon?: { + before?: boolean; + after?: boolean; + }; + arrow?: { + before?: boolean; + after?: boolean; + }; + variable?: { + before?: boolean; + after?: boolean; + }; + parameter?: { + before?: boolean; + after?: boolean; + }; + property?: { + before?: boolean; + after?: boolean; + }; + returnType?: { + before?: boolean; + after?: boolean; + }; + }; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/typedef.shot b/packages/eslint-plugin/tests/schema-snapshots/typedef.shot new file mode 100644 index 000000000000..12921f4a37a8 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/typedef.shot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes typedef 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "arrayDestructuring": { "type": "boolean" }, + "arrowParameter": { "type": "boolean" }, + "memberVariableDeclaration": { "type": "boolean" }, + "objectDestructuring": { "type": "boolean" }, + "parameter": { "type": "boolean" }, + "propertyDeclaration": { "type": "boolean" }, + "variableDeclaration": { "type": "boolean" }, + "variableDeclarationIgnoreFunction": { "type": "boolean" } + } + } +] + + +# TYPES: + +type Options = [ + { + arrayDestructuring?: boolean; + arrowParameter?: boolean; + memberVariableDeclaration?: boolean; + objectDestructuring?: boolean; + parameter?: boolean; + propertyDeclaration?: boolean; + variableDeclaration?: boolean; + variableDeclarationIgnoreFunction?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/unbound-method.shot b/packages/eslint-plugin/tests/schema-snapshots/unbound-method.shot new file mode 100644 index 000000000000..e1c46e3f5237 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/unbound-method.shot @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes unbound-method 1`] = ` +" +# SCHEMA: + +[ + { + "type": "object", + "properties": { + "ignoreStatic": { + "description": "Whether to skip checking whether \`static\` methods are correctly bound.", + "type": "boolean" + } + }, + "additionalProperties": false + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to skip checking whether \`static\` methods are correctly bound. */ + ignoreStatic?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/unified-signatures.shot b/packages/eslint-plugin/tests/schema-snapshots/unified-signatures.shot new file mode 100644 index 000000000000..39b61b6dde7d --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/unified-signatures.shot @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes unified-signatures 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "ignoreDifferentlyNamedParameters": { + "description": "Whether two parameters with different names at the same index should be considered different even if their types are the same.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether two parameters with different names at the same index should be considered different even if their types are the same. */ + ignoreDifferentlyNamedParameters?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schemas.test.ts b/packages/eslint-plugin/tests/schemas.test.ts new file mode 100644 index 000000000000..9b00f0575989 --- /dev/null +++ b/packages/eslint-plugin/tests/schemas.test.ts @@ -0,0 +1,130 @@ +import 'jest-specific-snapshot'; + +import { compile } from '@typescript-eslint/rule-schema-to-typescript-types'; +import fs, { mkdirSync } from 'fs'; +import path from 'path'; +import { format, resolveConfig } from 'prettier'; + +import rules from '../src/rules/index'; + +const snapshotFolder = path.resolve(__dirname, 'schema-snapshots'); +try { + mkdirSync(snapshotFolder); +} catch { + // ignore failure as it means it already exists probably +} + +const prettierConfigJson = { + ...(resolveConfig.sync(__filename) ?? {}), + filepath: path.join(__dirname, 'schema.json'), +}; + +const SKIPPED_RULES_FOR_TYPE_GENERATION = new Set(['indent']); +// Set this to a rule name to only run that rule +const ONLY = ''; + +describe('Rule schemas should be convertible to TS types for documentation purposes', () => { + for (const [ruleName, ruleDef] of Object.entries(rules)) { + if (SKIPPED_RULES_FOR_TYPE_GENERATION.has(ruleName)) { + // eslint-disable-next-line jest/no-disabled-tests -- intentional skip for documentation purposes + it.skip(ruleName, () => {}); + continue; + } + + (ruleName === ONLY ? it.only : it)(ruleName, () => { + const schemaString = format( + JSON.stringify(ruleDef.meta.schema), + prettierConfigJson, + ); + const compilationResult = compile(ruleDef.meta.schema); + + expect( + [ + '', + '# SCHEMA:', + '', + schemaString, + '', + '# TYPES:', + '', + compilationResult, + ].join('\n'), + ).toMatchSpecificSnapshot(path.join(snapshotFolder, `${ruleName}.shot`)); + }); + } +}); + +test('There should be no old snapshots for rules that have been deleted', () => { + const files = fs.readdirSync(snapshotFolder); + const names = new Set( + Object.keys(rules) + .filter(k => !SKIPPED_RULES_FOR_TYPE_GENERATION.has(k)) + .map(k => `${k}.shot`), + ); + + for (const file of files) { + expect(names).toContain(file); + } +}); + +const VALID_SCHEMA_PROPS = new Set([ + '$defs', + '$ref', + '$schema', + 'additionalItems', + 'additionalProperties', + 'allOf', + 'anyOf', + 'default', + 'definitions', + 'dependencies', + 'description', + 'enum', + 'exclusiveMaximum', + 'exclusiveMinimum', + 'extends', + 'format', + 'id', + 'items', + 'maximum', + 'maxItems', + 'maxLength', + 'maxProperties', + 'minimum', + 'minItems', + 'minLength', + 'minProperties', + 'multipleOf', + 'not', + 'oneOf', + 'pattern', + 'patternProperties', + 'properties', + 'required', + 'title', + 'type', + 'uniqueItems', +]); +describe('Rules should only define valid keys on schemas', () => { + for (const [ruleName, ruleDef] of Object.entries(rules)) { + (ruleName === ONLY ? it.only : it)(ruleName, () => { + JSON.stringify(ruleDef.meta.schema, (key, value) => { + if (key === '') { + // the root object will have key "" + return value; + } + if (key === '$defs' || key === 'definitions' || key === 'properties') { + // definition keys and property keys should not be validated, only the values + return Object.values(value as object); + } + if (parseInt(key).toString() === key) { + // hack to detect arrays as JSON.stringify will traverse them and stringify the number + return value; + } + + expect(VALID_SCHEMA_PROPS).toContain(key); + return value; + }); + }); + } +}); diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index fa20841493ff..ae5a5e0f9887 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -8,6 +8,7 @@ "references": [ { "path": "../utils/tsconfig.build.json" }, { "path": "../parser/tsconfig.build.json" }, + { "path": "../rule-schema-to-typescript-types/tsconfig.build.json" }, { "path": "../scope-manager/tsconfig.build.json" }, { "path": "../type-utils/tsconfig.build.json" } ] diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index 26fee2659a47..99942dde0b7f 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -1,8 +1,9 @@ { "name": "@typescript-eslint/repo-tools", - "version": "5.52.0", + "version": "5.58.0", "private": true, "scripts": { + "build": "tsc -b tsconfig.build.json", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "generate-contributors": "tsx ./src/generate-contributors.ts", "generate-sponsors": "tsx ./src/generate-sponsors.ts", diff --git a/packages/repo-tools/tsconfig.build.json b/packages/repo-tools/tsconfig.build.json index 2f504b292b08..b9ac3e1b9770 100644 --- a/packages/repo-tools/tsconfig.build.json +++ b/packages/repo-tools/tsconfig.build.json @@ -1,13 +1,11 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - // specifically disable declarations for the plugin - "declaration": false, - "declarationMap": false, + "composite": true, "outDir": "./dist", "rootDir": "./src", "resolveJsonModule": true }, - "include": ["src", "tests", "typings"], + "include": ["src", "typings"], "references": [] } diff --git a/packages/repo-tools/tsconfig.json b/packages/repo-tools/tsconfig.json index 736e7fb6dc1a..06b94d057faf 100644 --- a/packages/repo-tools/tsconfig.json +++ b/packages/repo-tools/tsconfig.json @@ -4,6 +4,6 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings"], + "include": ["src", "tests", "typings"], "references": [] } diff --git a/packages/rule-schema-to-typescript-types/README.md b/packages/rule-schema-to-typescript-types/README.md new file mode 100644 index 000000000000..25f004c77a17 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/README.md @@ -0,0 +1,9 @@ +# `@typescript-eslint/rule-schema-to-typescript-types` + +> Tool for generating TypeScript type definitions from a rule's options schema + +## ✋ Internal Package + +This is an _internal package_ to the [typescript-eslint monorepo](https://github.com/typescript-eslint/typescript-eslint). + +👉 See **https://typescript-eslint.io** for docs on typescript-eslint. diff --git a/packages/rule-schema-to-typescript-types/jest.config.js b/packages/rule-schema-to-typescript-types/jest.config.js new file mode 100644 index 000000000000..209d055cc65e --- /dev/null +++ b/packages/rule-schema-to-typescript-types/jest.config.js @@ -0,0 +1,8 @@ +'use strict'; + +// @ts-check +/** @type {import('@jest/types').Config.InitialOptions} */ +module.exports = { + ...require('../../jest.config.base.js'), + passWithNoTests: true, +}; diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json new file mode 100644 index 000000000000..9c158f1fa815 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/package.json @@ -0,0 +1,44 @@ +{ + "name": "@typescript-eslint/rule-schema-to-typescript-types", + "version": "5.58.0", + "private": true, + "type": "commonjs", + "exports": { + ".": { + "types": "./index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "engines": { + "node": "^14.18.0 || ^16.0.0 || >=18.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/typescript-eslint/typescript-eslint.git", + "directory": "packages/rule-schema-to-typescript-types" + }, + "bugs": { + "url": "https://github.com/typescript-eslint/typescript-eslint/issues" + }, + "license": "MIT", + "scripts": { + "build": "tsc -b tsconfig.build.json", + "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", + "generate-contributors": "tsx ./src/generate-contributors.ts", + "generate-sponsors": "tsx ./src/generate-sponsors.ts", + "lint": "nx lint", + "postinstall-script": "tsx ./src/postinstall.ts", + "test": "jest --coverage", + "typecheck": "tsc -p tsconfig.json --noEmit" + }, + "dependencies": { + "@types/prettier": "*", + "@typescript-eslint/type-utils": "5.58.0", + "prettier": "*" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } +} diff --git a/packages/rule-schema-to-typescript-types/project.json b/packages/rule-schema-to-typescript-types/project.json new file mode 100644 index 000000000000..e0566604c1d0 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/project.json @@ -0,0 +1,18 @@ +{ + "name": "rule-schema-to-typescript-types", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "type": "library", + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": [ + "packages/rule-schema-to-typescript-types/**/*.{mts,cts,ts,tsx}" + ], + "ignorePath": ".eslintignore" + } + } + } +} diff --git a/packages/rule-schema-to-typescript-types/src/index.ts b/packages/rule-schema-to-typescript-types/src/index.ts new file mode 100644 index 000000000000..84d719a59937 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/index.ts @@ -0,0 +1,470 @@ +import { requiresQuoting } from '@typescript-eslint/type-utils'; +import type { JSONSchema4, JSONSchema4Type } from 'json-schema'; +import path from 'path'; +import { format as prettierFormat, resolveConfig } from 'prettier'; + +type RefMap = ReadonlyMap< + // ref path + string, + // type name + string +>; +interface GeneratedResult { + code: string; + commentLines?: string[]; +} + +class NotSupportedError extends Error { + constructor(thing: string, target: unknown) { + super( + `Generating a type for ${thing} is not currently supported:\n${JSON.stringify( + target, + null, + 2, + )}`, + ); + } +} +class UnexpectedError extends Error { + constructor(error: string, target: unknown) { + super(`Unexpected Error: ${error}:\n${JSON.stringify(target, null, 2)}`); + } +} + +const prettierConfig = { + ...(resolveConfig.sync(__filename) ?? {}), + filepath: path.join(__dirname, 'schema.ts'), +}; + +/** + * If there are more than 20 tuple items then we will not make it a tuple type + * and instead will just make it an array type for brevity + */ +const MAX_ITEMS_TO_TUPLIZE = 20; + +export function compile(schemaIn: JSONSchema4 | JSONSchema4[]): string { + const { schema, isArraySchema } = (() => { + if (Array.isArray(schemaIn)) { + return { + schema: schemaIn, + isArraySchema: true, + }; + } + return { + schema: [schemaIn], + isArraySchema: false, + }; + })(); + + if (schema.length === 0) { + return ['/** No options declared */', 'type Options = [];'].join('\n'); + } + + const refTypes: string[] = []; + const types: GeneratedResult[] = []; + for (let i = 0; i < schema.length; i += 1) { + const result = compileSchema(schema[i], i); + refTypes.push(...result.refTypes); + types.push(result.type); + } + const typeStrings = types.map(t => `${printComment(t)}${t.code}`); + + const optionsType = isArraySchema + ? `type Options = [${typeStrings.join(',')}]` + : `type Options = ${typeStrings[0]}`; + return prettierFormat( + [...refTypes, optionsType].join('\n\n'), + prettierConfig, + ); +} +function compileSchema( + schema: JSONSchema4, + index: number, +): { type: GeneratedResult; refTypes: string[] } { + const refTypes: string[] = []; + + const refMap = new Map(); + // we only support defs at the top level for simplicity + const defs = (schema.$defs ?? schema.definitions) as + | Record + | undefined; + if (defs) { + for (const [defKey, defSchema] of Object.entries(defs)) { + const typeName = toPascalCase(defKey); + refMap.set(`#/$defs/${defKey}`, typeName); + refMap.set(`#/items/${index}/$defs/${defKey}`, typeName); + + const type = generateType(defSchema, refMap); + refTypes.push(`${printComment(type)}type ${typeName} = ${type.code}`); + } + } + + return { + type: generateType(schema, refMap), + refTypes, + }; +} + +function toPascalCase(key: string): string { + return key[0].toUpperCase() + key.substring(1); +} + +// keywords we probably should support but currently do not support +const UNSUPPORTED_KEYWORDS = new Set([ + 'allOf', + 'dependencies', + 'extends', + 'maxProperties', + 'minProperties', + 'multipleOf', + 'not', + 'patternProperties', +]); + +function generateType(schema: JSONSchema4, refMap: RefMap): GeneratedResult { + const unsupportedProps = Object.keys(schema).filter(key => + UNSUPPORTED_KEYWORDS.has(key), + ); + if (unsupportedProps.length > 0) { + throw new NotSupportedError(unsupportedProps.join(','), schema); + } + + const commentLines = getCommentLines(schema); + + if (schema.$ref) { + const refName = refMap.get(schema.$ref); + if (refName == null) { + throw new UnexpectedError( + `Could not find definition for $ref ${schema.$ref}`, + schema, + ); + } + return { + code: refName, + commentLines, + }; + } + if (schema.enum) { + return { + code: generateUnionType(schema.enum, refMap), + commentLines, + }; + } + if (schema.anyOf) { + return { + // a union isn't *TECHNICALLY* correct - technically anyOf is actually + // anyOf: [T, U, V] -> T | U | V | T & U | T & V | U & V + // in practice though it is most used to emulate a oneOf + code: generateUnionType(schema.anyOf, refMap), + commentLines, + }; + } + if (schema.oneOf) { + return { + code: generateUnionType(schema.oneOf, refMap), + commentLines, + }; + } + + if (Array.isArray(schema.type)) { + throw new NotSupportedError('schemas with multiple types', schema); + } + if (schema.type == null) { + throw new NotSupportedError( + 'untyped schemas without one of [$ref, enum, oneOf]', + schema, + ); + } + + switch (schema.type) { + case 'any': + return { + code: 'unknown', + commentLines, + }; + + case 'null': + return { + code: 'null', + commentLines, + }; + + case 'number': + case 'string': + return { + code: schema.type, + commentLines, + }; + + case 'array': + return generateArrayType(schema, refMap); + + case 'boolean': + return { + code: 'boolean', + commentLines, + }; + + case 'integer': + return { + code: 'number', + commentLines, + }; + + case 'object': + return generateObjectType(schema, refMap); + } +} + +function printUnionType(members: (string | GeneratedResult)[]): string { + return members + .map(m => { + if (typeof m === 'string') { + return `| ${m}`; + } + return `${printComment(m)} | (${m.code})`; + }) + .join('\n'); +} +function generateUnionType(members: JSONSchema4Type[], refMap: RefMap): string { + const memberStrings: GeneratedResult[] = []; + + for (const memberSchema of members) { + memberStrings.push( + ((): GeneratedResult => { + switch (typeof memberSchema) { + case 'string': + return { + code: `'${memberSchema.replace(/'/g, "\\'")}'`, + }; + + case 'number': + case 'boolean': + return { + code: `${memberSchema}`, + }; + + case 'object': + if (memberSchema == null) { + throw new NotSupportedError('null in an enum', memberSchema); + } + if (Array.isArray(memberSchema)) { + throw new NotSupportedError('array in an enum', memberSchema); + } + return generateType(memberSchema, refMap); + } + })(), + ); + } + + return printUnionType(memberStrings); +} + +function generateArrayType( + schema: JSONSchema4, + refMap: RefMap, +): GeneratedResult { + if (!schema.items) { + // it's technically valid to declare things like {type: 'array'} -> any[] + // but that's obviously dumb and loose so let's not even bother with it + throw new UnexpectedError('Unexpected missing items', schema); + } + if (schema.items && !Array.isArray(schema.items) && schema.additionalItems) { + throw new NotSupportedError( + 'singlely-typed array with additionalItems', + schema, + ); + } + + const commentLines = getCommentLines(schema); + + const minItems = schema.minItems ?? 0; + const maxItems = + schema.maxItems != null && schema.maxItems < MAX_ITEMS_TO_TUPLIZE + ? schema.maxItems + : -1; + const hasMinItems = minItems > 0; + const hasMaxItems = maxItems >= 0; + + let items: JSONSchema4[]; + let spreadItemSchema: JSONSchema4 | null = null; + + if (!Array.isArray(schema.items)) { + if (hasMinItems || hasMaxItems) { + // treat as a tuple + items = Array( + (hasMaxItems && maxItems) || minItems || 0, + ).fill(schema.items); + if (!hasMaxItems) { + spreadItemSchema = + typeof schema.additionalItems === 'object' + ? schema.additionalItems + : schema.items; + } + } else { + // treat as an array type + return { + code: `(${generateType(schema.items, refMap).code})[]`, + commentLines, + }; + } + } else { + // treat as a tuple + items = schema.items; + if (hasMaxItems) { + spreadItemSchema = + typeof schema.additionalItems === 'object' + ? schema.additionalItems + : { type: 'any' }; + } + } + + // quick validation so we generate sensible types + if (hasMaxItems && maxItems < items.length) { + throw new UnexpectedError( + `maxItems (${maxItems}) is smaller than the number of items schemas provided (${items.length})`, + schema, + ); + } + if (maxItems > items.length && spreadItemSchema == null) { + throw new UnexpectedError( + 'maxItems is larger than the number of items schemas, but there was not an additionalItems schema provided', + schema, + ); + } + + const itemTypes = items.map(i => generateType(i, refMap)); + const spreadItem = (() => { + if (spreadItemSchema == null) { + return null; + } + const type = generateType(spreadItemSchema, refMap); + return `${printComment(type)}...(${type.code})[]`; + })(); + + const typesToString = (types: (string | GeneratedResult)[]): string => { + return `[\n${types + .map(t => { + if (typeof t === 'string') { + return t; + } + return `${printComment(t)}${t.code}`; + }) + .join(',\n')}\n]`; + }; + const addSpreadParam = ( + params: (string | GeneratedResult)[], + ): (string | GeneratedResult)[] => { + if (spreadItem) { + params.push(spreadItem); + } + return params; + }; + + if (itemTypes.length > minItems) { + /* + if there are more items than the min, we return a union of tuples instead of + using the optional element operator. This is done because it is more type-safe. + + // optional element operator + type A = [string, string?, string?] + const a: A = ['a', undefined, 'c'] // no error + + // union of tuples + type B = [string] | [string, string] | [string, string, string] + const b: B = ['a', undefined, 'c'] // TS error + */ + const cumulativeTypesList: (string | GeneratedResult)[] = itemTypes.slice( + 0, + minItems, + ); + const typesToUnion: string[] = []; + if (cumulativeTypesList.length > 0) { + // actually has minItems, so add the initial state + typesToUnion.push(typesToString(cumulativeTypesList)); + } else { + // no minItems means it's acceptable to have an empty tuple type + typesToUnion.push(typesToString([])); + } + + for (let i = minItems; i < itemTypes.length; i += 1) { + cumulativeTypesList.push(itemTypes[i]); + + if (i === itemTypes.length - 1) { + // only the last item in the union should have the spread parameter + addSpreadParam(cumulativeTypesList); + } + + typesToUnion.push(typesToString(cumulativeTypesList)); + } + + return { + code: printUnionType(typesToUnion), + commentLines, + }; + } + + return { + code: typesToString(addSpreadParam(itemTypes)), + commentLines, + }; +} + +function generateObjectType( + schema: JSONSchema4, + refMap: RefMap, +): GeneratedResult { + const commentLines = getCommentLines(schema); + + let indexSignature = ''; + if (schema.additionalProperties === true) { + indexSignature = '[k: string]: unknown'; + } else if (schema.additionalProperties) { + const indexSigType = generateType(schema.additionalProperties, refMap); + indexSignature = `${printComment(indexSigType)}[k: string]: ${ + indexSigType.code + }`; + } + + const properties: string[] = []; + const required = new Set( + Array.isArray(schema.required) ? schema.required : [], + ); + if (schema.properties) { + for (const [propName, propSchema] of Object.entries(schema.properties)) { + const propType = generateType(propSchema, refMap); + const sanitisedPropName = requiresQuoting(propName) + ? `'${propName}'` + : propName; + properties.push( + `${printComment(propType)}${sanitisedPropName}${ + required.has(propName) ? '' : '?' + }: ${propType.code}`, + ); + } + } + + return { + code: ['{', properties.join(';\n'), indexSignature, '}'].join('\n'), + commentLines, + }; +} + +function getCommentLines(schema: JSONSchema4): string[] { + const lines: string[] = []; + if (schema.description) { + lines.push(schema.description); + } + return lines; +} +function printComment({ commentLines }: GeneratedResult): string { + if (commentLines == null || commentLines.length === 0) { + return ''; + } + + if (commentLines.length === 1) { + return `/** ${commentLines[0]} */\n`; + } + + return ['/**', ...commentLines.map(l => ` * ${l}`), ' */', ''].join('\n'); +} diff --git a/packages/rule-schema-to-typescript-types/tsconfig.build.json b/packages/rule-schema-to-typescript-types/tsconfig.build.json new file mode 100644 index 000000000000..b9ac3e1b9770 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist", + "rootDir": "./src", + "resolveJsonModule": true + }, + "include": ["src", "typings"], + "references": [] +} diff --git a/packages/rule-schema-to-typescript-types/tsconfig.json b/packages/rule-schema-to-typescript-types/tsconfig.json new file mode 100644 index 000000000000..06b94d057faf --- /dev/null +++ b/packages/rule-schema-to-typescript-types/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "composite": false, + "rootDir": "." + }, + "include": ["src", "tests", "typings"], + "references": [] +} diff --git a/packages/type-utils/src/TypeOrValueSpecifier.ts b/packages/type-utils/src/TypeOrValueSpecifier.ts index a926af02735e..26ed14bd3c63 100644 --- a/packages/type-utils/src/TypeOrValueSpecifier.ts +++ b/packages/type-utils/src/TypeOrValueSpecifier.ts @@ -1,3 +1,4 @@ +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import path from 'path'; import type * as ts from 'typescript'; @@ -24,7 +25,7 @@ export type TypeOrValueSpecifier = | LibSpecifier | PackageSpecifier; -export const typeOrValueSpecifierSchema = { +export const typeOrValueSpecifierSchema: JSONSchema4 = { oneOf: [ { type: 'string', @@ -35,7 +36,7 @@ export const typeOrValueSpecifierSchema = { properties: { from: { type: 'string', - const: 'file', + enum: ['file'], }, name: { oneOf: [ @@ -64,7 +65,7 @@ export const typeOrValueSpecifierSchema = { properties: { from: { type: 'string', - const: 'lib', + enum: ['lib'], }, name: { oneOf: [ @@ -90,7 +91,7 @@ export const typeOrValueSpecifierSchema = { properties: { from: { type: 'string', - const: 'package', + enum: ['package'], }, name: { oneOf: [ diff --git a/packages/type-utils/src/isTypeReadonly.ts b/packages/type-utils/src/isTypeReadonly.ts index 494548d91cff..63a02ea4464e 100644 --- a/packages/type-utils/src/isTypeReadonly.ts +++ b/packages/type-utils/src/isTypeReadonly.ts @@ -1,4 +1,5 @@ import { ESLintUtils } from '@typescript-eslint/utils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; @@ -36,7 +37,7 @@ export const readonlynessOptionsSchema = { items: typeOrValueSpecifierSchema, }, }, -}; +} satisfies JSONSchema4; export const readonlynessOptionsDefaults: ReadonlynessOptions = { treatMethodsAsReadonly: false, diff --git a/packages/website/package.json b/packages/website/package.json index 5f789e3caa5c..c2a3b37cc75e 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -29,7 +29,6 @@ "clsx": "^1.1.1", "eslint": "*", "json-schema": "^0.4.0", - "json-schema-to-typescript": "^11.0.1", "json5": "^2.2.1", "konamimojisplosion": "^0.5.1", "lz-string": "^1.5.0", @@ -53,6 +52,7 @@ "@types/react-helmet": "^6.1.5", "@types/react-router-dom": "^5.3.3", "@typescript-eslint/eslint-plugin": "5.58.0", + "@typescript-eslint/rule-schema-to-typescript-types": "5.58.0", "@typescript-eslint/types": "5.58.0", "copy-webpack-plugin": "^11.0.0", "cross-fetch": "*", diff --git a/packages/website/plugins/generated-rule-docs.ts b/packages/website/plugins/generated-rule-docs.ts index 962f0141476f..51eccfafefa0 100644 --- a/packages/website/plugins/generated-rule-docs.ts +++ b/packages/website/plugins/generated-rule-docs.ts @@ -1,14 +1,11 @@ import pluginRules from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; -import * as tseslintParser from '@typescript-eslint/parser'; +import { compile } from '@typescript-eslint/rule-schema-to-typescript-types'; import * as fs from 'fs'; -import type { JSONSchema7 } from 'json-schema'; -import type { JSONSchema } from 'json-schema-to-typescript'; -import { compile } from 'json-schema-to-typescript'; import * as lz from 'lz-string'; import type * as mdast from 'mdast'; import { EOL } from 'os'; import * as path from 'path'; -import { format } from 'prettier'; +import { format, resolveConfig } from 'prettier'; import type { Plugin } from 'unified'; import type * as unist from 'unist'; @@ -22,6 +19,19 @@ const COMPLICATED_RULE_OPTIONS = new Set([ 'member-ordering', 'naming-convention', ]); +/** + * Rules that do funky things with their defaults and require special code + * rather than just JSON.stringify-ing their defaults blob + */ +const SPECIAL_CASE_DEFAULTS = new Map([ + // + ['ban-types', '[{ /* See below for default options */ }]'], +]); + +const prettierConfig = { + ...(resolveConfig.sync(__filename) ?? {}), + filepath: path.join(__dirname, 'defaults.ts'), +}; const sourceUrlPrefix = 'https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/'; @@ -35,7 +45,7 @@ function nodeIsParent(node: unist.Node): node is unist.Parent { } export const generatedRuleDocs: Plugin = () => { - return async (root, file) => { + return (root, file) => { if (!nodeIsParent(root) || file.stem == null) { return; } @@ -254,21 +264,9 @@ export const generatedRuleDocs: Plugin = () => { type: 'paragraph', } as mdast.Paragraph); } else if (!COMPLICATED_RULE_OPTIONS.has(file.stem)) { - const optionsSchema: JSONSchema = - meta.schema instanceof Array - ? meta.schema[0] - : meta.schema.type === 'array' - ? { - ...(meta.schema.definitions - ? { definitions: meta.schema.definitions } - : {}), - ...(meta.schema.$defs - ? { $defs: (meta.schema as JSONSchema7).$defs } - : {}), - ...(meta.schema.prefixItems as [JSONSchema])[0], - } - : meta.schema; - + const defaults = + SPECIAL_CASE_DEFAULTS.get(file.stem) ?? + JSON.stringify(rule.defaultOptions); children.splice( optionsH2Index + 1, 0, @@ -276,11 +274,7 @@ export const generatedRuleDocs: Plugin = () => { children: [ { type: 'text', - value: `This rule accepts an options ${ - 'enum' in optionsSchema - ? 'string of the following possible values' - : 'object with the following properties' - }:`, + value: 'This rule accepts the following options', } as mdast.Text, ], type: 'paragraph', @@ -289,27 +283,10 @@ export const generatedRuleDocs: Plugin = () => { lang: 'ts', type: 'code', value: [ - ( - await compile( - { - title: `Options`, - ...optionsSchema, - }, - file.stem, - { - additionalProperties: false, - bannerComment: '', - declareExternallyReferenced: true, - }, - ) - ).replace(/^export /gm, ''), + compile(rule.meta.schema), format( - `const defaultOptions: Options = ${JSON.stringify( - rule.defaultOptions, - )};`, - { - parser: tseslintParser.parse, - }, + `const defaultOptions: Options = ${defaults};`, + prettierConfig, ), ] .join(EOL) diff --git a/yarn.lock b/yarn.lock index f5abd8194ce7..0d776941ef73 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1219,16 +1219,6 @@ "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" -"@bcherny/json-schema-ref-parser@10.0.5-fork": - version "10.0.5-fork" - resolved "https://registry.yarnpkg.com/@bcherny/json-schema-ref-parser/-/json-schema-ref-parser-10.0.5-fork.tgz#9b5e1e7e07964ea61840174098e634edbe8197bc" - integrity sha512-E/jKbPoca1tfUPj3iSbitDZTGnq6FUFjkH6L8U2oDwSuwK1WhnnVtCG7oFOTg/DDnyoXbQYUiUiGOibHqaGVnw== - dependencies: - "@jsdevtools/ono" "^7.1.3" - "@types/json-schema" "^7.0.6" - call-me-maybe "^1.0.1" - js-yaml "^4.1.0" - "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -2545,11 +2535,6 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" -"@jsdevtools/ono@^7.1.3": - version "7.1.3" - resolved "https://registry.yarnpkg.com/@jsdevtools/ono/-/ono-7.1.3.tgz#9df03bbd7c696a5c58885c34aa06da41c8543796" - integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== - "@leichtgewicht/ip-codec@^2.0.1": version "2.0.4" resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b" @@ -3758,14 +3743,6 @@ "@types/minimatch" "^5.1.2" "@types/node" "*" -"@types/glob@^7.1.3": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" - integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA== - dependencies: - "@types/minimatch" "*" - "@types/node" "*" - "@types/graceful-fs@^4.1.3": version "4.1.6" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.6.tgz#e14b2576a1c25026b7f02ede1de3b84c3a1efeae" @@ -3836,7 +3813,7 @@ expect "^29.0.0" pretty-format "^29.0.0" -"@types/json-schema@*", "@types/json-schema@^7.0.11", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": +"@types/json-schema@*", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.11" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== @@ -3868,16 +3845,16 @@ resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a" integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw== -"@types/minimatch@*", "@types/minimatch@^5.1.2": - version "5.1.2" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" - integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== - "@types/minimatch@^3.0.3": version "3.0.5" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== +"@types/minimatch@^5.1.2": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + "@types/minimist@^1.2.0": version "1.2.2" resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" @@ -3920,7 +3897,7 @@ resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-5.0.3.tgz#e7b5aebbac150f8b5fdd4a46e7f0bd8e65e19109" integrity sha512-kUNnecmtkunAoQ3CnjmMkzNU/gtxG8guhi+Fk2U/kOpIKjIMKnXGp4IJCgQJrXSgMsWYimYG4TGjz/UzbGEBTw== -"@types/prettier@*", "@types/prettier@^2.1.5", "@types/prettier@^2.6.0", "@types/prettier@^2.6.1": +"@types/prettier@*", "@types/prettier@^2.1.5", "@types/prettier@^2.6.0": version "2.7.2" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.2.tgz#6c2324641cc4ba050a8c710b2b251b377581fbf0" integrity sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg== @@ -4449,11 +4426,6 @@ ansi-styles@^6.0.0, ansi-styles@^6.1.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== -any-promise@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" - integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== - anymatch@^3.0.3, anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" @@ -5101,11 +5073,6 @@ call-bind@^1.0.0, call-bind@^1.0.2: function-bind "^1.1.1" get-intrinsic "^1.0.2" -call-me-maybe@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" - integrity sha512-wCyFsDQkKPwwF8BDwOiWNx/9K45L/hvggQiDbve+viMNMQnWhrlYIuBk09offfwCRtCO9P6XwUttufzU11WCVw== - callsites@^3.0.0, callsites@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -5320,17 +5287,6 @@ cli-boxes@^3.0.0: resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-3.0.0.tgz#71a10c716feeba005e4504f36329ef0b17cf3145" integrity sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g== -cli-color@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-2.0.3.tgz#73769ba969080629670f3f2ef69a4bf4e7cc1879" - integrity sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ== - dependencies: - d "^1.0.1" - es5-ext "^0.10.61" - es6-iterator "^2.0.3" - memoizee "^0.4.15" - timers-ext "^0.1.7" - cli-cursor@3.1.0, cli-cursor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" @@ -6179,14 +6135,6 @@ csstype@^3.0.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.9.tgz#6410af31b26bd0520933d02cbc64fce9ce3fbf0b" integrity sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw== -d@1, d@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" - integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== - dependencies: - es5-ext "^0.10.50" - type "^1.0.1" - damerau-levenshtein@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7" @@ -6759,42 +6707,6 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: - version "0.10.61" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.61.tgz#311de37949ef86b6b0dcea894d1ffedb909d3269" - integrity sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA== - dependencies: - es6-iterator "^2.0.3" - es6-symbol "^3.1.3" - next-tick "^1.1.0" - -es6-iterator@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-symbol@^3.1.1, es6-symbol@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" - integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== - dependencies: - d "^1.0.1" - ext "^1.1.2" - -es6-weak-map@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" - integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA== - dependencies: - d "1" - es5-ext "^0.10.46" - es6-iterator "^2.0.3" - es6-symbol "^3.1.1" - esbuild@~0.17.12, esbuild@~0.17.6: version "0.17.12" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.12.tgz#2ad7523bf1bc01881e9d904bc04e693bd3bdcf2f" @@ -7188,14 +7100,6 @@ eval@^0.1.8: "@types/node" "*" require-like ">= 0.1.1" -event-emitter@^0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" - integrity sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA== - dependencies: - d "1" - es5-ext "~0.10.14" - event-target-shim@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" @@ -7309,13 +7213,6 @@ express@^4.17.3: utils-merge "1.0.1" vary "~1.1.2" -ext@^1.1.2: - version "1.6.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.6.0.tgz#3871d50641e874cc172e2b53f919842d19db4c52" - integrity sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg== - dependencies: - type "^2.5.0" - extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" @@ -7913,13 +7810,6 @@ glob-parent@^6.0.1, glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" -glob-promise@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/glob-promise/-/glob-promise-4.2.2.tgz#15f44bcba0e14219cd93af36da6bb905ff007877" - integrity sha512-xcUzJ8NWN5bktoTIX7eOclO1Npxd/dyVqUJxlLIDasT4C7KZyqlPIwkdJ0Ypiy3p2ZKahTjK4M9uC3sNSfNMzw== - dependencies: - "@types/glob" "^7.1.3" - glob-to-regexp@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" @@ -8961,11 +8851,6 @@ is-plain-object@^5.0.0: resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== -is-promise@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" - integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== - is-regex@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -9641,26 +9526,6 @@ json-parse-even-better-errors@^3.0.0: resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.0.tgz#2cb2ee33069a78870a0c7e3da560026b89669cf7" integrity sha512-iZbGHafX/59r39gPwVPRBGw0QQKnA7tte5pSMrhWOW7swGsVvVTjmfyAV9pNqk8YGT7tRCdxRu8uzcgZwoDooA== -json-schema-to-typescript@^11.0.1: - version "11.0.5" - resolved "https://registry.yarnpkg.com/json-schema-to-typescript/-/json-schema-to-typescript-11.0.5.tgz#04020422b7970e1c3b2ee8b601548e8751e1cd03" - integrity sha512-ZNlvngzlPzjYYECbR+uJ9aUWo25Gw/VuwUytvcuKiwc6NaiZhMyf7qBsxZE2eixmj8AoQEQJhSRG7btln0sUDw== - dependencies: - "@bcherny/json-schema-ref-parser" "10.0.5-fork" - "@types/json-schema" "^7.0.11" - "@types/lodash" "^4.14.182" - "@types/prettier" "^2.6.1" - cli-color "^2.0.2" - get-stdin "^8.0.0" - glob "^7.1.6" - glob-promise "^4.2.2" - is-glob "^4.0.3" - lodash "^4.17.21" - minimist "^1.2.6" - mkdirp "^1.0.4" - mz "^2.7.0" - prettier "^2.6.2" - json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -10179,13 +10044,6 @@ lru-cache@^7.14.1, lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89" integrity sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA== -lru-queue@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" - integrity sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ== - dependencies: - es5-ext "~0.10.2" - lz-string@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941" @@ -10391,20 +10249,6 @@ memfs@^3.1.2, memfs@^3.4.1: dependencies: fs-monkey "1.0.3" -memoizee@^0.4.15: - version "0.4.15" - resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.15.tgz#e6f3d2da863f318d02225391829a6c5956555b72" - integrity sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ== - dependencies: - d "^1.0.1" - es5-ext "^0.10.53" - es6-weak-map "^2.0.3" - event-emitter "^0.3.5" - is-promise "^2.2.2" - lru-queue "^0.1.0" - next-tick "^1.1.0" - timers-ext "^0.1.7" - meow@^8.0.0: version "8.1.2" resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.2.tgz#bcbe45bda0ee1729d350c03cffc8395a36c4e897" @@ -10753,15 +10597,6 @@ mute-stream@0.0.8, mute-stream@~0.0.4: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -mz@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" - integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== - dependencies: - any-promise "^1.0.0" - object-assign "^4.0.1" - thenify-all "^1.0.0" - nanoid@^3.3.4: version "3.3.4" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" @@ -10792,11 +10627,6 @@ neo-async@^2.6.0, neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -next-tick@1, next-tick@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" - integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== - nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -11182,7 +11012,7 @@ nx@15.7.2, "nx@>=15.5.2 < 16": "@nrwl/nx-win32-arm64-msvc" "15.7.2" "@nrwl/nx-win32-x64-msvc" "15.7.2" -object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: +object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= @@ -12127,7 +11957,7 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= -prettier@*, prettier@^2.6.2, prettier@^2.8.4: +prettier@*, prettier@^2.8.4: version "2.8.4" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.4.tgz#34dd2595629bfbb79d344ac4a91ff948694463c3" integrity sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw== @@ -14081,20 +13911,6 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== -thenify-all@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" - integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== - dependencies: - thenify ">= 3.1.0 < 4" - -"thenify@>= 3.1.0 < 4": - version "3.3.1" - resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" - integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== - dependencies: - any-promise "^1.0.0" - through2@^2.0.0: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" @@ -14120,14 +13936,6 @@ thunky@^1.0.2: resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA== -timers-ext@^0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.7.tgz#6f57ad8578e07a3fb9f91d9387d65647555e25c6" - integrity sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ== - dependencies: - es5-ext "~0.10.46" - next-tick "1" - tiny-invariant@^1.0.2: version "1.2.0" resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.2.0.tgz#a1141f86b672a9148c72e978a19a73b9b94a15a9" @@ -14422,16 +14230,6 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -type@^1.0.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" - integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== - -type@^2.5.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/type/-/type-2.6.0.tgz#3ca6099af5981d36ca86b78442973694278a219f" - integrity sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ== - typed-array-length@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb" From deee1e97d58f34eda1ab46cdc41b2e73b3812a47 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 14 Apr 2023 09:21:34 +0930 Subject: [PATCH 02/16] simplify naming-convention schema --- packages/ast-spec/package.json | 1 + .../rules/naming-convention-utils/schema.ts | 78 +- .../tests/schema-snapshots/array-type.shot | 2 +- .../schema-snapshots/ban-ts-comment.shot | 8 +- .../tests/schema-snapshots/ban-types.shot | 16 +- .../tests/schema-snapshots/brace-style.shot | 2 +- .../tests/schema-snapshots/comma-dangle.shot | 14 +- .../tests/schema-snapshots/comma-spacing.shot | 2 +- .../consistent-generic-constructors.shot | 2 +- .../consistent-indexed-object-style.shot | 2 +- .../consistent-type-assertions.shot | 6 +- .../consistent-type-imports.shot | 4 +- .../tests/schema-snapshots/dot-notation.shot | 2 +- .../explicit-function-return-type.shot | 16 +- .../explicit-member-accessibility.shot | 4 +- .../schema-snapshots/func-call-spacing.shot | 4 +- .../tests/schema-snapshots/key-spacing.shot | 52 +- .../schema-snapshots/keyword-spacing.shot | 142 +- .../lines-around-comment.shot | 30 +- .../lines-between-class-members.shot | 2 +- .../member-delimiter-style.shot | 20 +- .../schema-snapshots/member-ordering.shot | 2938 +++++++-------- .../method-signature-style.shot | 2 +- .../schema-snapshots/naming-convention.shot | 3278 +++-------------- .../schema-snapshots/no-empty-function.shot | 16 +- .../schema-snapshots/no-extra-parens.shot | 16 +- .../no-floating-promises.shot | 4 +- .../no-invalid-void-type.shot | 2 +- .../schema-snapshots/no-magic-numbers.shot | 4 +- .../schema-snapshots/no-misused-promises.shot | 6 +- .../no-restricted-imports.shot | 26 +- .../tests/schema-snapshots/no-shadow.shot | 4 +- .../tests/schema-snapshots/no-type-alias.shot | 28 +- ...o-unnecessary-boolean-literal-compare.shot | 4 +- .../no-unused-expressions.shot | 2 +- .../schema-snapshots/no-unused-vars.shot | 8 +- .../no-use-before-define.shot | 8 +- .../padding-line-between-statements.shot | 106 +- .../parameter-properties.shot | 8 +- .../prefer-nullish-coalescing.shot | 4 +- .../prefer-readonly-parameter-types.shot | 8 +- .../tests/schema-snapshots/quotes.shot | 4 +- .../restrict-plus-operands.shot | 4 +- .../restrict-template-expressions.shot | 12 +- .../tests/schema-snapshots/return-await.shot | 2 +- .../tests/schema-snapshots/semi.shot | 12 +- .../sort-type-constituents.shot | 2 +- .../schema-snapshots/space-before-blocks.shot | 4 +- .../space-before-function-paren.shot | 6 +- .../strict-boolean-expressions.shot | 12 +- .../type-annotation-spacing.shot | 20 +- .../src/index.ts | 21 +- 52 files changed, 2477 insertions(+), 4503 deletions(-) diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index e5e4509d038b..ecf2150e9839 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -48,6 +48,7 @@ "@babel/parser": "*", "@babel/code-frame": "*", "@microsoft/api-extractor": "^7.34.4", + "@typescript-eslint/repo-tools": "5.58.0", "@types/babel__core": "*", "glob": "*", "jest-diff": "*", diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts index ff91d2e156d4..0d092ea871d1 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts @@ -14,35 +14,44 @@ import { UnderscoreOptions, } from './enums'; -const UNDERSCORE_SCHEMA: JSONSchema.JSONSchema4 = { - type: 'string', - enum: util.getEnumNames(UnderscoreOptions), -}; -const PREFIX_SUFFIX_SCHEMA: JSONSchema.JSONSchema4 = { - type: 'array', - items: { +const $DEFS: Record = { + // enums + underscoreOptions: { type: 'string', - minLength: 1, + enum: util.getEnumNames(UnderscoreOptions), }, - additionalItems: false, -}; -const MATCH_REGEX_SCHEMA: JSONSchema.JSONSchema4 = { - type: 'object', - properties: { - match: { type: 'boolean' }, - regex: { type: 'string' }, + predefinedFormats: { + type: 'string', + enum: util.getEnumNames(PredefinedFormats), }, - required: ['match', 'regex'], -}; -type JSONSchemaProperties = Record; -const FORMAT_OPTIONS_PROPERTIES: JSONSchemaProperties = { - format: { + typeModifiers: { + type: 'string', + enum: util.getEnumNames(TypeModifiers), + }, + + // repeated types + prefixSuffixConfig: { + type: 'array', + items: { + type: 'string', + minLength: 1, + }, + additionalItems: false, + }, + matchRegexConfig: { + type: 'object', + properties: { + match: { type: 'boolean' }, + regex: { type: 'string' }, + }, + required: ['match', 'regex'], + }, + formatOptionsConfig: { oneOf: [ { type: 'array', items: { - type: 'string', - enum: util.getEnumNames(PredefinedFormats), + $ref: '#/$defs/predefinedFormats', }, additionalItems: false, }, @@ -51,6 +60,22 @@ const FORMAT_OPTIONS_PROPERTIES: JSONSchemaProperties = { }, ], }, +}; + +const UNDERSCORE_SCHEMA: JSONSchema.JSONSchema4 = { + $ref: '#/$defs/underscoreOptions', +}; +const PREFIX_SUFFIX_SCHEMA: JSONSchema.JSONSchema4 = { + $ref: '#/$defs/prefixSuffixConfig', +}; +const MATCH_REGEX_SCHEMA: JSONSchema.JSONSchema4 = { + $ref: '#/$defs/matchRegexConfig', +}; +type JSONSchemaProperties = Record; +const FORMAT_OPTIONS_PROPERTIES: JSONSchemaProperties = { + format: { + $ref: '#/$defs/formatOptionsConfig', + }, custom: MATCH_REGEX_SCHEMA, leadingUnderscore: UNDERSCORE_SCHEMA, trailingUnderscore: UNDERSCORE_SCHEMA, @@ -94,8 +119,7 @@ function selectorSchema( selector.types = { type: 'array', items: { - type: 'string', - enum: util.getEnumNames(TypeModifiers), + $ref: '#/$defs/typeModifiers', }, additionalItems: false, }; @@ -104,6 +128,7 @@ function selectorSchema( return [ { type: 'object', + description: `Selector '${selectorString}'`, properties: { ...FORMAT_OPTIONS_PROPERTIES, ...selector, @@ -117,6 +142,7 @@ function selectorSchema( function selectorsSchema(): JSONSchema.JSONSchema4 { return { type: 'object', + description: 'Multiple selectors in one config', properties: { ...FORMAT_OPTIONS_PROPERTIES, ...{ @@ -151,8 +177,7 @@ function selectorsSchema(): JSONSchema.JSONSchema4 { types: { type: 'array', items: { - type: 'string', - enum: util.getEnumNames(TypeModifiers), + $ref: '#/$defs/typeModifiers', }, additionalItems: false, }, @@ -164,6 +189,7 @@ function selectorsSchema(): JSONSchema.JSONSchema4 { } const SCHEMA: JSONSchema.JSONSchema4 = { + $defs: $DEFS, type: 'array', items: { oneOf: [ diff --git a/packages/eslint-plugin/tests/schema-snapshots/array-type.shot b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot index 67477ffd9074..a401347dbe36 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/array-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot @@ -26,7 +26,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: -type ArrayOption = 'array' | 'generic' | 'array-simple'; +type ArrayOption = 'array-simple' | 'array' | 'generic'; type Options = [ { diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot index 0001d59850ca..773c20007ce5 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot @@ -34,19 +34,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type DirectiveConfigSchema = - | boolean | 'allow-with-description' | { descriptionFormat?: string; - }; + } + | boolean; type Options = [ { + minimumDescriptionLength?: number; + 'ts-check'?: DirectiveConfigSchema; 'ts-expect-error'?: DirectiveConfigSchema; 'ts-ignore'?: DirectiveConfigSchema; 'ts-nocheck'?: DirectiveConfigSchema; - 'ts-check'?: DirectiveConfigSchema; - minimumDescriptionLength?: number; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot index 73de7400fb6f..f91d829e3631 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot @@ -59,28 +59,28 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type BanConfig = - /** Bans the type with the default message */ - | null /** Un-bans the type (useful when paired with \`extendDefaults\`) */ | false /** Bans the type with the default message */ | true - /** Bans the type with a custom message */ - | string /** Bans a type */ | { - /** Custom error message */ - message?: string; /** Type to autofix replace with. */ fixWith?: string; - }; + /** Custom error message */ + message?: string; + } + /** Bans the type with the default message */ + | null + /** Bans the type with a custom message */ + | string; type Options = [ { + extendDefaults?: boolean; types?: { [k: string]: BanConfig; }; - extendDefaults?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot b/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot index f31093b13108..2bedea2433e0 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot @@ -19,7 +19,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = [ - '1tbs' | 'stroustrup' | 'allman', + '1tbs' | 'allman' | 'stroustrup', { allowSingleLine?: boolean; }, diff --git a/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot b/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot index dc66921aab1f..2a1d5ac03417 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot @@ -52,24 +52,24 @@ type Value = 'always-multiline' | 'always' | 'never' | 'only-multiline'; type ValueWithIgnore = | 'always-multiline' | 'always' + | 'ignore' | 'never' - | 'only-multiline' - | 'ignore'; + | 'only-multiline'; type Options = | [] | [ - | Value | { arrays?: ValueWithIgnore; - objects?: ValueWithIgnore; - imports?: ValueWithIgnore; + enums?: ValueWithIgnore; exports?: ValueWithIgnore; functions?: ValueWithIgnore; - enums?: ValueWithIgnore; generics?: ValueWithIgnore; + imports?: ValueWithIgnore; + objects?: ValueWithIgnore; tuples?: ValueWithIgnore; - }, + } + | Value, ]; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot index 88f8d825f50e..06e9745daaf1 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot @@ -20,8 +20,8 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - before?: boolean; after?: boolean; + before?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot index 2f5b28c241e3..4b15a352a583 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot @@ -9,6 +9,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: -type Options = ['type-annotation' | 'constructor']; +type Options = ['constructor' | 'type-annotation']; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot index 33a9fad4b1f8..9df574231d65 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot @@ -9,6 +9,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: -type Options = ['record' | 'index-signature']; +type Options = ['index-signature' | 'record']; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot index 65f37e6895a2..3bba565566a7 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot @@ -33,11 +33,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ | { - assertionStyle: 'never'; + assertionStyle: 'angle-bracket' | 'as'; + objectLiteralTypeAssertions?: 'allow-as-parameter' | 'allow' | 'never'; } | { - assertionStyle: 'as' | 'angle-bracket'; - objectLiteralTypeAssertions?: 'allow' | 'allow-as-parameter' | 'never'; + assertionStyle: 'never'; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot index 37b33c09b7b2..eecb93c7d315 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot @@ -21,9 +21,9 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - prefer?: 'type-imports' | 'no-type-imports'; disallowTypeAnnotations?: boolean; - fixStyle?: 'separate-type-imports' | 'inline-type-imports'; + fixStyle?: 'inline-type-imports' | 'separate-type-imports'; + prefer?: 'no-type-imports' | 'type-imports'; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot index fef2c18492c0..02bc24cea2bc 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot @@ -32,11 +32,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + allowIndexSignaturePropertyAccess?: boolean; allowKeywords?: boolean; allowPattern?: string; allowPrivateClassPropertyAccess?: boolean; allowProtectedClassPropertyAccess?: boolean; - allowIndexSignaturePropertyAccess?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot index 025e18a2b90e..9bb7806cf6e6 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot @@ -53,20 +53,20 @@ type Options = [ { /** Whether to allow arrow functions that start with the \`void\` keyword. */ allowConciseArrowFunctionExpressionsStartingWithVoid?: boolean; - /** Whether to ignore function expressions (functions which are not part of a declaration). */ - allowExpressions?: boolean; - /** Whether to ignore functions immediately returning another function expression. */ - allowHigherOrderFunctions?: boolean; - /** Whether to ignore type annotations on the variable of function expressions. */ - allowTypedFunctionExpressions?: boolean; /** Whether to ignore arrow functions immediately returning a \`as const\` value. */ allowDirectConstAssertionInArrowFunctions?: boolean; - /** Whether to ignore functions that don't have generic type parameters. */ - allowFunctionsWithoutTypeParameters?: boolean; /** An array of function/method names that will not have their arguments or return values checked. */ allowedNames?: string[]; + /** Whether to ignore function expressions (functions which are not part of a declaration). */ + allowExpressions?: boolean; + /** Whether to ignore functions that don't have generic type parameters. */ + allowFunctionsWithoutTypeParameters?: boolean; + /** Whether to ignore functions immediately returning another function expression. */ + allowHigherOrderFunctions?: boolean; /** Whether to ignore immediately invoked function expressions (IIFEs). */ allowIIFEs?: boolean; + /** Whether to ignore type annotations on the variable of function expressions. */ + allowTypedFunctionExpressions?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot index aab5824e3d01..c66c9e18b5fb 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot @@ -60,14 +60,14 @@ type AccessibilityLevel = type Options = [ { accessibility?: AccessibilityLevel; + ignoredMethodNames?: string[]; overrides?: { accessors?: AccessibilityLevel; constructors?: AccessibilityLevel; methods?: AccessibilityLevel; - properties?: AccessibilityLevel; parameterProperties?: AccessibilityLevel; + properties?: AccessibilityLevel; }; - ignoredMethodNames?: string[]; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot index bbdc29d02f8a..b121b71e7fad 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot @@ -32,7 +32,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = - | ([] | ['never', ...unknown[]]) | ( | [] | ['always'] @@ -43,6 +42,7 @@ type Options = }, ...unknown[], ] - ); + ) + | ([] | ['never', ...unknown[]]); " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot index a5d1a139a900..1637bc29cf7b 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot @@ -113,54 +113,54 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ | { + afterColon?: boolean; align?: | ('colon' | 'value') | { - mode?: 'strict' | 'minimum'; - on?: 'colon' | 'value'; - beforeColon?: boolean; afterColon?: boolean; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + on?: 'colon' | 'value'; }; - mode?: 'strict' | 'minimum'; beforeColon?: boolean; - afterColon?: boolean; + mode?: 'minimum' | 'strict'; } | { - singleLine?: { - mode?: 'strict' | 'minimum'; + align?: { + afterColon?: boolean; beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + on?: 'colon' | 'value'; + }; + multiLine?: { afterColon?: boolean; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; }; + singleLine?: { + afterColon?: boolean; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + }; + } + | { multiLine?: { + afterColon?: boolean; align?: | ('colon' | 'value') | { - mode?: 'strict' | 'minimum'; - on?: 'colon' | 'value'; - beforeColon?: boolean; afterColon?: boolean; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + on?: 'colon' | 'value'; }; - mode?: 'strict' | 'minimum'; beforeColon?: boolean; - afterColon?: boolean; + mode?: 'minimum' | 'strict'; }; - } - | { singleLine?: { - mode?: 'strict' | 'minimum'; - beforeColon?: boolean; afterColon?: boolean; - }; - multiLine?: { - mode?: 'strict' | 'minimum'; beforeColon?: boolean; - afterColon?: boolean; - }; - align?: { - mode?: 'strict' | 'minimum'; - on?: 'colon' | 'value'; - beforeColon?: boolean; - afterColon?: boolean; + mode?: 'minimum' | 'strict'; }; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot index a2db15c9cfef..72a32c0b2cc8 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot @@ -578,284 +578,284 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - before?: boolean; after?: boolean; + before?: boolean; overrides?: { abstract?: { - before?: boolean; after?: boolean; + before?: boolean; }; as?: { - before?: boolean; after?: boolean; + before?: boolean; }; async?: { - before?: boolean; after?: boolean; + before?: boolean; }; await?: { - before?: boolean; after?: boolean; + before?: boolean; }; boolean?: { - before?: boolean; after?: boolean; + before?: boolean; }; break?: { - before?: boolean; after?: boolean; + before?: boolean; }; byte?: { - before?: boolean; after?: boolean; + before?: boolean; }; case?: { - before?: boolean; after?: boolean; + before?: boolean; }; catch?: { - before?: boolean; after?: boolean; + before?: boolean; }; char?: { - before?: boolean; after?: boolean; + before?: boolean; }; class?: { - before?: boolean; after?: boolean; + before?: boolean; }; const?: { - before?: boolean; after?: boolean; + before?: boolean; }; continue?: { - before?: boolean; after?: boolean; + before?: boolean; }; debugger?: { - before?: boolean; after?: boolean; + before?: boolean; }; default?: { - before?: boolean; after?: boolean; + before?: boolean; }; delete?: { - before?: boolean; after?: boolean; + before?: boolean; }; do?: { - before?: boolean; after?: boolean; + before?: boolean; }; double?: { - before?: boolean; after?: boolean; + before?: boolean; }; else?: { - before?: boolean; after?: boolean; + before?: boolean; }; enum?: { - before?: boolean; after?: boolean; + before?: boolean; }; export?: { - before?: boolean; after?: boolean; + before?: boolean; }; extends?: { - before?: boolean; after?: boolean; + before?: boolean; }; false?: { - before?: boolean; after?: boolean; + before?: boolean; }; final?: { - before?: boolean; after?: boolean; + before?: boolean; }; finally?: { - before?: boolean; after?: boolean; + before?: boolean; }; float?: { - before?: boolean; after?: boolean; + before?: boolean; }; for?: { - before?: boolean; after?: boolean; + before?: boolean; }; from?: { - before?: boolean; after?: boolean; + before?: boolean; }; function?: { - before?: boolean; after?: boolean; + before?: boolean; }; get?: { - before?: boolean; after?: boolean; + before?: boolean; }; goto?: { - before?: boolean; after?: boolean; + before?: boolean; }; if?: { - before?: boolean; after?: boolean; + before?: boolean; }; implements?: { - before?: boolean; after?: boolean; + before?: boolean; }; import?: { - before?: boolean; after?: boolean; + before?: boolean; }; in?: { - before?: boolean; after?: boolean; + before?: boolean; }; instanceof?: { - before?: boolean; after?: boolean; + before?: boolean; }; int?: { - before?: boolean; after?: boolean; + before?: boolean; }; interface?: { - before?: boolean; after?: boolean; + before?: boolean; }; let?: { - before?: boolean; after?: boolean; + before?: boolean; }; long?: { - before?: boolean; after?: boolean; + before?: boolean; }; native?: { - before?: boolean; after?: boolean; + before?: boolean; }; new?: { - before?: boolean; after?: boolean; + before?: boolean; }; null?: { - before?: boolean; after?: boolean; + before?: boolean; }; of?: { - before?: boolean; after?: boolean; + before?: boolean; }; package?: { - before?: boolean; after?: boolean; + before?: boolean; }; private?: { - before?: boolean; after?: boolean; + before?: boolean; }; protected?: { - before?: boolean; after?: boolean; + before?: boolean; }; public?: { - before?: boolean; after?: boolean; + before?: boolean; }; return?: { - before?: boolean; after?: boolean; + before?: boolean; }; set?: { - before?: boolean; after?: boolean; + before?: boolean; }; short?: { - before?: boolean; after?: boolean; + before?: boolean; }; static?: { - before?: boolean; after?: boolean; + before?: boolean; }; super?: { - before?: boolean; after?: boolean; + before?: boolean; }; switch?: { - before?: boolean; after?: boolean; + before?: boolean; }; synchronized?: { - before?: boolean; after?: boolean; + before?: boolean; }; this?: { - before?: boolean; after?: boolean; + before?: boolean; }; throw?: { - before?: boolean; after?: boolean; + before?: boolean; }; throws?: { - before?: boolean; after?: boolean; + before?: boolean; }; transient?: { - before?: boolean; after?: boolean; + before?: boolean; }; true?: { - before?: boolean; after?: boolean; + before?: boolean; }; try?: { + after?: boolean; before?: boolean; + }; + type?: { after?: boolean; + before?: boolean; }; typeof?: { - before?: boolean; after?: boolean; + before?: boolean; }; var?: { - before?: boolean; after?: boolean; + before?: boolean; }; void?: { - before?: boolean; after?: boolean; + before?: boolean; }; volatile?: { - before?: boolean; after?: boolean; + before?: boolean; }; while?: { - before?: boolean; after?: boolean; + before?: boolean; }; with?: { - before?: boolean; after?: boolean; + before?: boolean; }; yield?: { - before?: boolean; after?: boolean; - }; - type?: { before?: boolean; - after?: boolean; }; }; }, diff --git a/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot index 7545c75a486a..66fd3a4ae4eb 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot @@ -47,28 +47,28 @@ type Options = [ | [] | [ { - beforeBlockComment?: boolean; afterBlockComment?: boolean; - beforeLineComment?: boolean; afterLineComment?: boolean; - allowBlockStart?: boolean; + allowArrayEnd?: boolean; + allowArrayStart?: boolean; allowBlockEnd?: boolean; - allowClassStart?: boolean; + allowBlockStart?: boolean; allowClassEnd?: boolean; - allowObjectStart?: boolean; - allowObjectEnd?: boolean; - allowArrayStart?: boolean; - allowArrayEnd?: boolean; - allowInterfaceStart?: boolean; - allowInterfaceEnd?: boolean; - allowTypeStart?: boolean; - allowTypeEnd?: boolean; - allowEnumStart?: boolean; + allowClassStart?: boolean; allowEnumEnd?: boolean; - allowModuleStart?: boolean; + allowEnumStart?: boolean; + allowInterfaceEnd?: boolean; + allowInterfaceStart?: boolean; allowModuleEnd?: boolean; - ignorePattern?: string; + allowModuleStart?: boolean; + allowObjectEnd?: boolean; + allowObjectStart?: boolean; + allowTypeEnd?: boolean; + allowTypeStart?: boolean; applyDefaultIgnorePatterns?: boolean; + beforeBlockComment?: boolean; + beforeLineComment?: boolean; + ignorePattern?: string; }, ], ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot b/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot index b84068c5a69d..80c4750eb127 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot @@ -22,8 +22,8 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ 'always' | 'never', { - exceptAfterSingleLine?: boolean; exceptAfterOverload?: boolean; + exceptAfterSingleLine?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot b/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot index d3ba79226c98..2fa00bf1d208 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot @@ -86,36 +86,36 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { multiline?: { - delimiter?: 'none' | 'semi' | 'comma'; - requireLast?: boolean; - }; - singleline?: { - delimiter?: 'semi' | 'comma'; + delimiter?: 'comma' | 'none' | 'semi'; requireLast?: boolean; }; + multilineDetection?: 'brackets' | 'last-member'; overrides?: { interface?: { multiline?: { - delimiter?: 'none' | 'semi' | 'comma'; + delimiter?: 'comma' | 'none' | 'semi'; requireLast?: boolean; }; singleline?: { - delimiter?: 'semi' | 'comma'; + delimiter?: 'comma' | 'semi'; requireLast?: boolean; }; }; typeLiteral?: { multiline?: { - delimiter?: 'none' | 'semi' | 'comma'; + delimiter?: 'comma' | 'none' | 'semi'; requireLast?: boolean; }; singleline?: { - delimiter?: 'semi' | 'comma'; + delimiter?: 'comma' | 'semi'; requireLast?: boolean; }; }; }; - multilineDetection?: 'brackets' | 'last-member'; + singleline?: { + delimiter?: 'comma' | 'semi'; + requireLast?: boolean; + }; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot index 7b3e0b5bf2b6..a14e5e900388 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot @@ -1968,1750 +1968,1750 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - default?: + classes?: | 'never' | ( | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' - | 'decorated-readonly-field' - | 'static-readonly-field' - | 'public-static-readonly-field' - | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' - | 'private-readonly-field' - | 'private-decorated-readonly-field' - | 'private-static-readonly-field' - | 'private-instance-readonly-field' - | '#private-readonly-field' - | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' - | 'decorated-field' - | 'static-field' - | 'public-static-field' - | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' - | 'protected-decorated-field' - | 'protected-static-field' - | 'protected-instance-field' - | 'protected-abstract-field' - | 'private-field' - | 'private-decorated-field' - | 'private-static-field' - | 'private-instance-field' | '#private-field' - | '#private-static-field' + | '#private-get' | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' - | 'public-abstract-method' - | 'protected-method' - | 'protected-decorated-method' - | 'protected-static-method' - | 'protected-instance-method' - | 'protected-abstract-method' - | 'private-method' - | 'private-decorated-method' - | 'private-static-method' - | 'private-instance-method' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' | '#private-method' + | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' | '#private-static-method' - | '#private-instance-method' + | '#private-static-readonly-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' | 'call-signature' | 'constructor' - | 'public-constructor' - | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' - | 'public-decorated-get' + | 'decorated-field' | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' - | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' - | 'protected-decorated-get' - | 'protected-static-get' - | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' - | '#private-get' - | '#private-static-get' - | '#private-instance-get' - | 'set' - | 'public-set' - | 'public-decorated-set' + | 'decorated-method' + | 'decorated-readonly-field' | 'decorated-set' - | 'static-set' - | 'public-static-set' + | 'field' + | 'get' + | 'instance-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' | 'instance-set' - | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' - | 'protected-set' - | 'protected-decorated-set' - | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' + | 'private-decorated-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' | 'private-decorated-set' - | 'private-static-set' + | 'private-field' + | 'private-get' + | 'private-instance-field' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' - | 'static-initialization' - | 'static-static-initialization' - | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' - ) - | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' - | 'decorated-readonly-field' - | 'static-readonly-field' - | 'public-static-readonly-field' - | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' + | 'private-method' | 'private-readonly-field' - | 'private-decorated-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' + | 'private-static-method' | 'private-static-readonly-field' - | 'private-instance-readonly-field' - | '#private-readonly-field' - | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' - | 'decorated-field' - | 'static-field' - | 'public-static-field' - | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' - | 'protected-decorated-field' - | 'protected-static-field' - | 'protected-instance-field' + | 'private-static-set' + | 'private-static-static-initialization' | 'protected-abstract-field' - | 'private-field' - | 'private-decorated-field' - | 'private-static-field' - | 'private-instance-field' - | '#private-field' - | '#private-static-field' - | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' - | 'public-abstract-method' - | 'protected-method' - | 'protected-decorated-method' - | 'protected-static-method' - | 'protected-instance-method' + | 'protected-abstract-get' | 'protected-abstract-method' - | 'private-method' - | 'private-decorated-method' - | 'private-static-method' - | 'private-instance-method' - | '#private-method' - | '#private-static-method' - | '#private-instance-method' - | 'call-signature' - | 'constructor' - | 'public-constructor' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' - | 'public-decorated-get' - | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' - | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' + | 'protected-decorated-field' | 'protected-decorated-get' - | 'protected-static-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' + | 'protected-instance-field' | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' + | 'protected-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' + | 'protected-static-method' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' + | 'public-constructor' + | 'public-decorated-field' + | 'public-decorated-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' + | 'public-instance-get' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' + | 'public-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' + | 'public-static-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' + | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' + | 'static-static-initialization' + ) + | ( + | '#private-field' | '#private-get' - | '#private-static-get' + | '#private-instance-field' | '#private-instance-get' - | 'set' - | 'public-set' - | 'public-decorated-set' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' + | '#private-method' + | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' + | '#private-static-method' + | '#private-static-readonly-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' + | 'call-signature' + | 'constructor' + | 'decorated-field' + | 'decorated-get' + | 'decorated-method' + | 'decorated-readonly-field' | 'decorated-set' - | 'static-set' - | 'public-static-set' + | 'field' + | 'get' + | 'instance-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' | 'instance-set' - | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' - | 'protected-set' - | 'protected-decorated-set' - | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' + | 'private-decorated-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' | 'private-decorated-set' - | 'private-static-set' + | 'private-field' + | 'private-get' + | 'private-instance-field' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' + | 'private-instance-static-initialization' + | 'private-method' + | 'private-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' + | 'private-static-method' + | 'private-static-readonly-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' + | 'protected-constructor' + | 'protected-decorated-field' + | 'protected-decorated-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' + | 'protected-instance-field' + | 'protected-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' + | 'protected-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' + | 'protected-static-method' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' + | 'public-constructor' + | 'public-decorated-field' + | 'public-decorated-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' + | 'public-instance-get' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' + | 'public-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' + | 'public-static-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' | 'static-static-initialization' - | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' - | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' )[] )[] | { memberTypes?: + | 'never' | ( | ( + | '#private-field' + | '#private-get' + | '#private-instance-field' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' + | '#private-method' + | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' + | '#private-static-method' + | '#private-static-readonly-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' + | 'call-signature' + | 'constructor' + | 'decorated-field' + | 'decorated-get' + | 'decorated-method' + | 'decorated-readonly-field' + | 'decorated-set' + | 'field' + | 'get' + | 'instance-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' + | 'instance-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' + | 'private-decorated-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' + | 'private-decorated-set' + | 'private-field' + | 'private-get' + | 'private-instance-field' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' + | 'private-instance-set' + | 'private-instance-static-initialization' + | 'private-method' + | 'private-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' + | 'private-static-method' + | 'private-static-readonly-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' + | 'protected-constructor' + | 'protected-decorated-field' + | 'protected-decorated-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' + | 'protected-instance-field' + | 'protected-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' + | 'protected-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' + | 'protected-static-method' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' + | 'public-constructor' + | 'public-decorated-field' + | 'public-decorated-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' + | 'public-instance-get' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' + | 'public-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' + | 'public-static-set' + | 'public-static-static-initialization' + | 'readonly-field' | 'readonly-signature' + | 'set' | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' - | 'decorated-readonly-field' - | 'static-readonly-field' - | 'public-static-readonly-field' - | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' - | 'private-readonly-field' - | 'private-decorated-readonly-field' - | 'private-static-readonly-field' - | 'private-instance-readonly-field' - | '#private-readonly-field' - | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' - | 'decorated-field' | 'static-field' - | 'public-static-field' - | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' - | 'protected-decorated-field' - | 'protected-static-field' - | 'protected-instance-field' - | 'protected-abstract-field' - | 'private-field' - | 'private-decorated-field' - | 'private-static-field' - | 'private-instance-field' + | 'static-get' + | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' + | 'static-static-initialization' + ) + | ( | '#private-field' - | '#private-static-field' + | '#private-get' | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' - | 'public-abstract-method' - | 'protected-method' - | 'protected-decorated-method' - | 'protected-static-method' - | 'protected-instance-method' - | 'protected-abstract-method' - | 'private-method' - | 'private-decorated-method' - | 'private-static-method' - | 'private-instance-method' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' | '#private-method' + | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' | '#private-static-method' - | '#private-instance-method' + | '#private-static-readonly-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' | 'call-signature' | 'constructor' - | 'public-constructor' - | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' - | 'public-decorated-get' + | 'decorated-field' | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' - | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' - | 'protected-decorated-get' - | 'protected-static-get' - | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' - | '#private-get' - | '#private-static-get' - | '#private-instance-get' - | 'set' - | 'public-set' - | 'public-decorated-set' + | 'decorated-method' + | 'decorated-readonly-field' | 'decorated-set' - | 'static-set' - | 'public-static-set' + | 'field' + | 'get' + | 'instance-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' | 'instance-set' - | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' - | 'protected-set' - | 'protected-decorated-set' - | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' + | 'private-decorated-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' | 'private-decorated-set' - | 'private-static-set' + | 'private-field' + | 'private-get' + | 'private-instance-field' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' - | 'static-initialization' - | 'static-static-initialization' - | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' - ) - | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' - | 'decorated-readonly-field' - | 'static-readonly-field' - | 'public-static-readonly-field' - | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' + | 'private-method' | 'private-readonly-field' - | 'private-decorated-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' + | 'private-static-method' | 'private-static-readonly-field' - | 'private-instance-readonly-field' - | '#private-readonly-field' - | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' - | 'decorated-field' - | 'static-field' - | 'public-static-field' - | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' + | 'protected-constructor' | 'protected-decorated-field' - | 'protected-static-field' + | 'protected-decorated-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' | 'protected-instance-field' - | 'protected-abstract-field' - | 'private-field' - | 'private-decorated-field' - | 'private-static-field' - | 'private-instance-field' - | '#private-field' - | '#private-static-field' - | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' + | 'protected-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' + | 'protected-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' + | 'protected-static-method' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' | 'public-abstract-method' - | 'protected-method' - | 'protected-decorated-method' - | 'protected-static-method' - | 'protected-instance-method' - | 'protected-abstract-method' - | 'private-method' - | 'private-decorated-method' - | 'private-static-method' - | 'private-instance-method' - | '#private-method' - | '#private-static-method' - | '#private-instance-method' - | 'call-signature' - | 'constructor' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' | 'public-constructor' - | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' + | 'public-decorated-field' | 'public-decorated-get' - | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' - | 'protected-decorated-get' - | 'protected-static-get' - | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' - | '#private-get' - | '#private-static-get' - | '#private-instance-get' - | 'set' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' | 'public-set' - | 'public-decorated-set' - | 'decorated-set' - | 'static-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' | 'public-static-set' - | 'instance-set' - | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' - | 'protected-set' - | 'protected-decorated-set' - | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' - | 'private-decorated-set' - | 'private-static-set' - | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' | 'static-static-initialization' - | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' - | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' )[] - )[] - | 'never'; + )[]; + optionalityOrder?: 'optional-first' | 'required-first'; order?: - | 'alphabetically' | 'alphabetically-case-insensitive' + | 'alphabetically' | 'as-written' - | 'natural' - | 'natural-case-insensitive'; - optionalityOrder?: 'optional-first' | 'required-first'; + | 'natural-case-insensitive' + | 'natural'; }; - classes?: + classExpressions?: | 'never' | ( | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' - | 'decorated-readonly-field' - | 'static-readonly-field' - | 'public-static-readonly-field' - | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' - | 'private-readonly-field' - | 'private-decorated-readonly-field' - | 'private-static-readonly-field' - | 'private-instance-readonly-field' + | '#private-field' + | '#private-get' + | '#private-instance-field' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' + | '#private-method' | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' + | '#private-static-method' | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' + | 'call-signature' + | 'constructor' | 'decorated-field' - | 'static-field' - | 'public-static-field' + | 'decorated-get' + | 'decorated-method' + | 'decorated-readonly-field' + | 'decorated-set' + | 'field' + | 'get' | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' - | 'protected-decorated-field' - | 'protected-static-field' - | 'protected-instance-field' - | 'protected-abstract-field' - | 'private-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' + | 'instance-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' | 'private-decorated-field' - | 'private-static-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' + | 'private-decorated-set' + | 'private-field' + | 'private-get' | 'private-instance-field' - | '#private-field' - | '#private-static-field' - | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' - | 'public-abstract-method' - | 'protected-method' - | 'protected-decorated-method' - | 'protected-static-method' - | 'protected-instance-method' - | 'protected-abstract-method' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' + | 'private-instance-set' + | 'private-instance-static-initialization' | 'private-method' - | 'private-decorated-method' + | 'private-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' | 'private-static-method' - | 'private-instance-method' - | '#private-method' - | '#private-static-method' - | '#private-instance-method' - | 'call-signature' - | 'constructor' + | 'private-static-readonly-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' + | 'protected-constructor' + | 'protected-decorated-field' + | 'protected-decorated-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' + | 'protected-instance-field' + | 'protected-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' + | 'protected-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' + | 'protected-static-method' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' | 'public-constructor' - | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' + | 'public-decorated-field' | 'public-decorated-get' - | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' - | 'protected-decorated-get' - | 'protected-static-get' - | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' - | '#private-get' - | '#private-static-get' - | '#private-instance-get' - | 'set' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' | 'public-set' - | 'public-decorated-set' - | 'decorated-set' - | 'static-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' | 'public-static-set' - | 'instance-set' - | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' - | 'protected-set' - | 'protected-decorated-set' - | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' - | 'private-decorated-set' - | 'private-static-set' - | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' - | 'static-initialization' - | 'static-static-initialization' | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' - | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' - ) - | ( + | 'readonly-field' | 'readonly-signature' + | 'set' | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' - | 'decorated-readonly-field' + | 'static-field' + | 'static-get' + | 'static-initialization' + | 'static-method' | 'static-readonly-field' - | 'public-static-readonly-field' - | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' - | 'private-readonly-field' - | 'private-decorated-readonly-field' - | 'private-static-readonly-field' - | 'private-instance-readonly-field' + | 'static-set' + | 'static-static-initialization' + ) + | ( + | '#private-field' + | '#private-get' + | '#private-instance-field' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' + | '#private-method' | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' + | '#private-static-method' | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' + | 'call-signature' + | 'constructor' | 'decorated-field' - | 'static-field' - | 'public-static-field' + | 'decorated-get' + | 'decorated-method' + | 'decorated-readonly-field' + | 'decorated-set' + | 'field' + | 'get' | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' - | 'protected-decorated-field' - | 'protected-static-field' - | 'protected-instance-field' - | 'protected-abstract-field' - | 'private-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' + | 'instance-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' | 'private-decorated-field' - | 'private-static-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' + | 'private-decorated-set' + | 'private-field' + | 'private-get' | 'private-instance-field' - | '#private-field' - | '#private-static-field' - | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' - | 'public-abstract-method' - | 'protected-method' - | 'protected-decorated-method' - | 'protected-static-method' - | 'protected-instance-method' - | 'protected-abstract-method' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' + | 'private-instance-set' + | 'private-instance-static-initialization' | 'private-method' - | 'private-decorated-method' + | 'private-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' | 'private-static-method' - | 'private-instance-method' - | '#private-method' - | '#private-static-method' - | '#private-instance-method' - | 'call-signature' - | 'constructor' - | 'public-constructor' + | 'private-static-readonly-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' - | 'public-decorated-get' - | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' - | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' + | 'protected-decorated-field' | 'protected-decorated-get' - | 'protected-static-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' + | 'protected-instance-field' | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' - | '#private-get' - | '#private-static-get' - | '#private-instance-get' - | 'set' - | 'public-set' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' + | 'protected-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' + | 'protected-static-method' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' + | 'public-constructor' + | 'public-decorated-field' + | 'public-decorated-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' | 'public-decorated-set' - | 'decorated-set' - | 'static-set' - | 'public-static-set' - | 'instance-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' + | 'public-instance-get' + | 'public-instance-method' + | 'public-instance-readonly-field' | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' - | 'protected-set' - | 'protected-decorated-set' - | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' - | 'private-decorated-set' - | 'private-static-set' - | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' + | 'public-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' + | 'public-static-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' | 'static-static-initialization' - | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' - | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' )[] )[] | { memberTypes?: + | 'never' | ( | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' - | 'decorated-readonly-field' - | 'static-readonly-field' - | 'public-static-readonly-field' - | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' - | 'private-readonly-field' - | 'private-decorated-readonly-field' - | 'private-static-readonly-field' - | 'private-instance-readonly-field' + | '#private-field' + | '#private-get' + | '#private-instance-field' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' + | '#private-method' | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' + | '#private-static-method' | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' + | 'call-signature' + | 'constructor' | 'decorated-field' - | 'static-field' - | 'public-static-field' + | 'decorated-get' + | 'decorated-method' + | 'decorated-readonly-field' + | 'decorated-set' + | 'field' + | 'get' | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' - | 'protected-decorated-field' - | 'protected-static-field' - | 'protected-instance-field' - | 'protected-abstract-field' - | 'private-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' + | 'instance-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' | 'private-decorated-field' - | 'private-static-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' + | 'private-decorated-set' + | 'private-field' + | 'private-get' | 'private-instance-field' - | '#private-field' - | '#private-static-field' - | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' - | 'public-abstract-method' - | 'protected-method' - | 'protected-decorated-method' - | 'protected-static-method' - | 'protected-instance-method' - | 'protected-abstract-method' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' + | 'private-instance-set' + | 'private-instance-static-initialization' | 'private-method' - | 'private-decorated-method' + | 'private-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' | 'private-static-method' - | 'private-instance-method' + | 'private-static-readonly-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' + | 'protected-constructor' + | 'protected-decorated-field' + | 'protected-decorated-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' + | 'protected-instance-field' + | 'protected-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' + | 'protected-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' + | 'protected-static-method' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' + | 'public-constructor' + | 'public-decorated-field' + | 'public-decorated-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' + | 'public-instance-get' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' + | 'public-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' + | 'public-static-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' + | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' + | 'static-static-initialization' + ) + | ( + | '#private-field' + | '#private-get' + | '#private-instance-field' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' | '#private-method' + | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' | '#private-static-method' - | '#private-instance-method' + | '#private-static-readonly-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' | 'call-signature' | 'constructor' - | 'public-constructor' - | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' - | 'public-decorated-get' + | 'decorated-field' | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' - | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' - | 'protected-decorated-get' - | 'protected-static-get' - | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' - | '#private-get' - | '#private-static-get' - | '#private-instance-get' - | 'set' - | 'public-set' - | 'public-decorated-set' + | 'decorated-method' + | 'decorated-readonly-field' | 'decorated-set' - | 'static-set' - | 'public-static-set' + | 'field' + | 'get' + | 'instance-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' | 'instance-set' - | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' - | 'protected-set' - | 'protected-decorated-set' - | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' + | 'private-decorated-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' | 'private-decorated-set' - | 'private-static-set' + | 'private-field' + | 'private-get' + | 'private-instance-field' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' - | 'static-initialization' - | 'static-static-initialization' - | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' - ) - | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' - | 'decorated-readonly-field' - | 'static-readonly-field' - | 'public-static-readonly-field' - | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' + | 'private-method' | 'private-readonly-field' - | 'private-decorated-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' + | 'private-static-method' | 'private-static-readonly-field' - | 'private-instance-readonly-field' - | '#private-readonly-field' - | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' - | 'decorated-field' - | 'static-field' - | 'public-static-field' - | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' + | 'protected-constructor' | 'protected-decorated-field' - | 'protected-static-field' + | 'protected-decorated-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' | 'protected-instance-field' - | 'protected-abstract-field' - | 'private-field' - | 'private-decorated-field' - | 'private-static-field' - | 'private-instance-field' - | '#private-field' - | '#private-static-field' - | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' - | 'public-abstract-method' + | 'protected-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' | 'protected-method' - | 'protected-decorated-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' | 'protected-static-method' - | 'protected-instance-method' - | 'protected-abstract-method' - | 'private-method' - | 'private-decorated-method' - | 'private-static-method' - | 'private-instance-method' - | '#private-method' - | '#private-static-method' - | '#private-instance-method' - | 'call-signature' - | 'constructor' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' | 'public-constructor' - | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' + | 'public-decorated-field' | 'public-decorated-get' - | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' - | 'protected-decorated-get' - | 'protected-static-get' - | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' - | '#private-get' - | '#private-static-get' - | '#private-instance-get' - | 'set' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' | 'public-set' - | 'public-decorated-set' - | 'decorated-set' - | 'static-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' | 'public-static-set' - | 'instance-set' - | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' - | 'protected-set' - | 'protected-decorated-set' - | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' - | 'private-decorated-set' - | 'private-static-set' - | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' | 'static-static-initialization' - | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' - | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' )[] - )[] - | 'never'; + )[]; + optionalityOrder?: 'optional-first' | 'required-first'; order?: - | 'alphabetically' | 'alphabetically-case-insensitive' + | 'alphabetically' | 'as-written' - | 'natural' - | 'natural-case-insensitive'; - optionalityOrder?: 'optional-first' | 'required-first'; + | 'natural-case-insensitive' + | 'natural'; }; - classExpressions?: + default?: | 'never' | ( | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' - | 'decorated-readonly-field' - | 'static-readonly-field' - | 'public-static-readonly-field' - | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' - | 'private-readonly-field' - | 'private-decorated-readonly-field' - | 'private-static-readonly-field' - | 'private-instance-readonly-field' + | '#private-field' + | '#private-get' + | '#private-instance-field' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' + | '#private-method' | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' + | '#private-static-method' | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' + | 'call-signature' + | 'constructor' | 'decorated-field' - | 'static-field' - | 'public-static-field' + | 'decorated-get' + | 'decorated-method' + | 'decorated-readonly-field' + | 'decorated-set' + | 'field' + | 'get' | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' - | 'protected-decorated-field' - | 'protected-static-field' - | 'protected-instance-field' - | 'protected-abstract-field' - | 'private-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' + | 'instance-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' | 'private-decorated-field' - | 'private-static-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' + | 'private-decorated-set' + | 'private-field' + | 'private-get' | 'private-instance-field' - | '#private-field' - | '#private-static-field' - | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' - | 'public-abstract-method' - | 'protected-method' - | 'protected-decorated-method' - | 'protected-static-method' - | 'protected-instance-method' - | 'protected-abstract-method' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' + | 'private-instance-set' + | 'private-instance-static-initialization' | 'private-method' - | 'private-decorated-method' + | 'private-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' | 'private-static-method' - | 'private-instance-method' - | '#private-method' - | '#private-static-method' - | '#private-instance-method' - | 'call-signature' - | 'constructor' - | 'public-constructor' + | 'private-static-readonly-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' - | 'public-decorated-get' - | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' - | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' + | 'protected-decorated-field' | 'protected-decorated-get' - | 'protected-static-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' + | 'protected-instance-field' | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' + | 'protected-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' + | 'protected-static-method' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' + | 'public-constructor' + | 'public-decorated-field' + | 'public-decorated-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' + | 'public-instance-get' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' + | 'public-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' + | 'public-static-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' + | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' + | 'static-static-initialization' + ) + | ( + | '#private-field' | '#private-get' - | '#private-static-get' + | '#private-instance-field' | '#private-instance-get' - | 'set' - | 'public-set' - | 'public-decorated-set' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' + | '#private-method' + | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' + | '#private-static-method' + | '#private-static-readonly-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' + | 'call-signature' + | 'constructor' + | 'decorated-field' + | 'decorated-get' + | 'decorated-method' + | 'decorated-readonly-field' | 'decorated-set' - | 'static-set' - | 'public-static-set' + | 'field' + | 'get' + | 'instance-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' | 'instance-set' - | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' - | 'protected-set' - | 'protected-decorated-set' - | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' + | 'private-decorated-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' | 'private-decorated-set' - | 'private-static-set' + | 'private-field' + | 'private-get' + | 'private-instance-field' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' - | 'static-initialization' - | 'static-static-initialization' - | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' - ) - | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' - | 'decorated-readonly-field' - | 'static-readonly-field' - | 'public-static-readonly-field' - | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' + | 'private-method' | 'private-readonly-field' - | 'private-decorated-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' + | 'private-static-method' | 'private-static-readonly-field' - | 'private-instance-readonly-field' - | '#private-readonly-field' - | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' - | 'decorated-field' - | 'static-field' - | 'public-static-field' - | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' + | 'protected-constructor' | 'protected-decorated-field' - | 'protected-static-field' + | 'protected-decorated-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' | 'protected-instance-field' - | 'protected-abstract-field' - | 'private-field' - | 'private-decorated-field' - | 'private-static-field' - | 'private-instance-field' - | '#private-field' - | '#private-static-field' - | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' - | 'public-abstract-method' + | 'protected-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' | 'protected-method' - | 'protected-decorated-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' | 'protected-static-method' - | 'protected-instance-method' - | 'protected-abstract-method' - | 'private-method' - | 'private-decorated-method' - | 'private-static-method' - | 'private-instance-method' - | '#private-method' - | '#private-static-method' - | '#private-instance-method' - | 'call-signature' - | 'constructor' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' | 'public-constructor' - | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' + | 'public-decorated-field' | 'public-decorated-get' - | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' - | 'protected-decorated-get' - | 'protected-static-get' - | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' - | '#private-get' - | '#private-static-get' - | '#private-instance-get' - | 'set' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' | 'public-set' - | 'public-decorated-set' - | 'decorated-set' - | 'static-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' | 'public-static-set' - | 'instance-set' - | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' - | 'protected-set' - | 'protected-decorated-set' - | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' - | 'private-decorated-set' - | 'private-static-set' - | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' | 'static-static-initialization' - | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' - | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' )[] )[] | { memberTypes?: + | 'never' | ( | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' - | 'decorated-readonly-field' - | 'static-readonly-field' - | 'public-static-readonly-field' - | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' - | 'private-readonly-field' - | 'private-decorated-readonly-field' - | 'private-static-readonly-field' - | 'private-instance-readonly-field' + | '#private-field' + | '#private-get' + | '#private-instance-field' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' + | '#private-method' | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' + | '#private-static-method' | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' + | 'call-signature' + | 'constructor' | 'decorated-field' - | 'static-field' - | 'public-static-field' + | 'decorated-get' + | 'decorated-method' + | 'decorated-readonly-field' + | 'decorated-set' + | 'field' + | 'get' | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' - | 'protected-decorated-field' - | 'protected-static-field' - | 'protected-instance-field' - | 'protected-abstract-field' - | 'private-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' + | 'instance-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' | 'private-decorated-field' - | 'private-static-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' + | 'private-decorated-set' + | 'private-field' + | 'private-get' | 'private-instance-field' - | '#private-field' - | '#private-static-field' - | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' - | 'public-abstract-method' - | 'protected-method' - | 'protected-decorated-method' - | 'protected-static-method' - | 'protected-instance-method' - | 'protected-abstract-method' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' + | 'private-instance-set' + | 'private-instance-static-initialization' | 'private-method' - | 'private-decorated-method' + | 'private-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' | 'private-static-method' - | 'private-instance-method' - | '#private-method' - | '#private-static-method' - | '#private-instance-method' - | 'call-signature' - | 'constructor' - | 'public-constructor' + | 'private-static-readonly-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' - | 'public-decorated-get' - | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' - | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' + | 'protected-decorated-field' | 'protected-decorated-get' - | 'protected-static-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' + | 'protected-instance-field' | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' - | '#private-get' - | '#private-static-get' - | '#private-instance-get' - | 'set' - | 'public-set' - | 'public-decorated-set' - | 'decorated-set' - | 'static-set' - | 'public-static-set' - | 'instance-set' - | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' + | 'protected-method' + | 'protected-readonly-field' | 'protected-set' - | 'protected-decorated-set' + | 'protected-static-field' + | 'protected-static-get' + | 'protected-static-method' + | 'protected-static-readonly-field' | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' - | 'private-decorated-set' - | 'private-static-set' - | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' + | 'public-constructor' + | 'public-decorated-field' + | 'public-decorated-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' + | 'public-instance-get' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' + | 'public-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' + | 'public-static-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' | 'static-static-initialization' - | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' - | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' ) | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' - | 'public-readonly-field' - | 'public-decorated-readonly-field' + | '#private-field' + | '#private-get' + | '#private-instance-field' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' + | '#private-method' + | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' + | '#private-static-method' + | '#private-static-readonly-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' + | 'call-signature' + | 'constructor' + | 'decorated-field' + | 'decorated-get' + | 'decorated-method' | 'decorated-readonly-field' - | 'static-readonly-field' - | 'public-static-readonly-field' + | 'decorated-set' + | 'field' + | 'get' + | 'instance-field' + | 'instance-get' + | 'instance-method' | 'instance-readonly-field' - | 'public-instance-readonly-field' - | 'abstract-readonly-field' - | 'public-abstract-readonly-field' - | 'protected-readonly-field' - | 'protected-decorated-readonly-field' - | 'protected-static-readonly-field' - | 'protected-instance-readonly-field' - | 'protected-abstract-readonly-field' - | 'private-readonly-field' + | 'instance-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' + | 'private-decorated-field' + | 'private-decorated-get' + | 'private-decorated-method' | 'private-decorated-readonly-field' - | 'private-static-readonly-field' + | 'private-decorated-set' + | 'private-field' + | 'private-get' + | 'private-instance-field' + | 'private-instance-get' + | 'private-instance-method' | 'private-instance-readonly-field' - | '#private-readonly-field' - | '#private-static-readonly-field' - | '#private-instance-readonly-field' - | 'field' - | 'public-field' - | 'public-decorated-field' - | 'decorated-field' - | 'static-field' - | 'public-static-field' - | 'instance-field' - | 'public-instance-field' - | 'abstract-field' - | 'public-abstract-field' - | 'protected-field' + | 'private-instance-set' + | 'private-instance-static-initialization' + | 'private-method' + | 'private-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' + | 'private-static-method' + | 'private-static-readonly-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' + | 'protected-constructor' | 'protected-decorated-field' - | 'protected-static-field' + | 'protected-decorated-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' | 'protected-instance-field' - | 'protected-abstract-field' - | 'private-field' - | 'private-decorated-field' - | 'private-static-field' - | 'private-instance-field' - | '#private-field' - | '#private-static-field' - | '#private-instance-field' - | 'method' - | 'public-method' - | 'public-decorated-method' - | 'decorated-method' - | 'static-method' - | 'public-static-method' - | 'instance-method' - | 'public-instance-method' - | 'abstract-method' - | 'public-abstract-method' + | 'protected-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' | 'protected-method' - | 'protected-decorated-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' | 'protected-static-method' - | 'protected-instance-method' - | 'protected-abstract-method' - | 'private-method' - | 'private-decorated-method' - | 'private-static-method' - | 'private-instance-method' - | '#private-method' - | '#private-static-method' - | '#private-instance-method' - | 'call-signature' - | 'constructor' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' | 'public-constructor' - | 'protected-constructor' - | 'private-constructor' - | 'get' - | 'public-get' + | 'public-decorated-field' | 'public-decorated-get' - | 'decorated-get' - | 'static-get' - | 'public-static-get' - | 'instance-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' | 'public-instance-get' - | 'abstract-get' - | 'public-abstract-get' - | 'protected-get' - | 'protected-decorated-get' - | 'protected-static-get' - | 'protected-instance-get' - | 'protected-abstract-get' - | 'private-get' - | 'private-decorated-get' - | 'private-static-get' - | 'private-instance-get' - | '#private-get' - | '#private-static-get' - | '#private-instance-get' - | 'set' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' | 'public-set' - | 'public-decorated-set' - | 'decorated-set' - | 'static-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' | 'public-static-set' - | 'instance-set' - | 'public-instance-set' - | 'abstract-set' - | 'public-abstract-set' - | 'protected-set' - | 'protected-decorated-set' - | 'protected-static-set' - | 'protected-instance-set' - | 'protected-abstract-set' - | 'private-set' - | 'private-decorated-set' - | 'private-static-set' - | 'private-instance-set' - | '#private-set' - | '#private-static-set' - | '#private-instance-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' | 'static-static-initialization' - | 'public-static-static-initialization' - | 'instance-static-initialization' - | 'public-instance-static-initialization' - | 'abstract-static-initialization' - | 'public-abstract-static-initialization' - | 'protected-static-static-initialization' - | 'protected-instance-static-initialization' - | 'protected-abstract-static-initialization' - | 'private-static-static-initialization' - | 'private-instance-static-initialization' - | '#private-static-static-initialization' - | '#private-instance-static-initialization' )[] - )[] - | 'never'; + )[]; + optionalityOrder?: 'optional-first' | 'required-first'; order?: - | 'alphabetically' | 'alphabetically-case-insensitive' + | 'alphabetically' | 'as-written' - | 'natural' - | 'natural-case-insensitive'; - optionalityOrder?: 'optional-first' | 'required-first'; + | 'natural-case-insensitive' + | 'natural'; }; interfaces?: | 'never' | ( | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' + | 'constructor' | 'field' | 'method' - | 'constructor' - ) - | ( + | 'readonly-field' | 'readonly-signature' | 'signature' - | 'readonly-field' + ) + | ( + | 'constructor' | 'field' | 'method' - | 'constructor' + | 'readonly-field' + | 'readonly-signature' + | 'signature' )[] )[] | { memberTypes?: + | 'never' | ( | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' + | 'constructor' | 'field' | 'method' - | 'constructor' - ) - | ( + | 'readonly-field' | 'readonly-signature' | 'signature' - | 'readonly-field' + ) + | ( + | 'constructor' | 'field' | 'method' - | 'constructor' + | 'readonly-field' + | 'readonly-signature' + | 'signature' )[] - )[] - | 'never'; + )[]; + optionalityOrder?: 'optional-first' | 'required-first'; order?: - | 'alphabetically' | 'alphabetically-case-insensitive' + | 'alphabetically' | 'as-written' - | 'natural' - | 'natural-case-insensitive'; - optionalityOrder?: 'optional-first' | 'required-first'; + | 'natural-case-insensitive' + | 'natural'; }; typeLiterals?: | 'never' | ( | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' + | 'constructor' | 'field' | 'method' - | 'constructor' - ) - | ( + | 'readonly-field' | 'readonly-signature' | 'signature' - | 'readonly-field' + ) + | ( + | 'constructor' | 'field' | 'method' - | 'constructor' + | 'readonly-field' + | 'readonly-signature' + | 'signature' )[] )[] | { memberTypes?: + | 'never' | ( | ( - | 'readonly-signature' - | 'signature' - | 'readonly-field' + | 'constructor' | 'field' | 'method' - | 'constructor' - ) - | ( + | 'readonly-field' | 'readonly-signature' | 'signature' - | 'readonly-field' + ) + | ( + | 'constructor' | 'field' | 'method' - | 'constructor' + | 'readonly-field' + | 'readonly-signature' + | 'signature' )[] - )[] - | 'never'; + )[]; + optionalityOrder?: 'optional-first' | 'required-first'; order?: - | 'alphabetically' | 'alphabetically-case-insensitive' + | 'alphabetically' | 'as-written' - | 'natural' - | 'natural-case-insensitive'; - optionalityOrder?: 'optional-first' | 'required-first'; + | 'natural-case-insensitive' + | 'natural'; }; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot b/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot index c5e3ee644d1b..2be8f8ad3a68 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot @@ -9,6 +9,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: -type Options = ['property' | 'method']; +type Options = ['method' | 'property']; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot index ec017b3cefe0..08a8f7df15cd 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot @@ -5,84 +5,75 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # SCHEMA: { + "$defs": { + "underscoreOptions": { + "type": "string", + "enum": [ + "forbid", + "allow", + "require", + "requireDouble", + "allowDouble", + "allowSingleOrDouble" + ] + }, + "predefinedFormats": { + "type": "string", + "enum": [ + "camelCase", + "strictCamelCase", + "PascalCase", + "StrictPascalCase", + "snake_case", + "UPPER_CASE" + ] + }, + "typeModifiers": { + "type": "string", + "enum": ["boolean", "string", "number", "function", "array"] + }, + "prefixSuffixConfig": { + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "additionalItems": false + }, + "matchRegexConfig": { + "type": "object", + "properties": { + "match": { "type": "boolean" }, + "regex": { "type": "string" } + }, + "required": ["match", "regex"] + }, + "formatOptionsConfig": { + "oneOf": [ + { + "type": "array", + "items": { "$ref": "#/$defs/predefinedFormats" }, + "additionalItems": false + }, + { "type": "null" } + ] + } + }, "type": "array", "items": { "oneOf": [ { "type": "object", + "description": "Multiple selectors in one config", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { @@ -143,10 +134,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "types": { "type": "array", - "items": { - "type": "string", - "enum": ["boolean", "string", "number", "function", "array"] - }, + "items": { "$ref": "#/$defs/typeModifiers" }, "additionalItems": false } }, @@ -155,79 +143,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'default'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["default"] }, @@ -261,79 +189,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'variableLike'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["variableLike"] }, @@ -348,79 +216,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'variable'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["variable"] }, @@ -441,10 +249,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "types": { "type": "array", - "items": { - "type": "string", - "enum": ["boolean", "string", "number", "function", "array"] - }, + "items": { "$ref": "#/$defs/typeModifiers" }, "additionalItems": false } }, @@ -453,79 +258,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'function'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["function"] }, @@ -543,79 +288,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'parameter'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["parameter"] }, @@ -626,10 +311,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "types": { "type": "array", - "items": { - "type": "string", - "enum": ["boolean", "string", "number", "function", "array"] - }, + "items": { "$ref": "#/$defs/typeModifiers" }, "additionalItems": false } }, @@ -638,79 +320,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'memberLike'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["memberLike"] }, @@ -739,79 +361,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'classProperty'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["classProperty"] }, @@ -835,10 +397,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "types": { "type": "array", - "items": { - "type": "string", - "enum": ["boolean", "string", "number", "function", "array"] - }, + "items": { "$ref": "#/$defs/typeModifiers" }, "additionalItems": false } }, @@ -847,79 +406,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'objectLiteralProperty'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["objectLiteralProperty"] }, @@ -930,10 +429,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "types": { "type": "array", - "items": { - "type": "string", - "enum": ["boolean", "string", "number", "function", "array"] - }, + "items": { "$ref": "#/$defs/typeModifiers" }, "additionalItems": false } }, @@ -942,79 +438,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'typeProperty'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["typeProperty"] }, @@ -1028,10 +464,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "types": { "type": "array", - "items": { - "type": "string", - "enum": ["boolean", "string", "number", "function", "array"] - }, + "items": { "$ref": "#/$defs/typeModifiers" }, "additionalItems": false } }, @@ -1040,79 +473,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'parameterProperty'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["parameterProperty"] }, @@ -1126,10 +499,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "types": { "type": "array", - "items": { - "type": "string", - "enum": ["boolean", "string", "number", "function", "array"] - }, + "items": { "$ref": "#/$defs/typeModifiers" }, "additionalItems": false } }, @@ -1138,79 +508,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'property'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["property"] }, @@ -1235,10 +545,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "types": { "type": "array", - "items": { - "type": "string", - "enum": ["boolean", "string", "number", "function", "array"] - }, + "items": { "$ref": "#/$defs/typeModifiers" }, "additionalItems": false } }, @@ -1247,79 +554,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'classMethod'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["classMethod"] }, @@ -1347,79 +594,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'objectLiteralMethod'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["objectLiteralMethod"] }, @@ -1437,79 +624,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'typeMethod'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["typeMethod"] }, @@ -1524,79 +651,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'method'", "properties": { - "format": { + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "failureMessage": { "type": "string" }, + "filter": { "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "failureMessage": { "type": "string" }, - "filter": { - "oneOf": [ - { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "type": "string", "minLength": 1 }, + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["method"] }, @@ -1624,79 +691,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'accessor'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["accessor"] }, @@ -1718,10 +725,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "types": { "type": "array", - "items": { - "type": "string", - "enum": ["boolean", "string", "number", "function", "array"] - }, + "items": { "$ref": "#/$defs/typeModifiers" }, "additionalItems": false } }, @@ -1730,79 +734,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'enumMember'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["enumMember"] }, @@ -1817,79 +761,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'typeLike'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["typeLike"] }, @@ -1907,79 +791,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'class'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["class"] }, @@ -1997,79 +821,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'interface'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["interface"] }, @@ -2084,79 +848,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'typeAlias'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["typeAlias"] }, @@ -2171,79 +875,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'enum'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["enum"] }, @@ -2258,79 +902,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, { "type": "object", + "description": "Selector 'typeParameter'", "properties": { - "format": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string", - "enum": [ - "camelCase", - "strictCamelCase", - "PascalCase", - "StrictPascalCase", - "snake_case", - "UPPER_CASE" - ] - }, - "additionalItems": false - }, - { "type": "null" } - ] - }, - "custom": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - }, - "leadingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "trailingUnderscore": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" - ] - }, - "prefix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "suffix": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, + "format": { "$ref": "#/$defs/formatOptionsConfig" }, + "custom": { "$ref": "#/$defs/matchRegexConfig" }, + "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, + "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, + "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, "failureMessage": { "type": "string" }, "filter": { "oneOf": [ { "type": "string", "minLength": 1 }, - { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } - }, - "required": ["match", "regex"] - } + { "$ref": "#/$defs/matchRegexConfig" } ] }, "selector": { "type": "string", "enum": ["typeParameter"] }, @@ -2351,1122 +935,476 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: -type Options = ( - | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; +type UnderscoreOptions = + | 'allow' + | 'allowDouble' + | 'allowSingleOrDouble' + | 'forbid' + | 'require' + | 'requireDouble'; + +type PredefinedFormats = + | 'camelCase' + | 'PascalCase' + | 'snake_case' + | 'strictCamelCase' + | 'StrictPascalCase' + | 'UPPER_CASE'; + +type TypeModifiers = 'array' | 'boolean' | 'function' | 'number' | 'string'; + +type PrefixSuffixConfig = string[]; + +type MatchRegexConfig = { + match: boolean; + regex: string; +}; + +type FormatOptionsConfig = PredefinedFormats[] | null; + +type Options = /** Selector 'default' */ +(| { + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: ( - | 'default' - | 'variableLike' - | 'memberLike' - | 'typeLike' - | 'method' - | 'property' - | 'variable' - | 'function' - | 'parameter' - | 'parameterProperty' - | 'accessor' - | 'enumMember' - | 'classMethod' - | 'objectLiteralMethod' - | 'typeMethod' - | 'classProperty' - | 'objectLiteralProperty' - | 'typeProperty' - | 'class' - | 'interface' - | 'typeAlias' - | 'enum' - | 'typeParameter' - )[]; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ( - | 'const' - | 'readonly' - | 'static' - | 'public' - | 'protected' - | 'private' | '#private' | 'abstract' + | 'async' + | 'const' | 'destructured' - | 'global' | 'exported' - | 'unused' - | 'requiresQuotes' + | 'global' | 'override' - | 'async' - )[]; - types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; - } - | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; - failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'default'; - modifiers?: ( - | 'const' + | 'private' + | 'protected' + | 'public' | 'readonly' + | 'requiresQuotes' | 'static' - | 'public' - | 'protected' - | 'private' - | '#private' - | 'abstract' - | 'destructured' - | 'global' - | 'exported' | 'unused' - | 'requiresQuotes' - | 'override' - | 'async' )[]; + prefix?: PrefixSuffixConfig; + selector: 'default'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Multiple selectors in one config */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; - failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'variableLike'; - modifiers?: ('unused' | 'async')[]; - } - | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'variable'; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ( + | '#private' + | 'abstract' + | 'async' | 'const' | 'destructured' | 'exported' | 'global' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'readonly' + | 'requiresQuotes' + | 'static' | 'unused' - | 'async' )[]; - types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; - } - | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; - failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'function'; - modifiers?: ('exported' | 'global' | 'unused' | 'async')[]; - } - | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; - failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'parameter'; - modifiers?: ('destructured' | 'unused')[]; - types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + prefix?: PrefixSuffixConfig; + selector: ( + | 'accessor' + | 'class' + | 'classMethod' + | 'classProperty' + | 'default' + | 'enum' + | 'enumMember' + | 'function' + | 'interface' + | 'memberLike' + | 'method' + | 'objectLiteralMethod' + | 'objectLiteralProperty' + | 'parameter' + | 'parameterProperty' + | 'property' + | 'typeAlias' + | 'typeLike' + | 'typeMethod' + | 'typeParameter' + | 'typeProperty' + | 'variable' + | 'variableLike' + )[]; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'memberLike' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'memberLike'; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ( + | '#private' | 'abstract' + | 'async' + | 'override' | 'private' - | '#private' | 'protected' | 'public' | 'readonly' | 'requiresQuotes' | 'static' - | 'override' - | 'async' )[]; + prefix?: PrefixSuffixConfig; + selector: 'memberLike'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Selector 'property' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'classProperty'; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ( + | '#private' | 'abstract' + | 'async' + | 'override' | 'private' - | '#private' | 'protected' | 'public' | 'readonly' | 'requiresQuotes' | 'static' - | 'override' )[]; - types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; - } - | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; - failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'objectLiteralProperty'; - modifiers?: ('public' | 'requiresQuotes')[]; - types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; - } - | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; - failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'typeProperty'; - modifiers?: ('public' | 'readonly' | 'requiresQuotes')[]; - types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + prefix?: PrefixSuffixConfig; + selector: 'property'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'classMethod' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'parameterProperty'; - modifiers?: ('private' | 'protected' | 'public' | 'readonly')[]; - types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | '#private' + | 'abstract' + | 'async' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'requiresQuotes' + | 'static' + )[]; + prefix?: PrefixSuffixConfig; + selector: 'classMethod'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Selector 'method' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'property'; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ( + | '#private' | 'abstract' + | 'async' + | 'override' | 'private' - | '#private' | 'protected' | 'public' - | 'readonly' | 'requiresQuotes' | 'static' - | 'override' - | 'async' )[]; - types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + prefix?: PrefixSuffixConfig; + selector: 'method'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Selector 'classProperty' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'classMethod'; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ( + | '#private' | 'abstract' + | 'override' | 'private' - | '#private' | 'protected' | 'public' + | 'readonly' | 'requiresQuotes' | 'static' - | 'override' - | 'async' )[]; + prefix?: PrefixSuffixConfig; + selector: 'classProperty'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'class' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'objectLiteralMethod'; - modifiers?: ('public' | 'requiresQuotes' | 'async')[]; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('abstract' | 'exported' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'class'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Selector 'typeLike' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'typeMethod'; - modifiers?: ('public' | 'requiresQuotes')[]; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('abstract' | 'exported' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'typeLike'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Selector 'accessor' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'method'; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ( | 'abstract' + | 'override' | 'private' - | '#private' | 'protected' | 'public' | 'requiresQuotes' | 'static' - | 'override' - | 'async' )[]; + prefix?: PrefixSuffixConfig; + selector: 'accessor'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'variable' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'accessor'; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ( - | 'abstract' - | 'private' - | 'protected' - | 'public' - | 'requiresQuotes' - | 'static' - | 'override' + | 'async' + | 'const' + | 'destructured' + | 'exported' + | 'global' + | 'unused' )[]; - types?: ('boolean' | 'string' | 'number' | 'function' | 'array')[]; + prefix?: PrefixSuffixConfig; + selector: 'variable'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'function' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'enumMember'; - modifiers?: ('requiresQuotes')[]; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('async' | 'exported' | 'global' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'function'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Selector 'objectLiteralMethod' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'typeLike'; - modifiers?: ('abstract' | 'exported' | 'unused')[]; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('async' | 'public' | 'requiresQuotes')[]; + prefix?: PrefixSuffixConfig; + selector: 'objectLiteralMethod'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Selector 'variableLike' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'class'; - modifiers?: ('abstract' | 'exported' | 'unused')[]; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('async' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'variableLike'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Selector 'parameter' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'interface'; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('destructured' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'parameter'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'enum' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ('exported' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'enum'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Selector 'interface' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'typeAlias'; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ('exported' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'interface'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Selector 'typeAlias' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'enum'; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ('exported' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'typeAlias'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } + /** Selector 'parameterProperty' */ | { - format: - | ( - | 'camelCase' - | 'strictCamelCase' - | 'PascalCase' - | 'StrictPascalCase' - | 'snake_case' - | 'UPPER_CASE' - )[] - | null; - custom?: { - match: boolean; - regex: string; - }; - leadingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - trailingUnderscore?: - | 'forbid' - | 'allow' - | 'require' - | 'requireDouble' - | 'allowDouble' - | 'allowSingleOrDouble'; - prefix?: string[]; - suffix?: string[]; + custom?: MatchRegexConfig; failureMessage?: string; - filter?: - | string - | { - match: boolean; - regex: string; - }; - selector: 'typeParameter'; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('private' | 'protected' | 'public' | 'readonly')[]; + prefix?: PrefixSuffixConfig; + selector: 'parameterProperty'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'typeProperty' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('public' | 'readonly' | 'requiresQuotes')[]; + prefix?: PrefixSuffixConfig; + selector: 'typeProperty'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'objectLiteralProperty' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('public' | 'requiresQuotes')[]; + prefix?: PrefixSuffixConfig; + selector: 'objectLiteralProperty'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'typeMethod' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('public' | 'requiresQuotes')[]; + prefix?: PrefixSuffixConfig; + selector: 'typeMethod'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'enumMember' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('requiresQuotes')[]; + prefix?: PrefixSuffixConfig; + selector: 'enumMember'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'typeParameter' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; modifiers?: ('unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'typeParameter'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; } )[]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot b/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot index fa3716efd597..05731db66491 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot @@ -41,20 +41,20 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { allow?: ( - | 'functions' | 'arrowFunctions' + | 'asyncFunctions' + | 'asyncMethods' + | 'constructors' + | 'decoratedFunctions' + | 'functions' | 'generatorFunctions' - | 'methods' | 'generatorMethods' | 'getters' - | 'setters' - | 'constructors' + | 'methods' + | 'overrideMethods' | 'private-constructors' | 'protected-constructors' - | 'asyncFunctions' - | 'asyncMethods' - | 'decoratedFunctions' - | 'overrideMethods' + | 'setters' )[]; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot index 07e519d8474f..9ee6da05e840 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot @@ -44,25 +44,25 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = - | ([] | ['functions', ...unknown[]]) | ( | [] | ['all'] | [ 'all', { + allowParensAfterCommentPattern?: string; conditionalAssign?: boolean; - nestedBinaryExpressions?: boolean; - returnAssign?: boolean; - ignoreJSX?: 'none' | 'all' | 'single-line' | 'multi-line'; enforceForArrowConditionals?: boolean; - enforceForSequenceExpressions?: boolean; - enforceForNewInMemberExpressions?: boolean; enforceForFunctionPrototypeMethods?: boolean; - allowParensAfterCommentPattern?: string; + enforceForNewInMemberExpressions?: boolean; + enforceForSequenceExpressions?: boolean; + ignoreJSX?: 'all' | 'multi-line' | 'none' | 'single-line'; + nestedBinaryExpressions?: boolean; + returnAssign?: boolean; }, ...unknown[], ] - ); + ) + | ([] | ['functions', ...unknown[]]); " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot b/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot index e0d7912480b8..8d9914840cb1 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot @@ -26,10 +26,10 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - /** Whether to ignore \`void\` expressions. */ - ignoreVoid?: boolean; /** Whether to ignore async IIFEs (Immediately Invocated Function Expressions). */ ignoreIIFE?: boolean; + /** Whether to ignore \`void\` expressions. */ + ignoreVoid?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot index 89ed05252f0a..d4cc22682f95 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot @@ -25,8 +25,8 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - allowInGenericTypeArguments?: boolean | string[]; allowAsThisParameter?: boolean; + allowInGenericTypeArguments?: string[] | boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot index dcf2177742d4..988516986a17 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot @@ -41,10 +41,10 @@ type Options = [ enforceConst?: boolean; ignore?: (number | string)[]; ignoreArrayIndexes?: boolean; - ignoreDefaultValues?: boolean; ignoreClassFieldInitialValues?: boolean; - ignoreNumericLiteralTypes?: boolean; + ignoreDefaultValues?: boolean; ignoreEnums?: boolean; + ignoreNumericLiteralTypes?: boolean; ignoreReadonlyClassProperties?: boolean; ignoreTypeIndexes?: boolean; }, diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot b/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot index 5981e1ab0fb3..ac1412beabf2 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot @@ -36,16 +36,16 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { checksConditionals?: boolean; + checksSpreads?: boolean; checksVoidReturn?: - | boolean | { arguments?: boolean; attributes?: boolean; properties?: boolean; returns?: boolean; variables?: boolean; - }; - checksSpreads?: boolean; + } + | boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot index e7b948d93f63..daa3b544dfc9 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot @@ -110,36 +110,36 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = | ( - | string | { - name: string; - message?: string; - importNames?: string[]; allowTypeImports?: boolean; + importNames?: string[]; + message?: string; + name: string; } + | string )[] | ( | [] | [ { paths?: ( - | string | { - name: string; - message?: string; - importNames?: string[]; allowTypeImports?: boolean; + importNames?: string[]; + message?: string; + name: string; } + | string )[]; patterns?: - | string[] | { - importNames?: [string, ...string[]]; + allowTypeImports?: boolean; + caseSensitive?: boolean; group: [string, ...string[]]; + importNames?: [string, ...string[]]; message?: string; - caseSensitive?: boolean; - allowTypeImports?: boolean; - }[]; + }[] + | string[]; }, ] ); diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot b/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot index 6c6230c8a451..f4abf1ef70c2 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot @@ -24,12 +24,12 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + allow?: string[]; builtinGlobals?: boolean; hoist?: 'all' | 'functions' | 'never'; - allow?: string[]; + ignoreFunctionTypeParameterNameValueShadow?: boolean; ignoreOnInitialization?: boolean; ignoreTypeValueShadow?: boolean; - ignoreFunctionTypeParameterNameValueShadow?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot index c5f5ef21d921..66dcd5de4e57 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot @@ -77,39 +77,39 @@ type Options = [ /** Whether to allow direct one-to-one type aliases. */ allowAliases?: | 'always' - | 'never' - | 'in-unions' | 'in-intersections' - | 'in-unions-and-intersections'; + | 'in-unions-and-intersections' + | 'in-unions' + | 'never'; /** Whether to allow type aliases for callbacks. */ allowCallbacks?: 'always' | 'never'; /** Whether to allow type aliases for conditional types. */ allowConditionalTypes?: 'always' | 'never'; /** Whether to allow type aliases with constructors. */ allowConstructors?: 'always' | 'never'; + /** Whether to allow type aliases with generic types. */ + allowGenerics?: 'always' | 'never'; /** Whether to allow type aliases with object literal types. */ allowLiterals?: | 'always' - | 'never' - | 'in-unions' | 'in-intersections' - | 'in-unions-and-intersections'; + | 'in-unions-and-intersections' + | 'in-unions' + | 'never'; /** Whether to allow type aliases with mapped types. */ allowMappedTypes?: | 'always' - | 'never' - | 'in-unions' | 'in-intersections' - | 'in-unions-and-intersections'; + | 'in-unions-and-intersections' + | 'in-unions' + | 'never'; /** Whether to allow type aliases with tuple types. */ allowTupleTypes?: | 'always' - | 'never' - | 'in-unions' | 'in-intersections' - | 'in-unions-and-intersections'; - /** Whether to allow type aliases with generic types. */ - allowGenerics?: 'always' | 'never'; + | 'in-unions-and-intersections' + | 'in-unions' + | 'never'; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot index 855b4fc6627e..7a8270778792 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot @@ -26,10 +26,10 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - /** Whether to allow comparisons between nullable boolean variables and \`true\`. */ - allowComparingNullableBooleansToTrue?: boolean; /** Whether to allow comparisons between nullable boolean variables and \`false\`. */ allowComparingNullableBooleansToFalse?: boolean; + /** Whether to allow comparisons between nullable boolean variables and \`true\`. */ + allowComparingNullableBooleansToTrue?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot index 2bb77b1795c0..b4741f9ef969 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot @@ -23,8 +23,8 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { allowShortCircuit?: boolean; - allowTernary?: boolean; allowTaggedTemplates?: boolean; + allowTernary?: boolean; enforceForJSX?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot index 29e754709f07..ef5cafaacc37 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot @@ -32,14 +32,14 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ | ('all' | 'local') | { - vars?: 'all' | 'local'; - varsIgnorePattern?: string; - args?: 'all' | 'after-used' | 'none'; - ignoreRestSiblings?: boolean; + args?: 'after-used' | 'all' | 'none'; argsIgnorePattern?: string; caughtErrors?: 'all' | 'none'; caughtErrorsIgnorePattern?: string; destructuredArrayIgnorePattern?: string; + ignoreRestSiblings?: boolean; + vars?: 'all' | 'local'; + varsIgnorePattern?: string; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot index 9cb5d62aa255..1cb658fa3dcf 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot @@ -31,13 +31,13 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ | 'nofunc' | { - functions?: boolean; + allowNamedExports?: boolean; classes?: boolean; enums?: boolean; - variables?: boolean; - typedefs?: boolean; + functions?: boolean; ignoreTypeReferences?: boolean; - allowNamedExports?: boolean; + typedefs?: boolean; + variables?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot index b0e47c104105..a29eeddd0e51 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot @@ -123,28 +123,13 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: -type PaddingType = 'any' | 'never' | 'always'; +type PaddingType = 'always' | 'any' | 'never'; type StatementType = | ( | '*' | 'block-like' - | 'exports' - | 'require' - | 'directive' - | 'expression' - | 'iife' - | 'multiline-block-like' - | 'multiline-expression' - | 'multiline-const' - | 'multiline-let' - | 'multiline-var' - | 'singleline-const' - | 'singleline-let' - | 'singleline-var' | 'block' - | 'empty' - | 'function' | 'break' | 'case' | 'class' @@ -152,42 +137,42 @@ type StatementType = | 'continue' | 'debugger' | 'default' + | 'directive' | 'do' + | 'empty' | 'export' + | 'exports' + | 'expression' | 'for' + | 'function' | 'if' + | 'iife' | 'import' + | 'interface' | 'let' + | 'multiline-block-like' + | 'multiline-const' + | 'multiline-expression' + | 'multiline-let' + | 'multiline-var' + | 'require' | 'return' + | 'singleline-const' + | 'singleline-let' + | 'singleline-var' | 'switch' | 'throw' | 'try' + | 'type' | 'var' | 'while' | 'with' - | 'interface' - | 'type' ) | [ ( | '*' | 'block-like' - | 'exports' - | 'require' - | 'directive' - | 'expression' - | 'iife' - | 'multiline-block-like' - | 'multiline-expression' - | 'multiline-const' - | 'multiline-let' - | 'multiline-var' - | 'singleline-const' - | 'singleline-let' - | 'singleline-var' | 'block' - | 'empty' - | 'function' | 'break' | 'case' | 'class' @@ -195,41 +180,41 @@ type StatementType = | 'continue' | 'debugger' | 'default' + | 'directive' | 'do' + | 'empty' | 'export' + | 'exports' + | 'expression' | 'for' + | 'function' | 'if' + | 'iife' | 'import' + | 'interface' | 'let' + | 'multiline-block-like' + | 'multiline-const' + | 'multiline-expression' + | 'multiline-let' + | 'multiline-var' + | 'require' | 'return' + | 'singleline-const' + | 'singleline-let' + | 'singleline-var' | 'switch' | 'throw' | 'try' + | 'type' | 'var' | 'while' | 'with' - | 'interface' - | 'type' ), ...( | '*' | 'block-like' - | 'exports' - | 'require' - | 'directive' - | 'expression' - | 'iife' - | 'multiline-block-like' - | 'multiline-expression' - | 'multiline-const' - | 'multiline-let' - | 'multiline-var' - | 'singleline-const' - | 'singleline-let' - | 'singleline-var' | 'block' - | 'empty' - | 'function' | 'break' | 'case' | 'class' @@ -237,28 +222,43 @@ type StatementType = | 'continue' | 'debugger' | 'default' + | 'directive' | 'do' + | 'empty' | 'export' + | 'exports' + | 'expression' | 'for' + | 'function' | 'if' + | 'iife' | 'import' + | 'interface' | 'let' + | 'multiline-block-like' + | 'multiline-const' + | 'multiline-expression' + | 'multiline-let' + | 'multiline-var' + | 'require' | 'return' + | 'singleline-const' + | 'singleline-let' + | 'singleline-var' | 'switch' | 'throw' | 'try' + | 'type' | 'var' | 'while' | 'with' - | 'interface' - | 'type' )[], ]; type Options = { blankLine: PaddingType; - prev: StatementType; next: StatementType; + prev: StatementType; }[]; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot b/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot index 5ba7133dd3c9..ffb4847eb4d7 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot @@ -36,13 +36,13 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Modifier = - | 'readonly' + | 'private readonly' | 'private' + | 'protected readonly' | 'protected' + | 'public readonly' | 'public' - | 'private readonly' - | 'protected readonly' - | 'public readonly'; + | 'readonly'; type Options = [ { diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot index 026ab583d675..9b472307161c 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot @@ -24,10 +24,10 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; ignoreConditionalTests?: boolean; - ignoreTernaryTests?: boolean; ignoreMixedLogicalExpressions?: boolean; - allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; + ignoreTernaryTests?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot index 307123536446..179b0f8cfb4d 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot @@ -89,21 +89,21 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { allow?: ( - | string | { from: 'file'; - name: string | [string, ...string[]]; + name: [string, ...string[]] | string; path?: string; } | { from: 'lib'; - name: string | [string, ...string[]]; + name: [string, ...string[]] | string; } | { from: 'package'; - name: string | [string, ...string[]]; + name: [string, ...string[]] | string; package: string; } + | string )[]; checkParameterProperties?: boolean; ignoreInferredTypes?: boolean; diff --git a/packages/eslint-plugin/tests/schema-snapshots/quotes.shot b/packages/eslint-plugin/tests/schema-snapshots/quotes.shot index 4da8b202c825..e422d74b82d6 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/quotes.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/quotes.shot @@ -25,12 +25,12 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = [ - 'single' | 'double' | 'backtick', + 'backtick' | 'double' | 'single', ( | 'avoid-escape' | { - avoidEscape?: boolean; allowTemplateLiterals?: boolean; + avoidEscape?: boolean; } ), ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot b/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot index 377143509c43..61d659cf5fb0 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot @@ -26,10 +26,10 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - /** Whether to check compound assignments such as \`+=\`. */ - checkCompoundAssignments?: boolean; /** Whether to allow \`any\` typed values. */ allowAny?: boolean; + /** Whether to check compound assignments such as \`+=\`. */ + checkCompoundAssignments?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot index 095a1fed10be..18109d7993c3 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot @@ -41,18 +41,18 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - /** Whether to allow \`number\` typed values in template expressions. */ - allowNumber?: boolean; - /** Whether to allow \`boolean\` typed values in template expressions. */ - allowBoolean?: boolean; /** Whether to allow \`any\` typed values in template expressions. */ allowAny?: boolean; + /** Whether to allow \`boolean\` typed values in template expressions. */ + allowBoolean?: boolean; + /** Whether to allow \`never\` typed values in template expressions. */ + allowNever?: boolean; /** Whether to allow \`nullish\` typed values in template expressions. */ allowNullish?: boolean; + /** Whether to allow \`number\` typed values in template expressions. */ + allowNumber?: boolean; /** Whether to allow \`regexp\` typed values in template expressions. */ allowRegExp?: boolean; - /** Whether to allow \`never\` typed values in template expressions. */ - allowNever?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/return-await.shot b/packages/eslint-plugin/tests/schema-snapshots/return-await.shot index 6ce1aca3c309..b90fc5fdffd5 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/return-await.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/return-await.shot @@ -9,6 +9,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: -type Options = ['in-try-catch' | 'always' | 'never']; +type Options = ['always' | 'in-try-catch' | 'never']; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/semi.shot b/packages/eslint-plugin/tests/schema-snapshots/semi.shot index a782b4ba6d1f..e7694dac05cc 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/semi.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/semi.shot @@ -45,22 +45,22 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = | ( | [] - | ['never'] + | ['always'] | [ - 'never', + 'always', { - beforeStatementContinuationChars?: 'always' | 'any' | 'never'; + omitLastInOneLineBlock?: boolean; }, ...unknown[], ] ) | ( | [] - | ['always'] + | ['never'] | [ - 'always', + 'never', { - omitLastInOneLineBlock?: boolean; + beforeStatementContinuationChars?: 'always' | 'any' | 'never'; }, ...unknown[], ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot b/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot index 7930323d4469..1972e0948308 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot @@ -57,9 +57,9 @@ type Options = [ | 'import' | 'intersection' | 'keyword' - | 'nullish' | 'literal' | 'named' + | 'nullish' | 'object' | 'operator' | 'tuple' diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot b/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot index 2bbb220294db..99dd9b10885a 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot @@ -27,9 +27,9 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ | ('always' | 'never') | { - keywords?: 'always' | 'never' | 'off'; - functions?: 'always' | 'never' | 'off'; classes?: 'always' | 'never' | 'off'; + functions?: 'always' | 'never' | 'off'; + keywords?: 'always' | 'never' | 'off'; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot b/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot index ae290a78fff9..7f5367c019c2 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot @@ -27,9 +27,9 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ | ('always' | 'never') | { - anonymous?: 'always' | 'never' | 'ignore'; - named?: 'always' | 'never' | 'ignore'; - asyncArrow?: 'always' | 'never' | 'ignore'; + anonymous?: 'always' | 'ignore' | 'never'; + asyncArrow?: 'always' | 'ignore' | 'never'; + named?: 'always' | 'ignore' | 'never'; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot index 020ee99ac9c9..c2d2c3a4d001 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot @@ -29,15 +29,15 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - allowString?: boolean; - allowNumber?: boolean; - allowNullableObject?: boolean; + allowAny?: boolean; allowNullableBoolean?: boolean; - allowNullableString?: boolean; - allowNullableNumber?: boolean; allowNullableEnum?: boolean; - allowAny?: boolean; + allowNullableNumber?: boolean; + allowNullableObject?: boolean; + allowNullableString?: boolean; + allowNumber?: boolean; allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; + allowString?: boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot index 0623badd3db2..8506ccbdd7f8 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot @@ -74,32 +74,32 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - before?: boolean; after?: boolean; + before?: boolean; overrides?: { - colon?: { - before?: boolean; - after?: boolean; - }; arrow?: { - before?: boolean; after?: boolean; - }; - variable?: { before?: boolean; + }; + colon?: { after?: boolean; + before?: boolean; }; parameter?: { - before?: boolean; after?: boolean; + before?: boolean; }; property?: { - before?: boolean; after?: boolean; + before?: boolean; }; returnType?: { + after?: boolean; before?: boolean; + }; + variable?: { after?: boolean; + before?: boolean; }; }; }, diff --git a/packages/rule-schema-to-typescript-types/src/index.ts b/packages/rule-schema-to-typescript-types/src/index.ts index 84d719a59937..ba79614d6b50 100644 --- a/packages/rule-schema-to-typescript-types/src/index.ts +++ b/packages/rule-schema-to-typescript-types/src/index.ts @@ -218,11 +218,11 @@ function generateType(schema: JSONSchema4, refMap: RefMap): GeneratedResult { function printUnionType(members: (string | GeneratedResult)[]): string { return members - .map(m => { - if (typeof m === 'string') { - return `| ${m}`; + .map(member => { + if (typeof member === 'string') { + return `| ${member}`; } - return `${printComment(m)} | (${m.code})`; + return `${printComment(member)} | (${member.code})`; }) .join('\n'); } @@ -257,7 +257,12 @@ function generateUnionType(members: JSONSchema4Type[], refMap: RefMap): string { ); } - return printUnionType(memberStrings); + return printUnionType( + memberStrings + // sort the union members so that we get consistent output regardless + // of import declaration order + .sort((a, b) => a.code.localeCompare(b.code)), + ); } function generateArrayType( @@ -431,7 +436,11 @@ function generateObjectType( Array.isArray(schema.required) ? schema.required : [], ); if (schema.properties) { - for (const [propName, propSchema] of Object.entries(schema.properties)) { + const propertyDefs = Object.entries(schema.properties) + // sort the properties so that we get consistent output regardless + // of import declaration order + .sort(([a], [b]) => a.localeCompare(b)); + for (const [propName, propSchema] of propertyDefs) { const propType = generateType(propSchema, refMap); const sanitisedPropName = requiresQuoting(propName) ? `'${propName}'` From 2129e397f9eb39188687b0da0b79749b964bb61f Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 14 Apr 2023 09:55:31 +0930 Subject: [PATCH 03/16] sort and format schema json snapshots --- docs/linting/Troubleshooting.mdx | 36 + .../src/rules/lines-around-comment.ts | 155 +- .../tests/schema-snapshots/array-type.shot | 4 +- .../schema-snapshots/ban-ts-comment.shot | 42 +- .../tests/schema-snapshots/ban-types.shot | 48 +- .../tests/schema-snapshots/block-spacing.shot | 6 +- .../tests/schema-snapshots/brace-style.shot | 13 +- .../class-literal-property-style.shot | 6 +- .../tests/schema-snapshots/comma-dangle.shot | 52 +- .../tests/schema-snapshots/comma-spacing.shot | 14 +- .../consistent-generic-constructors.shot | 6 +- .../consistent-indexed-object-style.shot | 6 +- .../consistent-type-assertions.shot | 20 +- .../consistent-type-definitions.shot | 6 +- .../consistent-type-exports.shot | 8 +- .../consistent-type-imports.shot | 16 +- .../tests/schema-snapshots/dot-notation.shot | 30 +- .../explicit-function-return-type.shot | 36 +- .../explicit-member-accessibility.shot | 49 +- .../explicit-module-boundary-types.shot | 8 +- .../schema-snapshots/func-call-spacing.shot | 28 +- .../schema-snapshots/init-declarations.shot | 28 +- .../tests/schema-snapshots/key-spacing.shot | 168 +- .../schema-snapshots/keyword-spacing.shot | 854 +++-- .../lines-around-comment.shot | 156 +- .../lines-between-class-members.shot | 18 +- .../member-delimiter-style.shot | 98 +- .../schema-snapshots/member-ordering.shot | 3108 +++++++++-------- .../method-signature-style.shot | 6 +- .../schema-snapshots/naming-convention.shot | 1605 ++++++--- .../schema-snapshots/no-base-to-string.shot | 11 +- .../no-confusing-void-expression.shot | 12 +- .../no-duplicate-type-constituents.shot | 12 +- .../schema-snapshots/no-empty-function.shot | 22 +- .../schema-snapshots/no-empty-interface.shot | 8 +- .../schema-snapshots/no-explicit-any.shot | 4 +- .../schema-snapshots/no-extra-parens.shot | 56 +- .../schema-snapshots/no-extraneous-class.shot | 4 +- .../no-floating-promises.shot | 12 +- .../schema-snapshots/no-inferrable-types.shot | 12 +- .../schema-snapshots/no-invalid-this.shot | 9 +- .../no-invalid-void-type.shot | 22 +- .../schema-snapshots/no-magic-numbers.shot | 56 +- .../no-meaningless-void-operator.shot | 11 +- .../schema-snapshots/no-misused-promises.shot | 38 +- .../tests/schema-snapshots/no-namespace.shot | 4 +- .../tests/schema-snapshots/no-redeclare.shot | 12 +- .../no-restricted-imports.shot | 117 +- .../tests/schema-snapshots/no-shadow.shot | 31 +- .../tests/schema-snapshots/no-this-alias.shot | 10 +- .../schema-snapshots/no-throw-literal.shot | 12 +- .../tests/schema-snapshots/no-type-alias.shot | 36 +- ...o-unnecessary-boolean-literal-compare.shot | 12 +- .../no-unnecessary-condition.shot | 4 +- .../no-unnecessary-type-assertion.shot | 10 +- .../no-unused-expressions.shot | 24 +- .../schema-snapshots/no-unused-vars.shot | 40 +- .../no-use-before-define.shot | 36 +- .../object-curly-spacing.shot | 16 +- .../padding-line-between-statements.shot | 108 +- .../parameter-properties.shot | 24 +- .../prefer-literal-enum-member.shot | 10 +- .../prefer-nullish-coalescing.shot | 16 +- .../prefer-readonly-parameter-types.shot | 95 +- .../schema-snapshots/prefer-readonly.shot | 6 +- .../promise-function-async.shot | 26 +- .../tests/schema-snapshots/quotes.shot | 20 +- .../require-array-sort-compare.shot | 4 +- .../restrict-plus-operands.shot | 12 +- .../restrict-template-expressions.shot | 20 +- .../tests/schema-snapshots/return-await.shot | 6 +- .../tests/schema-snapshots/semi.shot | 30 +- .../sort-type-constituents.shot | 14 +- .../schema-snapshots/space-before-blocks.shot | 20 +- .../space-before-function-paren.shot | 20 +- .../schema-snapshots/space-infix-ops.shot | 11 +- .../strict-boolean-expressions.shot | 36 +- .../triple-slash-reference.shot | 16 +- .../type-annotation-spacing.shot | 98 +- .../tests/schema-snapshots/typedef.shot | 36 +- .../schema-snapshots/unbound-method.shot | 4 +- packages/eslint-plugin/tests/schemas.test.ts | 28 +- .../editor/createProvideCodeActions.ts | 4 +- yarn.lock | 66 +- 84 files changed, 4784 insertions(+), 3229 deletions(-) diff --git a/docs/linting/Troubleshooting.mdx b/docs/linting/Troubleshooting.mdx index 56179707d736..0754416c6154 100644 --- a/docs/linting/Troubleshooting.mdx +++ b/docs/linting/Troubleshooting.mdx @@ -71,6 +71,42 @@ See our docs on [type aware linting](./Typed_Linting.mdx) for more information. You're using an outdated version of `@typescript-eslint/parser`. Update to the latest version to see a more informative version of this error message, explained [above](#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file 'backlink to I get errors telling me ESLint was configured to run ...'). +## How do I turn on a `@typescript-eslint` rule? + +First make sure you've read the docs and understand ESLint configuration files: + +- [Read our getting started guide](../Getting_Started.mdx) to ensure your config is properly setup to start configuring our rules. +- [Checkout ESLint's documentation on configuring rules](https://eslint.org/docs/latest/use/configure/rules) to ensure you understand how to configure rules. + +Our [rule docs](/rules) detail the options each rule supports under the "Options" heading. +We use TypeScript types to describe an `Options` tuple type for the rule which you can use to configure the a rule. +In your config file the keys of the `rules` object are the names of the rules you wish to configure and the values follow the following form: + +```ts +type Severity = 'off' | 'warn' | 'error'; +type RuleConfig = + | Severity + | [Severity] + | [ + Severiy, + // Options is the tuple type from the rule docs + ...Options, + ]; +``` + +Some examples + +```js title=".eslintrc.js" +module.exports = { + rules: { + // turns a rule on with no configuration (i.e. uses the default configuration) + '@typescript-eslint/array-type': 'error', + // turns on a rule with configuration + '@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }], + }, +}; +``` + ## I use a framework (like Vue) that requires custom file extensions, and I get errors like "You should add `parserOptions.extraFileExtensions` to your config" You can use `parserOptions.extraFileExtensions` to specify an array of non-TypeScript extensions to allow, for example: diff --git a/packages/eslint-plugin/src/rules/lines-around-comment.ts b/packages/eslint-plugin/src/rules/lines-around-comment.ts index a868b2a4510d..f7cdef33b2e4 100644 --- a/packages/eslint-plugin/src/rules/lines-around-comment.ts +++ b/packages/eslint-plugin/src/rules/lines-around-comment.ts @@ -52,87 +52,82 @@ export default util.createRule({ }, schema: [ { - type: 'array', - items: [ - { - type: 'object', - properties: { - beforeBlockComment: { - type: 'boolean', - default: true, - }, - afterBlockComment: { - type: 'boolean', - default: false, - }, - beforeLineComment: { - type: 'boolean', - default: false, - }, - afterLineComment: { - type: 'boolean', - default: false, - }, - allowBlockStart: { - type: 'boolean', - default: false, - }, - allowBlockEnd: { - type: 'boolean', - default: false, - }, - allowClassStart: { - type: 'boolean', - }, - allowClassEnd: { - type: 'boolean', - }, - allowObjectStart: { - type: 'boolean', - }, - allowObjectEnd: { - type: 'boolean', - }, - allowArrayStart: { - type: 'boolean', - }, - allowArrayEnd: { - type: 'boolean', - }, - allowInterfaceStart: { - type: 'boolean', - }, - allowInterfaceEnd: { - type: 'boolean', - }, - allowTypeStart: { - type: 'boolean', - }, - allowTypeEnd: { - type: 'boolean', - }, - allowEnumStart: { - type: 'boolean', - }, - allowEnumEnd: { - type: 'boolean', - }, - allowModuleStart: { - type: 'boolean', - }, - allowModuleEnd: { - type: 'boolean', - }, - ignorePattern: { - type: 'string', - }, - applyDefaultIgnorePatterns: { - type: 'boolean', - }, - }, - additionalProperties: false, + type: 'object', + properties: { + beforeBlockComment: { + type: 'boolean', + default: true, }, - ], + afterBlockComment: { + type: 'boolean', + default: false, + }, + beforeLineComment: { + type: 'boolean', + default: false, + }, + afterLineComment: { + type: 'boolean', + default: false, + }, + allowBlockStart: { + type: 'boolean', + default: false, + }, + allowBlockEnd: { + type: 'boolean', + default: false, + }, + allowClassStart: { + type: 'boolean', + }, + allowClassEnd: { + type: 'boolean', + }, + allowObjectStart: { + type: 'boolean', + }, + allowObjectEnd: { + type: 'boolean', + }, + allowArrayStart: { + type: 'boolean', + }, + allowArrayEnd: { + type: 'boolean', + }, + allowInterfaceStart: { + type: 'boolean', + }, + allowInterfaceEnd: { + type: 'boolean', + }, + allowTypeStart: { + type: 'boolean', + }, + allowTypeEnd: { + type: 'boolean', + }, + allowEnumStart: { + type: 'boolean', + }, + allowEnumEnd: { + type: 'boolean', + }, + allowModuleStart: { + type: 'boolean', + }, + allowModuleEnd: { + type: 'boolean', + }, + ignorePattern: { + type: 'string', + }, + applyDefaultIgnorePatterns: { + type: 'boolean', + }, + }, + additionalProperties: false, }, ], fixable: baseRule.meta.fixable, diff --git a/packages/eslint-plugin/tests/schema-snapshots/array-type.shot b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot index a401347dbe36..ba521b1c8351 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/array-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot @@ -7,7 +7,9 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { "$defs": { - "arrayOption": { "enum": ["array", "generic", "array-simple"] } + "arrayOption": { + "enum": ["array", "array-simple", "generic"] + } }, "properties": { "default": { diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot index 773c20007ce5..aa8b0accf801 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot @@ -9,24 +9,44 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "$defs": { "directiveConfigSchema": { "oneOf": [ - { "type": "boolean", "default": true }, - { "enum": ["allow-with-description"] }, { - "type": "object", - "properties": { "descriptionFormat": { "type": "string" } } + "default": true, + "type": "boolean" + }, + { + "enum": ["allow-with-description"] + }, + { + "properties": { + "descriptionFormat": { + "type": "string" + } + }, + "type": "object" } ] } }, + "additionalProperties": false, "properties": { - "ts-expect-error": { "$ref": "#/items/0/$defs/directiveConfigSchema" }, - "ts-ignore": { "$ref": "#/items/0/$defs/directiveConfigSchema" }, - "ts-nocheck": { "$ref": "#/items/0/$defs/directiveConfigSchema" }, - "ts-check": { "$ref": "#/items/0/$defs/directiveConfigSchema" }, - "minimumDescriptionLength": { "type": "number", "default": 3 } + "minimumDescriptionLength": { + "default": 3, + "type": "number" + }, + "ts-check": { + "$ref": "#/items/0/$defs/directiveConfigSchema" + }, + "ts-expect-error": { + "$ref": "#/items/0/$defs/directiveConfigSchema" + }, + "ts-ignore": { + "$ref": "#/items/0/$defs/directiveConfigSchema" + }, + "ts-nocheck": { + "$ref": "#/items/0/$defs/directiveConfigSchema" + } }, - "type": "object", - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot index f91d829e3631..8c024ea803a8 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot @@ -10,48 +10,52 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "banConfig": { "oneOf": [ { - "type": "null", - "description": "Bans the type with the default message" + "description": "Bans the type with the default message", + "type": "null" }, { - "enum": [false], - "description": "Un-bans the type (useful when paired with \`extendDefaults\`)" + "description": "Un-bans the type (useful when paired with \`extendDefaults\`)", + "enum": [false] }, { - "enum": [true], - "description": "Bans the type with the default message" + "description": "Bans the type with the default message", + "enum": [true] }, { - "type": "string", - "description": "Bans the type with a custom message" + "description": "Bans the type with a custom message", + "type": "string" }, { - "type": "object", + "additionalProperties": false, "description": "Bans a type", "properties": { - "message": { - "type": "string", - "description": "Custom error message" - }, "fixWith": { - "type": "string", - "description": "Type to autofix replace with." + "description": "Type to autofix replace with.", + "type": "string" + }, + "message": { + "description": "Custom error message", + "type": "string" } }, - "additionalProperties": false + "type": "object" } ] } }, - "type": "object", + "additionalProperties": false, "properties": { - "types": { - "type": "object", - "additionalProperties": { "$ref": "#/items/0/$defs/banConfig" } + "extendDefaults": { + "type": "boolean" }, - "extendDefaults": { "type": "boolean" } + "types": { + "additionalProperties": { + "$ref": "#/items/0/$defs/banConfig" + }, + "type": "object" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/block-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/block-spacing.shot index 247de3e16eb9..f36ea49fa82d 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/block-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/block-spacing.shot @@ -4,7 +4,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos " # SCHEMA: -[{ "enum": ["always", "never"] }] +[ + { + "enum": ["always", "never"] + } +] # TYPES: diff --git a/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot b/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot index 2bedea2433e0..1418bafb13e7 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot @@ -5,13 +5,18 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # SCHEMA: [ - { "enum": ["1tbs", "stroustrup", "allman"] }, { - "type": "object", + "enum": ["1tbs", "allman", "stroustrup"] + }, + { + "additionalProperties": false, "properties": { - "allowSingleLine": { "type": "boolean", "default": false } + "allowSingleLine": { + "default": false, + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/class-literal-property-style.shot b/packages/eslint-plugin/tests/schema-snapshots/class-literal-property-style.shot index 25b73d52301e..1bf67927f610 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/class-literal-property-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/class-literal-property-style.shot @@ -4,7 +4,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos " # SCHEMA: -[{ "enum": ["fields", "getters"] }] +[ + { + "enum": ["fields", "getters"] + } +] # TYPES: diff --git a/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot b/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot index 2a1d5ac03417..1c55c9db7486 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot @@ -7,41 +7,59 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos { "$defs": { "value": { - "enum": ["always-multiline", "always", "never", "only-multiline"] + "enum": ["always", "always-multiline", "never", "only-multiline"] }, "valueWithIgnore": { "enum": [ - "always-multiline", "always", + "always-multiline", + "ignore", "never", - "only-multiline", - "ignore" + "only-multiline" ] } }, - "type": "array", + "additionalProperties": false, "items": [ { "oneOf": [ - { "$ref": "#/$defs/value" }, { - "type": "object", + "$ref": "#/$defs/value" + }, + { + "additionalProperties": false, "properties": { - "arrays": { "$ref": "#/$defs/valueWithIgnore" }, - "objects": { "$ref": "#/$defs/valueWithIgnore" }, - "imports": { "$ref": "#/$defs/valueWithIgnore" }, - "exports": { "$ref": "#/$defs/valueWithIgnore" }, - "functions": { "$ref": "#/$defs/valueWithIgnore" }, - "enums": { "$ref": "#/$defs/valueWithIgnore" }, - "generics": { "$ref": "#/$defs/valueWithIgnore" }, - "tuples": { "$ref": "#/$defs/valueWithIgnore" } + "arrays": { + "$ref": "#/$defs/valueWithIgnore" + }, + "enums": { + "$ref": "#/$defs/valueWithIgnore" + }, + "exports": { + "$ref": "#/$defs/valueWithIgnore" + }, + "functions": { + "$ref": "#/$defs/valueWithIgnore" + }, + "generics": { + "$ref": "#/$defs/valueWithIgnore" + }, + "imports": { + "$ref": "#/$defs/valueWithIgnore" + }, + "objects": { + "$ref": "#/$defs/valueWithIgnore" + }, + "tuples": { + "$ref": "#/$defs/valueWithIgnore" + } }, - "additionalProperties": false + "type": "object" } ] } ], - "additionalProperties": false + "type": "array" } diff --git a/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot index 06e9745daaf1..5399369fee51 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot @@ -6,12 +6,18 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean", "default": false }, - "after": { "type": "boolean", "default": true } + "after": { + "default": true, + "type": "boolean" + }, + "before": { + "default": false, + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot index 4b15a352a583..540eea55862f 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot @@ -4,7 +4,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos " # SCHEMA: -[{ "enum": ["type-annotation", "constructor"] }] +[ + { + "enum": ["constructor", "type-annotation"] + } +] # TYPES: diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot index 9df574231d65..5befaa24e0c4 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot @@ -4,7 +4,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos " # SCHEMA: -[{ "enum": ["record", "index-signature"] }] +[ + { + "enum": ["index-signature", "record"] + } +] # TYPES: diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot index 3bba565566a7..c1505a43c05c 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot @@ -8,21 +8,27 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos { "oneOf": [ { - "type": "object", - "properties": { "assertionStyle": { "enum": ["never"] } }, "additionalProperties": false, - "required": ["assertionStyle"] + "properties": { + "assertionStyle": { + "enum": ["never"] + } + }, + "required": ["assertionStyle"], + "type": "object" }, { - "type": "object", + "additionalProperties": false, "properties": { - "assertionStyle": { "enum": ["as", "angle-bracket"] }, + "assertionStyle": { + "enum": ["angle-bracket", "as"] + }, "objectLiteralTypeAssertions": { "enum": ["allow", "allow-as-parameter", "never"] } }, - "additionalProperties": false, - "required": ["assertionStyle"] + "required": ["assertionStyle"], + "type": "object" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-definitions.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-definitions.shot index 39e80f8d4a97..130f2ac3c9cd 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-definitions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-definitions.shot @@ -4,7 +4,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos " # SCHEMA: -[{ "enum": ["interface", "type"] }] +[ + { + "enum": ["interface", "type"] + } +] # TYPES: diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot index 25760e3e56d2..1ad2d9511949 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot @@ -6,11 +6,13 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "fixMixedExportsWithInlineTypeSpecifier": { "type": "boolean" } + "fixMixedExportsWithInlineTypeSpecifier": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot index eecb93c7d315..4f8ad7949097 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot @@ -6,13 +6,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "prefer": { "enum": ["type-imports", "no-type-imports"] }, - "disallowTypeAnnotations": { "type": "boolean" }, - "fixStyle": { "enum": ["separate-type-imports", "inline-type-imports"] } + "disallowTypeAnnotations": { + "type": "boolean" + }, + "fixStyle": { + "enum": ["inline-type-imports", "separate-type-imports"] + }, + "prefer": { + "enum": ["no-type-imports", "type-imports"] + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot index 02bc24cea2bc..73c0dcdad74b 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot @@ -6,24 +6,30 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "allowKeywords": { "type": "boolean", "default": true }, - "allowPattern": { "type": "string", "default": "" }, + "allowIndexSignaturePropertyAccess": { + "default": false, + "type": "boolean" + }, + "allowKeywords": { + "default": true, + "type": "boolean" + }, + "allowPattern": { + "default": "", + "type": "string" + }, "allowPrivateClassPropertyAccess": { - "type": "boolean", - "default": false + "default": false, + "type": "boolean" }, "allowProtectedClassPropertyAccess": { - "type": "boolean", - "default": false - }, - "allowIndexSignaturePropertyAccess": { - "type": "boolean", - "default": false + "default": false, + "type": "boolean" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot index 9bb7806cf6e6..7723682bdaae 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot @@ -6,43 +6,45 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { "allowConciseArrowFunctionExpressionsStartingWithVoid": { "description": "Whether to allow arrow functions that start with the \`void\` keyword.", "type": "boolean" }, - "allowExpressions": { - "description": "Whether to ignore function expressions (functions which are not part of a declaration).", - "type": "boolean" - }, - "allowHigherOrderFunctions": { - "description": "Whether to ignore functions immediately returning another function expression.", + "allowDirectConstAssertionInArrowFunctions": { + "description": "Whether to ignore arrow functions immediately returning a \`as const\` value.", "type": "boolean" }, - "allowTypedFunctionExpressions": { - "description": "Whether to ignore type annotations on the variable of function expressions.", - "type": "boolean" + "allowedNames": { + "description": "An array of function/method names that will not have their arguments or return values checked.", + "items": { + "type": "string" + }, + "type": "array" }, - "allowDirectConstAssertionInArrowFunctions": { - "description": "Whether to ignore arrow functions immediately returning a \`as const\` value.", + "allowExpressions": { + "description": "Whether to ignore function expressions (functions which are not part of a declaration).", "type": "boolean" }, "allowFunctionsWithoutTypeParameters": { "description": "Whether to ignore functions that don't have generic type parameters.", "type": "boolean" }, - "allowedNames": { - "description": "An array of function/method names that will not have their arguments or return values checked.", - "items": { "type": "string" }, - "type": "array" + "allowHigherOrderFunctions": { + "description": "Whether to ignore functions immediately returning another function expression.", + "type": "boolean" }, "allowIIFEs": { "description": "Whether to ignore immediately invoked function expressions (IIFEs).", "type": "boolean" + }, + "allowTypedFunctionExpressions": { + "description": "Whether to ignore type annotations on the variable of function expressions.", + "type": "boolean" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot index c66c9e18b5fb..1c204208d747 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot @@ -10,39 +10,54 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "accessibilityLevel": { "oneOf": [ { - "enum": ["explicit"], - "description": "Always require an accessor." + "description": "Always require an accessor.", + "enum": ["explicit"] }, { - "enum": ["no-public"], - "description": "Require an accessor except when public." + "description": "Require an accessor except when public.", + "enum": ["no-public"] }, { - "enum": ["off"], - "description": "Never check whether there is an accessor." + "description": "Never check whether there is an accessor.", + "enum": ["off"] } ] } }, - "type": "object", + "additionalProperties": false, "properties": { - "accessibility": { "$ref": "#/items/0/$defs/accessibilityLevel" }, + "accessibility": { + "$ref": "#/items/0/$defs/accessibilityLevel" + }, + "ignoredMethodNames": { + "items": { + "type": "string" + }, + "type": "array" + }, "overrides": { - "type": "object", + "additionalProperties": false, "properties": { - "accessors": { "$ref": "#/items/0/$defs/accessibilityLevel" }, - "constructors": { "$ref": "#/items/0/$defs/accessibilityLevel" }, - "methods": { "$ref": "#/items/0/$defs/accessibilityLevel" }, - "properties": { "$ref": "#/items/0/$defs/accessibilityLevel" }, + "accessors": { + "$ref": "#/items/0/$defs/accessibilityLevel" + }, + "constructors": { + "$ref": "#/items/0/$defs/accessibilityLevel" + }, + "methods": { + "$ref": "#/items/0/$defs/accessibilityLevel" + }, "parameterProperties": { "$ref": "#/items/0/$defs/accessibilityLevel" + }, + "properties": { + "$ref": "#/items/0/$defs/accessibilityLevel" } }, - "additionalProperties": false - }, - "ignoredMethodNames": { "type": "array", "items": { "type": "string" } } + "type": "object" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot index 2976d3a3a643..b14497080b79 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot @@ -6,7 +6,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { "allowArgumentsExplicitlyTypedAsAny": { "description": "Whether to ignore arguments that are explicitly typed as \`any\`.", @@ -18,7 +18,9 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "allowedNames": { "description": "An array of function/method names that will not have their arguments or return values checked.", - "items": { "type": "string" }, + "items": { + "type": "string" + }, "type": "array" }, "allowHigherOrderFunctions": { @@ -30,7 +32,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "type": "boolean" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot index b121b71e7fad..2bbd7d74d020 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot @@ -7,23 +7,33 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos { "anyOf": [ { - "type": "array", - "items": [{ "enum": ["never"] }], + "items": [ + { + "enum": ["never"] + } + ], + "maxItems": 1, "minItems": 0, - "maxItems": 1 + "type": "array" }, { - "type": "array", "items": [ - { "enum": ["always"] }, { - "type": "object", - "properties": { "allowNewlines": { "type": "boolean" } }, - "additionalProperties": false + "enum": ["always"] + }, + { + "additionalProperties": false, + "properties": { + "allowNewlines": { + "type": "boolean" + } + }, + "type": "object" } ], + "maxItems": 2, "minItems": 0, - "maxItems": 2 + "type": "array" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot b/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot index 2ee376fd1ea2..51b5b96c84b7 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot @@ -7,23 +7,33 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos { "anyOf": [ { - "type": "array", - "items": [{ "enum": ["always"] }], + "items": [ + { + "enum": ["always"] + } + ], + "maxItems": 1, "minItems": 0, - "maxItems": 1 + "type": "array" }, { - "type": "array", "items": [ - { "enum": ["never"] }, { - "type": "object", - "properties": { "ignoreForLoopInit": { "type": "boolean" } }, - "additionalProperties": false + "enum": ["never"] + }, + { + "additionalProperties": false, + "properties": { + "ignoreForLoopInit": { + "type": "boolean" + } + }, + "type": "object" } ], + "maxItems": 2, "minItems": 0, - "maxItems": 2 + "type": "array" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot index 1637bc29cf7b..1295849a4b67 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot @@ -8,101 +8,159 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos { "anyOf": [ { - "type": "object", + "additionalProperties": false, "properties": { + "afterColon": { + "type": "boolean" + }, "align": { "anyOf": [ - { "enum": ["colon", "value"] }, { - "type": "object", + "enum": ["colon", "value"] + }, + { + "additionalProperties": false, "properties": { - "mode": { "enum": ["strict", "minimum"] }, - "on": { "enum": ["colon", "value"] }, - "beforeColon": { "type": "boolean" }, - "afterColon": { "type": "boolean" } + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + }, + "on": { + "enum": ["colon", "value"] + } }, - "additionalProperties": false + "type": "object" } ] }, - "mode": { "enum": ["strict", "minimum"] }, - "beforeColon": { "type": "boolean" }, - "afterColon": { "type": "boolean" } + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + } }, - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "properties": { - "singleLine": { - "type": "object", - "properties": { - "mode": { "enum": ["strict", "minimum"] }, - "beforeColon": { "type": "boolean" }, - "afterColon": { "type": "boolean" } - }, - "additionalProperties": false - }, "multiLine": { - "type": "object", + "additionalProperties": false, "properties": { + "afterColon": { + "type": "boolean" + }, "align": { "anyOf": [ - { "enum": ["colon", "value"] }, { - "type": "object", + "enum": ["colon", "value"] + }, + { + "additionalProperties": false, "properties": { - "mode": { "enum": ["strict", "minimum"] }, - "on": { "enum": ["colon", "value"] }, - "beforeColon": { "type": "boolean" }, - "afterColon": { "type": "boolean" } + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + }, + "on": { + "enum": ["colon", "value"] + } }, - "additionalProperties": false + "type": "object" } ] }, - "mode": { "enum": ["strict", "minimum"] }, - "beforeColon": { "type": "boolean" }, - "afterColon": { "type": "boolean" } + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + } }, - "additionalProperties": false + "type": "object" + }, + "singleLine": { + "additionalProperties": false, + "properties": { + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + } + }, + "type": "object" } }, - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "properties": { - "singleLine": { - "type": "object", + "align": { + "additionalProperties": false, "properties": { - "mode": { "enum": ["strict", "minimum"] }, - "beforeColon": { "type": "boolean" }, - "afterColon": { "type": "boolean" } + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + }, + "on": { + "enum": ["colon", "value"] + } }, - "additionalProperties": false + "type": "object" }, "multiLine": { - "type": "object", + "additionalProperties": false, "properties": { - "mode": { "enum": ["strict", "minimum"] }, - "beforeColon": { "type": "boolean" }, - "afterColon": { "type": "boolean" } + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + } }, - "additionalProperties": false + "type": "object" }, - "align": { - "type": "object", + "singleLine": { + "additionalProperties": false, "properties": { - "mode": { "enum": ["strict", "minimum"] }, - "on": { "enum": ["colon", "value"] }, - "beforeColon": { "type": "boolean" }, - "afterColon": { "type": "boolean" } + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + } }, - "additionalProperties": false + "type": "object" } }, - "additionalProperties": false + "type": "object" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot index 72a32c0b2cc8..1c0d3563df86 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot @@ -6,570 +6,852 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean", "default": true }, - "after": { "type": "boolean", "default": true }, + "after": { + "default": true, + "type": "boolean" + }, + "before": { + "default": true, + "type": "boolean" + }, "overrides": { - "type": "object", + "additionalProperties": false, "properties": { "abstract": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "as": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "async": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "await": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "boolean": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "break": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "byte": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "case": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "catch": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "char": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "class": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "const": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "continue": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "debugger": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "default": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "delete": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "do": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "double": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "else": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "enum": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "export": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "extends": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "false": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "final": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "finally": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "float": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "for": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "from": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "function": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "get": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "goto": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "if": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "implements": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "import": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "in": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "instanceof": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "int": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "interface": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "let": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "long": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "native": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "new": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "null": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "of": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "package": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "private": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "protected": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "public": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "return": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "set": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "short": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "static": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "super": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "switch": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "synchronized": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "this": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "throw": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "throws": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "transient": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "true": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "try": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" + }, + "type": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" }, "typeof": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "var": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "void": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "volatile": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "while": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "with": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "yield": { - "type": "object", - "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } - }, - "additionalProperties": false - }, - "type": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } }, - "additionalProperties": false + "type": "object" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot index 66fd3a4ae4eb..9a683cf8b25d 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot @@ -6,37 +6,82 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "array", - "items": [ - { - "type": "object", - "properties": { - "beforeBlockComment": { "type": "boolean", "default": true }, - "afterBlockComment": { "type": "boolean", "default": false }, - "beforeLineComment": { "type": "boolean", "default": false }, - "afterLineComment": { "type": "boolean", "default": false }, - "allowBlockStart": { "type": "boolean", "default": false }, - "allowBlockEnd": { "type": "boolean", "default": false }, - "allowClassStart": { "type": "boolean" }, - "allowClassEnd": { "type": "boolean" }, - "allowObjectStart": { "type": "boolean" }, - "allowObjectEnd": { "type": "boolean" }, - "allowArrayStart": { "type": "boolean" }, - "allowArrayEnd": { "type": "boolean" }, - "allowInterfaceStart": { "type": "boolean" }, - "allowInterfaceEnd": { "type": "boolean" }, - "allowTypeStart": { "type": "boolean" }, - "allowTypeEnd": { "type": "boolean" }, - "allowEnumStart": { "type": "boolean" }, - "allowEnumEnd": { "type": "boolean" }, - "allowModuleStart": { "type": "boolean" }, - "allowModuleEnd": { "type": "boolean" }, - "ignorePattern": { "type": "string" }, - "applyDefaultIgnorePatterns": { "type": "boolean" } - }, - "additionalProperties": false + "additionalProperties": false, + "properties": { + "afterBlockComment": { + "default": false, + "type": "boolean" + }, + "afterLineComment": { + "default": false, + "type": "boolean" + }, + "allowArrayEnd": { + "type": "boolean" + }, + "allowArrayStart": { + "type": "boolean" + }, + "allowBlockEnd": { + "default": false, + "type": "boolean" + }, + "allowBlockStart": { + "default": false, + "type": "boolean" + }, + "allowClassEnd": { + "type": "boolean" + }, + "allowClassStart": { + "type": "boolean" + }, + "allowEnumEnd": { + "type": "boolean" + }, + "allowEnumStart": { + "type": "boolean" + }, + "allowInterfaceEnd": { + "type": "boolean" + }, + "allowInterfaceStart": { + "type": "boolean" + }, + "allowModuleEnd": { + "type": "boolean" + }, + "allowModuleStart": { + "type": "boolean" + }, + "allowObjectEnd": { + "type": "boolean" + }, + "allowObjectStart": { + "type": "boolean" + }, + "allowTypeEnd": { + "type": "boolean" + }, + "allowTypeStart": { + "type": "boolean" + }, + "applyDefaultIgnorePatterns": { + "type": "boolean" + }, + "beforeBlockComment": { + "default": true, + "type": "boolean" + }, + "beforeLineComment": { + "default": false, + "type": "boolean" + }, + "ignorePattern": { + "type": "string" } - ] + }, + "type": "object" } ] @@ -44,33 +89,30 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = [ - | [] - | [ - { - afterBlockComment?: boolean; - afterLineComment?: boolean; - allowArrayEnd?: boolean; - allowArrayStart?: boolean; - allowBlockEnd?: boolean; - allowBlockStart?: boolean; - allowClassEnd?: boolean; - allowClassStart?: boolean; - allowEnumEnd?: boolean; - allowEnumStart?: boolean; - allowInterfaceEnd?: boolean; - allowInterfaceStart?: boolean; - allowModuleEnd?: boolean; - allowModuleStart?: boolean; - allowObjectEnd?: boolean; - allowObjectStart?: boolean; - allowTypeEnd?: boolean; - allowTypeStart?: boolean; - applyDefaultIgnorePatterns?: boolean; - beforeBlockComment?: boolean; - beforeLineComment?: boolean; - ignorePattern?: string; - }, - ], + { + afterBlockComment?: boolean; + afterLineComment?: boolean; + allowArrayEnd?: boolean; + allowArrayStart?: boolean; + allowBlockEnd?: boolean; + allowBlockStart?: boolean; + allowClassEnd?: boolean; + allowClassStart?: boolean; + allowEnumEnd?: boolean; + allowEnumStart?: boolean; + allowInterfaceEnd?: boolean; + allowInterfaceStart?: boolean; + allowModuleEnd?: boolean; + allowModuleStart?: boolean; + allowObjectEnd?: boolean; + allowObjectStart?: boolean; + allowTypeEnd?: boolean; + allowTypeStart?: boolean; + applyDefaultIgnorePatterns?: boolean; + beforeBlockComment?: boolean; + beforeLineComment?: boolean; + ignorePattern?: string; + }, ]; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot b/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot index 80c4750eb127..9e8924e05e83 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot @@ -5,14 +5,22 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # SCHEMA: [ - { "enum": ["always", "never"] }, { - "type": "object", + "enum": ["always", "never"] + }, + { + "additionalProperties": false, "properties": { - "exceptAfterSingleLine": { "type": "boolean", "default": false }, - "exceptAfterOverload": { "type": "boolean", "default": true } + "exceptAfterOverload": { + "default": true, + "type": "boolean" + }, + "exceptAfterSingleLine": { + "default": false, + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot b/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot index 2fa00bf1d208..9e19fee531bd 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot @@ -6,77 +6,103 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { "multiline": { - "type": "object", + "additionalProperties": false, "properties": { - "delimiter": { "enum": ["none", "semi", "comma"] }, - "requireLast": { "type": "boolean" } + "delimiter": { + "enum": ["comma", "none", "semi"] + }, + "requireLast": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, - "singleline": { - "type": "object", - "properties": { - "delimiter": { "enum": ["semi", "comma"] }, - "requireLast": { "type": "boolean" } - }, - "additionalProperties": false + "multilineDetection": { + "enum": ["brackets", "last-member"] }, "overrides": { - "type": "object", + "additionalProperties": false, "properties": { "interface": { - "type": "object", + "additionalProperties": false, "properties": { "multiline": { - "type": "object", + "additionalProperties": false, "properties": { - "delimiter": { "enum": ["none", "semi", "comma"] }, - "requireLast": { "type": "boolean" } + "delimiter": { + "enum": ["comma", "none", "semi"] + }, + "requireLast": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "singleline": { - "type": "object", + "additionalProperties": false, "properties": { - "delimiter": { "enum": ["semi", "comma"] }, - "requireLast": { "type": "boolean" } + "delimiter": { + "enum": ["comma", "semi"] + }, + "requireLast": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } }, - "additionalProperties": false + "type": "object" }, "typeLiteral": { - "type": "object", + "additionalProperties": false, "properties": { "multiline": { - "type": "object", + "additionalProperties": false, "properties": { - "delimiter": { "enum": ["none", "semi", "comma"] }, - "requireLast": { "type": "boolean" } + "delimiter": { + "enum": ["comma", "none", "semi"] + }, + "requireLast": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "singleline": { - "type": "object", + "additionalProperties": false, "properties": { - "delimiter": { "enum": ["semi", "comma"] }, - "requireLast": { "type": "boolean" } + "delimiter": { + "enum": ["comma", "semi"] + }, + "requireLast": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } }, - "additionalProperties": false + "type": "object" } }, - "additionalProperties": false + "type": "object" }, - "multilineDetection": { "enum": ["brackets", "last-member"] } + "singleline": { + "additionalProperties": false, + "properties": { + "delimiter": { + "enum": ["comma", "semi"] + }, + "requireLast": { + "type": "boolean" + } + }, + "type": "object" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot index a14e5e900388..483ea0bc2c3d 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot @@ -6,1960 +6,1990 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "default": { + "classes": { "oneOf": [ - { "type": "string", "enum": ["never"] }, { - "type": "array", + "enum": ["never"], + "type": "string" + }, + { "items": { "oneOf": [ { "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", - "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", - "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", - "private-decorated-readonly-field", - "private-static-readonly-field", - "private-instance-readonly-field", + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", "decorated-field", - "static-field", - "public-static-field", + "decorated-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", - "protected-decorated-field", - "protected-static-field", - "protected-instance-field", - "protected-abstract-field", - "private-field", + "instance-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", "private-decorated-field", - "private-static-field", + "private-decorated-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", "private-instance-field", - "#private-field", - "#private-static-field", - "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", - "abstract-method", - "public-abstract-method", - "protected-method", - "protected-decorated-method", - "protected-static-method", - "protected-instance-method", - "protected-abstract-method", + "private-instance-get", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", "private-method", - "private-decorated-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", "private-static-method", - "private-instance-method", - "#private-method", - "#private-static-method", - "#private-instance-method", - "call-signature", - "constructor", - "public-constructor", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", "protected-constructor", - "private-constructor", - "get", - "public-get", - "public-decorated-get", - "decorated-get", - "static-get", - "public-static-get", - "instance-get", - "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", + "protected-decorated-field", "protected-decorated-get", - "protected-static-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", "protected-instance-get", - "protected-abstract-get", - "private-get", - "private-decorated-get", - "private-static-get", - "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", - "public-set", - "public-decorated-set", - "decorated-set", - "static-set", - "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", "protected-set", - "protected-decorated-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", "protected-static-set", - "protected-instance-set", - "protected-abstract-set", - "private-set", - "private-decorated-set", - "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", - "public-static-static-initialization", - "instance-static-initialization", - "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", - "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", + "public-decorated-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", + "public-instance-get", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", + "public-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", + "public-static-set", + "public-static-static-initialization", + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" ] }, { - "type": "array", "items": { "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", - "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", - "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", - "private-decorated-readonly-field", - "private-static-readonly-field", - "private-instance-readonly-field", - "#private-readonly-field", - "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", - "decorated-field", - "static-field", - "public-static-field", - "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", - "protected-decorated-field", - "protected-static-field", - "protected-instance-field", - "protected-abstract-field", - "private-field", - "private-decorated-field", - "private-static-field", - "private-instance-field", "#private-field", - "#private-static-field", + "#private-get", "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", - "abstract-method", - "public-abstract-method", - "protected-method", - "protected-decorated-method", - "protected-static-method", - "protected-instance-method", - "protected-abstract-method", - "private-method", - "private-decorated-method", - "private-static-method", - "private-instance-method", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", "#private-method", + "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", "#private-static-method", - "#private-instance-method", + "#private-static-readonly-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", "call-signature", "constructor", - "public-constructor", - "protected-constructor", - "private-constructor", - "get", - "public-get", - "public-decorated-get", + "decorated-field", "decorated-get", - "static-get", - "public-static-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", + "instance-field", "instance-get", - "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", - "protected-decorated-get", - "protected-static-get", - "protected-instance-get", - "protected-abstract-get", - "private-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", + "private-decorated-field", "private-decorated-get", - "private-static-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", + "private-instance-field", "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", - "public-set", - "public-decorated-set", - "decorated-set", - "static-set", - "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", - "protected-set", - "protected-decorated-set", - "protected-static-set", - "protected-instance-set", - "protected-abstract-set", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", + "private-method", + "private-readonly-field", "private-set", - "private-decorated-set", + "private-static-field", + "private-static-get", + "private-static-method", + "private-static-readonly-field", "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", - "public-static-static-initialization", - "instance-static-initialization", - "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", - "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", + "protected-constructor", + "protected-decorated-field", + "protected-decorated-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", + "protected-instance-get", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", + "protected-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", + "protected-static-set", + "protected-static-static-initialization", + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", + "public-decorated-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", + "public-instance-get", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", + "public-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", + "public-static-set", + "public-static-static-initialization", + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" ] - } + }, + "type": "array" } ] - } + }, + "type": "array" }, { - "type": "object", + "additionalProperties": false, "properties": { "memberTypes": { "oneOf": [ { - "type": "array", "items": { "oneOf": [ { "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", - "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", - "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", - "private-decorated-readonly-field", - "private-static-readonly-field", - "private-instance-readonly-field", + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", - "decorated-field", - "static-field", - "public-static-field", - "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", - "protected-decorated-field", - "protected-static-field", - "protected-instance-field", - "protected-abstract-field", - "private-field", - "private-decorated-field", - "private-static-field", - "private-instance-field", - "#private-field", - "#private-static-field", - "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", "abstract-method", - "public-abstract-method", - "protected-method", - "protected-decorated-method", - "protected-static-method", - "protected-instance-method", - "protected-abstract-method", - "private-method", - "private-decorated-method", - "private-static-method", - "private-instance-method", - "#private-method", - "#private-static-method", - "#private-instance-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", "call-signature", "constructor", - "public-constructor", - "protected-constructor", - "private-constructor", - "get", - "public-get", - "public-decorated-get", + "decorated-field", "decorated-get", - "static-get", - "public-static-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", + "instance-field", "instance-get", - "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", - "protected-decorated-get", - "protected-static-get", - "protected-instance-get", - "protected-abstract-get", - "private-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", + "private-decorated-field", "private-decorated-get", - "private-static-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", + "private-instance-field", "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", - "public-set", - "public-decorated-set", - "decorated-set", - "static-set", - "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", - "protected-set", - "protected-decorated-set", - "protected-static-set", - "protected-instance-set", - "protected-abstract-set", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", + "private-method", + "private-readonly-field", "private-set", - "private-decorated-set", + "private-static-field", + "private-static-get", + "private-static-method", + "private-static-readonly-field", "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", - "public-static-static-initialization", - "instance-static-initialization", - "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", - "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", + "protected-constructor", + "protected-decorated-field", + "protected-decorated-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", + "protected-instance-get", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", + "protected-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", + "protected-static-set", + "protected-static-static-initialization", + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", + "public-decorated-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", + "public-instance-get", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", + "public-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", + "public-static-set", + "public-static-static-initialization", + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" ] }, { - "type": "array", "items": { "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", - "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", - "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", - "private-decorated-readonly-field", - "private-static-readonly-field", - "private-instance-readonly-field", + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", "decorated-field", - "static-field", - "public-static-field", + "decorated-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", - "protected-decorated-field", - "protected-static-field", - "protected-instance-field", - "protected-abstract-field", - "private-field", + "instance-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", "private-decorated-field", - "private-static-field", + "private-decorated-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", "private-instance-field", - "#private-field", - "#private-static-field", - "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", - "abstract-method", - "public-abstract-method", - "protected-method", - "protected-decorated-method", - "protected-static-method", - "protected-instance-method", - "protected-abstract-method", + "private-instance-get", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", "private-method", - "private-decorated-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", "private-static-method", - "private-instance-method", - "#private-method", - "#private-static-method", - "#private-instance-method", - "call-signature", - "constructor", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", + "protected-constructor", + "protected-decorated-field", + "protected-decorated-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", + "protected-instance-get", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", + "protected-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", + "protected-static-set", + "protected-static-static-initialization", + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", "public-constructor", - "protected-constructor", - "private-constructor", - "get", - "public-get", + "public-decorated-field", "public-decorated-get", - "decorated-get", - "static-get", - "public-static-get", - "instance-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", - "protected-decorated-get", - "protected-static-get", - "protected-instance-get", - "protected-abstract-get", - "private-get", - "private-decorated-get", - "private-static-get", - "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", "public-set", - "public-decorated-set", - "decorated-set", - "static-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", - "protected-set", - "protected-decorated-set", - "protected-static-set", - "protected-instance-set", - "protected-abstract-set", - "private-set", - "private-decorated-set", - "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", "public-static-static-initialization", - "instance-static-initialization", - "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", - "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", - "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" ] - } + }, + "type": "array" } ] - } + }, + "type": "array" }, - { "type": "string", "enum": ["never"] } + { + "enum": ["never"], + "type": "string" + } ] }, + "optionalityOrder": { + "enum": ["optional-first", "required-first"], + "type": "string" + }, "order": { - "type": "string", "enum": [ "alphabetically", "alphabetically-case-insensitive", "as-written", "natural", "natural-case-insensitive" - ] - }, - "optionalityOrder": { - "type": "string", - "enum": ["optional-first", "required-first"] + ], + "type": "string" } }, - "additionalProperties": false + "type": "object" } ] }, - "classes": { + "classExpressions": { "oneOf": [ - { "type": "string", "enum": ["never"] }, { - "type": "array", + "enum": ["never"], + "type": "string" + }, + { "items": { "oneOf": [ { "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", - "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", - "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", - "private-decorated-readonly-field", - "private-static-readonly-field", - "private-instance-readonly-field", + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", "decorated-field", - "static-field", - "public-static-field", + "decorated-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", - "protected-decorated-field", - "protected-static-field", - "protected-instance-field", - "protected-abstract-field", - "private-field", + "instance-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", "private-decorated-field", - "private-static-field", + "private-decorated-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", "private-instance-field", - "#private-field", - "#private-static-field", - "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", - "abstract-method", - "public-abstract-method", - "protected-method", - "protected-decorated-method", - "protected-static-method", - "protected-instance-method", - "protected-abstract-method", + "private-instance-get", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", "private-method", - "private-decorated-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", "private-static-method", - "private-instance-method", - "#private-method", - "#private-static-method", - "#private-instance-method", - "call-signature", - "constructor", - "public-constructor", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", "protected-constructor", - "private-constructor", - "get", - "public-get", + "protected-decorated-field", + "protected-decorated-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", + "protected-instance-get", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", + "protected-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", + "protected-static-set", + "protected-static-static-initialization", + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", "public-decorated-get", - "decorated-get", - "static-get", - "public-static-get", - "instance-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", - "protected-decorated-get", - "protected-static-get", - "protected-instance-get", - "protected-abstract-get", - "private-get", - "private-decorated-get", - "private-static-get", - "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", "public-set", - "public-decorated-set", - "decorated-set", - "static-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", - "protected-set", - "protected-decorated-set", - "protected-static-set", - "protected-instance-set", - "protected-abstract-set", - "private-set", - "private-decorated-set", - "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", "public-static-static-initialization", - "instance-static-initialization", - "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", - "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", - "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" ] }, { - "type": "array", "items": { "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", - "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", - "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", - "private-decorated-readonly-field", - "private-static-readonly-field", - "private-instance-readonly-field", + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", "decorated-field", - "static-field", - "public-static-field", + "decorated-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", - "protected-decorated-field", - "protected-static-field", - "protected-instance-field", - "protected-abstract-field", - "private-field", + "instance-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", "private-decorated-field", - "private-static-field", + "private-decorated-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", "private-instance-field", - "#private-field", - "#private-static-field", - "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", - "abstract-method", - "public-abstract-method", - "protected-method", - "protected-decorated-method", - "protected-static-method", - "protected-instance-method", - "protected-abstract-method", + "private-instance-get", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", "private-method", - "private-decorated-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", "private-static-method", - "private-instance-method", - "#private-method", - "#private-static-method", - "#private-instance-method", - "call-signature", - "constructor", - "public-constructor", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", "protected-constructor", - "private-constructor", - "get", - "public-get", - "public-decorated-get", - "decorated-get", - "static-get", - "public-static-get", - "instance-get", - "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", + "protected-decorated-field", "protected-decorated-get", - "protected-static-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", "protected-instance-get", - "protected-abstract-get", - "private-get", - "private-decorated-get", - "private-static-get", - "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", + "protected-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", + "protected-static-set", + "protected-static-static-initialization", + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", + "public-decorated-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", + "public-instance-get", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", "public-set", - "public-decorated-set", - "decorated-set", - "static-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", - "protected-set", - "protected-decorated-set", - "protected-static-set", - "protected-instance-set", - "protected-abstract-set", - "private-set", - "private-decorated-set", - "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", "public-static-static-initialization", - "instance-static-initialization", - "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", - "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", - "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" ] - } + }, + "type": "array" } ] - } + }, + "type": "array" }, { - "type": "object", + "additionalProperties": false, "properties": { "memberTypes": { "oneOf": [ { - "type": "array", "items": { "oneOf": [ { "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", - "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", - "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", - "private-decorated-readonly-field", - "private-static-readonly-field", - "private-instance-readonly-field", + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", "decorated-field", - "static-field", - "public-static-field", + "decorated-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", - "protected-decorated-field", - "protected-static-field", - "protected-instance-field", - "protected-abstract-field", - "private-field", + "instance-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", "private-decorated-field", - "private-static-field", + "private-decorated-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", "private-instance-field", - "#private-field", - "#private-static-field", - "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", - "abstract-method", - "public-abstract-method", - "protected-method", - "protected-decorated-method", - "protected-static-method", - "protected-instance-method", - "protected-abstract-method", + "private-instance-get", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", "private-method", - "private-decorated-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", "private-static-method", - "private-instance-method", - "#private-method", - "#private-static-method", - "#private-instance-method", - "call-signature", - "constructor", - "public-constructor", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", "protected-constructor", - "private-constructor", - "get", - "public-get", - "public-decorated-get", - "decorated-get", - "static-get", - "public-static-get", - "instance-get", - "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", + "protected-decorated-field", "protected-decorated-get", - "protected-static-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", "protected-instance-get", - "protected-abstract-get", - "private-get", - "private-decorated-get", - "private-static-get", - "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", - "public-set", - "public-decorated-set", - "decorated-set", - "static-set", - "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", "protected-set", - "protected-decorated-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", "protected-static-set", - "protected-instance-set", - "protected-abstract-set", - "private-set", - "private-decorated-set", - "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", - "public-static-static-initialization", - "instance-static-initialization", + "protected-static-static-initialization", + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", + "public-decorated-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", + "public-instance-get", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", - "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", - "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" + "public-method", + "public-readonly-field", + "public-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", + "public-static-set", + "public-static-static-initialization", + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" ] }, { - "type": "array", "items": { "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", - "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", - "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", - "private-decorated-readonly-field", - "private-static-readonly-field", - "private-instance-readonly-field", + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", "decorated-field", - "static-field", - "public-static-field", + "decorated-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", - "protected-decorated-field", - "protected-static-field", - "protected-instance-field", - "protected-abstract-field", - "private-field", + "instance-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", "private-decorated-field", - "private-static-field", + "private-decorated-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", "private-instance-field", - "#private-field", - "#private-static-field", - "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", - "abstract-method", - "public-abstract-method", - "protected-method", - "protected-decorated-method", - "protected-static-method", - "protected-instance-method", - "protected-abstract-method", + "private-instance-get", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", "private-method", - "private-decorated-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", "private-static-method", - "private-instance-method", - "#private-method", - "#private-static-method", - "#private-instance-method", - "call-signature", - "constructor", - "public-constructor", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", "protected-constructor", - "private-constructor", - "get", - "public-get", - "public-decorated-get", - "decorated-get", - "static-get", - "public-static-get", - "instance-get", - "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", + "protected-decorated-field", "protected-decorated-get", - "protected-static-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", "protected-instance-get", - "protected-abstract-get", - "private-get", - "private-decorated-get", - "private-static-get", - "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", - "public-set", - "public-decorated-set", - "decorated-set", - "static-set", - "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", "protected-set", - "protected-decorated-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", "protected-static-set", - "protected-instance-set", - "protected-abstract-set", - "private-set", - "private-decorated-set", - "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", - "public-static-static-initialization", - "instance-static-initialization", - "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", - "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", + "public-decorated-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", + "public-instance-get", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", + "public-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", + "public-static-set", + "public-static-static-initialization", + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" ] - } + }, + "type": "array" } ] - } + }, + "type": "array" }, - { "type": "string", "enum": ["never"] } + { + "enum": ["never"], + "type": "string" + } ] }, + "optionalityOrder": { + "enum": ["optional-first", "required-first"], + "type": "string" + }, "order": { - "type": "string", "enum": [ "alphabetically", "alphabetically-case-insensitive", "as-written", "natural", "natural-case-insensitive" - ] - }, - "optionalityOrder": { - "type": "string", - "enum": ["optional-first", "required-first"] + ], + "type": "string" } }, - "additionalProperties": false + "type": "object" } ] }, - "classExpressions": { + "default": { "oneOf": [ - { "type": "string", "enum": ["never"] }, { - "type": "array", + "enum": ["never"], + "type": "string" + }, + { "items": { "oneOf": [ { "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", - "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", - "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", - "private-decorated-readonly-field", - "private-static-readonly-field", - "private-instance-readonly-field", + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", "decorated-field", - "static-field", - "public-static-field", + "decorated-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", - "protected-decorated-field", - "protected-static-field", - "protected-instance-field", - "protected-abstract-field", - "private-field", + "instance-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", "private-decorated-field", - "private-static-field", + "private-decorated-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", "private-instance-field", - "#private-field", - "#private-static-field", - "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", - "abstract-method", - "public-abstract-method", - "protected-method", - "protected-decorated-method", - "protected-static-method", - "protected-instance-method", - "protected-abstract-method", + "private-instance-get", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", "private-method", - "private-decorated-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", "private-static-method", - "private-instance-method", - "#private-method", - "#private-static-method", - "#private-instance-method", - "call-signature", - "constructor", - "public-constructor", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", "protected-constructor", - "private-constructor", - "get", - "public-get", - "public-decorated-get", - "decorated-get", - "static-get", - "public-static-get", - "instance-get", - "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", + "protected-decorated-field", "protected-decorated-get", - "protected-static-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", "protected-instance-get", - "protected-abstract-get", - "private-get", - "private-decorated-get", - "private-static-get", - "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", - "public-set", - "public-decorated-set", - "decorated-set", - "static-set", - "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", "protected-set", - "protected-decorated-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", "protected-static-set", - "protected-instance-set", - "protected-abstract-set", - "private-set", - "private-decorated-set", - "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", - "public-static-static-initialization", - "instance-static-initialization", - "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", - "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" - ] - }, - { - "type": "array", - "items": { - "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", - "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", - "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", - "private-decorated-readonly-field", - "private-static-readonly-field", - "private-instance-readonly-field", + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", + "public-decorated-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", + "public-instance-get", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", + "public-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", + "public-static-set", + "public-static-static-initialization", + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" + ] + }, + { + "items": { + "enum": [ + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", "decorated-field", - "static-field", - "public-static-field", + "decorated-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", - "protected-decorated-field", - "protected-static-field", - "protected-instance-field", - "protected-abstract-field", - "private-field", + "instance-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", "private-decorated-field", - "private-static-field", + "private-decorated-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", "private-instance-field", - "#private-field", - "#private-static-field", - "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", - "abstract-method", - "public-abstract-method", - "protected-method", - "protected-decorated-method", - "protected-static-method", - "protected-instance-method", - "protected-abstract-method", + "private-instance-get", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", "private-method", - "private-decorated-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", "private-static-method", - "private-instance-method", - "#private-method", - "#private-static-method", - "#private-instance-method", - "call-signature", - "constructor", - "public-constructor", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", "protected-constructor", - "private-constructor", - "get", - "public-get", - "public-decorated-get", - "decorated-get", - "static-get", - "public-static-get", - "instance-get", - "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", + "protected-decorated-field", "protected-decorated-get", - "protected-static-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", "protected-instance-get", - "protected-abstract-get", - "private-get", - "private-decorated-get", - "private-static-get", - "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", - "public-set", - "public-decorated-set", - "decorated-set", - "static-set", - "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", "protected-set", - "protected-decorated-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", "protected-static-set", - "protected-instance-set", - "protected-abstract-set", - "private-set", - "private-decorated-set", - "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", - "public-static-static-initialization", - "instance-static-initialization", - "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", - "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", + "public-decorated-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", + "public-instance-get", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", + "public-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", + "public-static-set", + "public-static-static-initialization", + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" ] - } + }, + "type": "array" } ] - } + }, + "type": "array" }, { - "type": "object", + "additionalProperties": false, "properties": { "memberTypes": { "oneOf": [ { - "type": "array", "items": { "oneOf": [ { "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", - "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", - "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", - "private-decorated-readonly-field", - "private-static-readonly-field", - "private-instance-readonly-field", + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", "decorated-field", - "static-field", - "public-static-field", + "decorated-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", - "protected-decorated-field", - "protected-static-field", - "protected-instance-field", - "protected-abstract-field", - "private-field", + "instance-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", "private-decorated-field", - "private-static-field", + "private-decorated-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", "private-instance-field", - "#private-field", - "#private-static-field", - "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", - "abstract-method", - "public-abstract-method", - "protected-method", - "protected-decorated-method", - "protected-static-method", - "protected-instance-method", - "protected-abstract-method", + "private-instance-get", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", "private-method", - "private-decorated-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", "private-static-method", - "private-instance-method", - "#private-method", - "#private-static-method", - "#private-instance-method", - "call-signature", - "constructor", - "public-constructor", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", "protected-constructor", - "private-constructor", - "get", - "public-get", - "public-decorated-get", - "decorated-get", - "static-get", - "public-static-get", - "instance-get", - "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", + "protected-decorated-field", "protected-decorated-get", - "protected-static-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", "protected-instance-get", - "protected-abstract-get", - "private-get", - "private-decorated-get", - "private-static-get", - "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", - "public-set", - "public-decorated-set", - "decorated-set", - "static-set", - "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", "protected-set", - "protected-decorated-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", "protected-static-set", - "protected-instance-set", - "protected-abstract-set", - "private-set", - "private-decorated-set", - "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", - "public-static-static-initialization", - "instance-static-initialization", - "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", - "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", + "public-decorated-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", + "public-instance-get", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", + "public-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", + "public-static-set", + "public-static-static-initialization", + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" ] }, { - "type": "array", "items": { "enum": [ - "readonly-signature", - "signature", - "readonly-field", - "public-readonly-field", - "public-decorated-readonly-field", + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", + "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", + "#private-static-readonly-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", + "decorated-field", + "decorated-get", + "decorated-method", "decorated-readonly-field", - "static-readonly-field", - "public-static-readonly-field", + "decorated-set", + "field", + "get", + "instance-field", + "instance-get", + "instance-method", "instance-readonly-field", - "public-instance-readonly-field", - "abstract-readonly-field", - "public-abstract-readonly-field", - "protected-readonly-field", - "protected-decorated-readonly-field", - "protected-static-readonly-field", - "protected-instance-readonly-field", - "protected-abstract-readonly-field", - "private-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", + "private-decorated-field", + "private-decorated-get", + "private-decorated-method", "private-decorated-readonly-field", - "private-static-readonly-field", + "private-decorated-set", + "private-field", + "private-get", + "private-instance-field", + "private-instance-get", + "private-instance-method", "private-instance-readonly-field", - "#private-readonly-field", - "#private-static-readonly-field", - "#private-instance-readonly-field", - "field", - "public-field", - "public-decorated-field", - "decorated-field", - "static-field", - "public-static-field", - "instance-field", - "public-instance-field", - "abstract-field", - "public-abstract-field", - "protected-field", + "private-instance-set", + "private-instance-static-initialization", + "private-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", + "private-static-method", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", + "protected-constructor", "protected-decorated-field", - "protected-static-field", + "protected-decorated-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", "protected-instance-field", - "protected-abstract-field", - "private-field", - "private-decorated-field", - "private-static-field", - "private-instance-field", - "#private-field", - "#private-static-field", - "#private-instance-field", - "method", - "public-method", - "public-decorated-method", - "decorated-method", - "static-method", - "public-static-method", - "instance-method", - "public-instance-method", - "abstract-method", - "public-abstract-method", + "protected-instance-get", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", "protected-method", - "protected-decorated-method", + "protected-readonly-field", + "protected-set", + "protected-static-field", + "protected-static-get", "protected-static-method", - "protected-instance-method", - "protected-abstract-method", - "private-method", - "private-decorated-method", - "private-static-method", - "private-instance-method", - "#private-method", - "#private-static-method", - "#private-instance-method", - "call-signature", - "constructor", + "protected-static-readonly-field", + "protected-static-set", + "protected-static-static-initialization", + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", "public-constructor", - "protected-constructor", - "private-constructor", - "get", - "public-get", + "public-decorated-field", "public-decorated-get", - "decorated-get", - "static-get", - "public-static-get", - "instance-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", "public-instance-get", - "abstract-get", - "public-abstract-get", - "protected-get", - "protected-decorated-get", - "protected-static-get", - "protected-instance-get", - "protected-abstract-get", - "private-get", - "private-decorated-get", - "private-static-get", - "private-instance-get", - "#private-get", - "#private-static-get", - "#private-instance-get", - "set", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", "public-set", - "public-decorated-set", - "decorated-set", - "static-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", "public-static-set", - "instance-set", - "public-instance-set", - "abstract-set", - "public-abstract-set", - "protected-set", - "protected-decorated-set", - "protected-static-set", - "protected-instance-set", - "protected-abstract-set", - "private-set", - "private-decorated-set", - "private-static-set", - "private-instance-set", - "#private-set", - "#private-static-set", - "#private-instance-set", - "static-initialization", - "static-static-initialization", "public-static-static-initialization", - "instance-static-initialization", - "public-instance-static-initialization", - "abstract-static-initialization", - "public-abstract-static-initialization", - "protected-static-static-initialization", - "protected-instance-static-initialization", - "protected-abstract-static-initialization", - "private-static-static-initialization", - "private-instance-static-initialization", - "#private-static-static-initialization", - "#private-instance-static-initialization" + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" ] - } + }, + "type": "array" } ] - } + }, + "type": "array" }, - { "type": "string", "enum": ["never"] } + { + "enum": ["never"], + "type": "string" + } ] }, + "optionalityOrder": { + "enum": ["optional-first", "required-first"], + "type": "string" + }, "order": { - "type": "string", "enum": [ "alphabetically", "alphabetically-case-insensitive", "as-written", "natural", "natural-case-insensitive" - ] - }, - "optionalityOrder": { - "type": "string", - "enum": ["optional-first", "required-first"] + ], + "type": "string" } }, - "additionalProperties": false + "type": "object" } ] }, "interfaces": { "oneOf": [ - { "type": "string", "enum": ["never"] }, { - "type": "array", + "enum": ["never"], + "type": "string" + }, + { "items": { "oneOf": [ { "enum": [ - "readonly-signature", - "signature", - "readonly-field", + "constructor", "field", "method", - "constructor" + "readonly-field", + "readonly-signature", + "signature" ] }, { - "type": "array", "items": { "enum": [ - "readonly-signature", - "signature", - "readonly-field", + "constructor", "field", "method", - "constructor" + "readonly-field", + "readonly-signature", + "signature" ] - } + }, + "type": "array" } ] - } + }, + "type": "array" }, { - "type": "object", + "additionalProperties": false, "properties": { "memberTypes": { "oneOf": [ { - "type": "array", "items": { "oneOf": [ { "enum": [ - "readonly-signature", - "signature", - "readonly-field", + "constructor", "field", "method", - "constructor" + "readonly-field", + "readonly-signature", + "signature" ] }, { - "type": "array", "items": { "enum": [ - "readonly-signature", - "signature", - "readonly-field", + "constructor", "field", "method", - "constructor" + "readonly-field", + "readonly-signature", + "signature" ] - } + }, + "type": "array" } ] - } + }, + "type": "array" }, - { "type": "string", "enum": ["never"] } + { + "enum": ["never"], + "type": "string" + } ] }, + "optionalityOrder": { + "enum": ["optional-first", "required-first"], + "type": "string" + }, "order": { - "type": "string", "enum": [ "alphabetically", "alphabetically-case-insensitive", "as-written", "natural", "natural-case-insensitive" - ] - }, - "optionalityOrder": { - "type": "string", - "enum": ["optional-first", "required-first"] + ], + "type": "string" } }, - "additionalProperties": false + "type": "object" } ] }, "typeLiterals": { "oneOf": [ - { "type": "string", "enum": ["never"] }, { - "type": "array", + "enum": ["never"], + "type": "string" + }, + { "items": { "oneOf": [ { "enum": [ - "readonly-signature", - "signature", - "readonly-field", + "constructor", "field", "method", - "constructor" + "readonly-field", + "readonly-signature", + "signature" ] }, { - "type": "array", "items": { "enum": [ - "readonly-signature", - "signature", - "readonly-field", + "constructor", "field", "method", - "constructor" + "readonly-field", + "readonly-signature", + "signature" ] - } + }, + "type": "array" } ] - } + }, + "type": "array" }, { - "type": "object", + "additionalProperties": false, "properties": { "memberTypes": { "oneOf": [ { - "type": "array", "items": { "oneOf": [ { "enum": [ - "readonly-signature", - "signature", - "readonly-field", + "constructor", "field", "method", - "constructor" + "readonly-field", + "readonly-signature", + "signature" ] }, { - "type": "array", "items": { "enum": [ - "readonly-signature", - "signature", - "readonly-field", + "constructor", "field", "method", - "constructor" + "readonly-field", + "readonly-signature", + "signature" ] - } + }, + "type": "array" } ] - } + }, + "type": "array" }, - { "type": "string", "enum": ["never"] } + { + "enum": ["never"], + "type": "string" + } ] }, + "optionalityOrder": { + "enum": ["optional-first", "required-first"], + "type": "string" + }, "order": { - "type": "string", "enum": [ "alphabetically", "alphabetically-case-insensitive", "as-written", "natural", "natural-case-insensitive" - ] - }, - "optionalityOrder": { - "type": "string", - "enum": ["optional-first", "required-first"] + ], + "type": "string" } }, - "additionalProperties": false + "type": "object" } ] } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot b/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot index 2be8f8ad3a68..d03573a08981 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot @@ -4,7 +4,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos " # SCHEMA: -[{ "enum": ["property", "method"] }] +[ + { + "enum": ["method", "property"] + } +] # TYPES: diff --git a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot index 08a8f7df15cd..fe9823571782 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot @@ -6,930 +6,1511 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos { "$defs": { - "underscoreOptions": { - "type": "string", - "enum": [ - "forbid", - "allow", - "require", - "requireDouble", - "allowDouble", - "allowSingleOrDouble" + "formatOptionsConfig": { + "oneOf": [ + { + "additionalItems": false, + "items": { + "$ref": "#/$defs/predefinedFormats" + }, + "type": "array" + }, + { + "type": "null" + } ] }, + "matchRegexConfig": { + "properties": { + "match": { + "type": "boolean" + }, + "regex": { + "type": "string" + } + }, + "required": ["match", "regex"], + "type": "object" + }, "predefinedFormats": { - "type": "string", "enum": [ - "camelCase", - "strictCamelCase", "PascalCase", "StrictPascalCase", + "UPPER_CASE", + "camelCase", "snake_case", - "UPPER_CASE" - ] - }, - "typeModifiers": { - "type": "string", - "enum": ["boolean", "string", "number", "function", "array"] + "strictCamelCase" + ], + "type": "string" }, "prefixSuffixConfig": { - "type": "array", - "items": { "type": "string", "minLength": 1 }, - "additionalItems": false - }, - "matchRegexConfig": { - "type": "object", - "properties": { - "match": { "type": "boolean" }, - "regex": { "type": "string" } + "additionalItems": false, + "items": { + "minLength": 1, + "type": "string" }, - "required": ["match", "regex"] + "type": "array" }, - "formatOptionsConfig": { - "oneOf": [ - { - "type": "array", - "items": { "$ref": "#/$defs/predefinedFormats" }, - "additionalItems": false - }, - { "type": "null" } - ] + "typeModifiers": { + "enum": ["array", "boolean", "function", "number", "string"], + "type": "string" + }, + "underscoreOptions": { + "enum": [ + "allow", + "allowDouble", + "allowSingleOrDouble", + "forbid", + "require", + "requireDouble" + ], + "type": "string" } }, - "type": "array", + "additionalItems": false, "items": { "oneOf": [ { - "type": "object", + "additionalProperties": false, "description": "Multiple selectors in one config", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "#private", + "abstract", + "async", + "const", + "destructured", + "exported", + "global", + "override", + "private", + "protected", + "public", + "readonly", + "requiresQuotes", + "static", + "unused" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, "selector": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", "enum": [ + "accessor", + "class", + "classMethod", + "classProperty", "default", - "variableLike", + "enum", + "enumMember", + "function", + "interface", "memberLike", - "typeLike", "method", - "property", - "variable", - "function", + "objectLiteralMethod", + "objectLiteralProperty", "parameter", "parameterProperty", - "accessor", - "enumMember", - "classMethod", - "objectLiteralMethod", + "property", + "typeAlias", + "typeLike", "typeMethod", - "classProperty", - "objectLiteralProperty", + "typeParameter", "typeProperty", - "class", - "interface", - "typeAlias", - "enum", - "typeParameter" - ] + "variable", + "variableLike" + ], + "type": "string" }, - "additionalItems": false + "type": "array" }, - "modifiers": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "const", - "readonly", - "static", - "public", - "protected", - "private", - "#private", - "abstract", - "destructured", - "global", - "exported", - "unused", - "requiresQuotes", - "override", - "async" - ] - }, - "additionalItems": false + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" }, "types": { - "type": "array", - "items": { "$ref": "#/$defs/typeModifiers" }, - "additionalItems": false + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'default'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["default"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", "enum": [ - "const", - "readonly", - "static", - "public", - "protected", - "private", "#private", "abstract", + "async", + "const", "destructured", - "global", "exported", - "unused", - "requiresQuotes", + "global", "override", - "async" - ] + "private", + "protected", + "public", + "readonly", + "requiresQuotes", + "static", + "unused" + ], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["default"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'variableLike'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["variableLike"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", - "items": { "type": "string", "enum": ["unused", "async"] }, - "additionalItems": false + "additionalItems": false, + "items": { + "enum": ["async", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["variableLike"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'variable'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["variable"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", "enum": [ + "async", "const", "destructured", "exported", "global", - "unused", - "async" - ] + "unused" + ], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["variable"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" }, "types": { - "type": "array", - "items": { "$ref": "#/$defs/typeModifiers" }, - "additionalItems": false + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'function'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["function"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", - "enum": ["exported", "global", "unused", "async"] + "enum": ["async", "exported", "global", "unused"], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["function"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'parameter'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["parameter"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", - "items": { "type": "string", "enum": ["destructured", "unused"] }, - "additionalItems": false + "additionalItems": false, + "items": { + "enum": ["destructured", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["parameter"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" }, "types": { - "type": "array", - "items": { "$ref": "#/$defs/typeModifiers" }, - "additionalItems": false + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'memberLike'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["memberLike"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", "enum": [ + "#private", "abstract", + "async", + "override", "private", - "#private", "protected", "public", "readonly", "requiresQuotes", - "static", - "override", - "async" - ] + "static" + ], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["memberLike"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'classProperty'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["classProperty"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", "enum": [ + "#private", "abstract", + "override", "private", - "#private", "protected", "public", "readonly", "requiresQuotes", - "static", - "override" - ] + "static" + ], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["classProperty"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" }, "types": { - "type": "array", - "items": { "$ref": "#/$defs/typeModifiers" }, - "additionalItems": false + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'objectLiteralProperty'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["objectLiteralProperty"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", - "items": { "type": "string", "enum": ["public", "requiresQuotes"] }, - "additionalItems": false + "additionalItems": false, + "items": { + "enum": ["public", "requiresQuotes"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["objectLiteralProperty"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" }, "types": { - "type": "array", - "items": { "$ref": "#/$defs/typeModifiers" }, - "additionalItems": false + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'typeProperty'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["typeProperty"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", - "enum": ["public", "readonly", "requiresQuotes"] + "enum": ["public", "readonly", "requiresQuotes"], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["typeProperty"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" }, "types": { - "type": "array", - "items": { "$ref": "#/$defs/typeModifiers" }, - "additionalItems": false + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'parameterProperty'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["parameterProperty"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", - "enum": ["private", "protected", "public", "readonly"] + "enum": ["private", "protected", "public", "readonly"], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["parameterProperty"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" }, "types": { - "type": "array", - "items": { "$ref": "#/$defs/typeModifiers" }, - "additionalItems": false + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'property'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["property"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", "enum": [ + "#private", "abstract", + "async", + "override", "private", - "#private", "protected", "public", "readonly", "requiresQuotes", - "static", - "override", - "async" - ] + "static" + ], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["property"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" }, "types": { - "type": "array", - "items": { "$ref": "#/$defs/typeModifiers" }, - "additionalItems": false + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'classMethod'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["classMethod"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", "enum": [ + "#private", "abstract", + "async", + "override", "private", - "#private", "protected", "public", "requiresQuotes", - "static", - "override", - "async" - ] + "static" + ], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["classMethod"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'objectLiteralMethod'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["objectLiteralMethod"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", - "enum": ["public", "requiresQuotes", "async"] + "enum": ["async", "public", "requiresQuotes"], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["objectLiteralMethod"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'typeMethod'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["typeMethod"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", - "items": { "type": "string", "enum": ["public", "requiresQuotes"] }, - "additionalItems": false + "additionalItems": false, + "items": { + "enum": ["public", "requiresQuotes"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["typeMethod"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'method'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["method"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", "enum": [ + "#private", "abstract", + "async", + "override", "private", - "#private", "protected", "public", "requiresQuotes", - "static", - "override", - "async" - ] + "static" + ], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["method"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'accessor'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["accessor"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", "enum": [ "abstract", + "override", "private", "protected", "public", "requiresQuotes", - "static", - "override" - ] + "static" + ], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["accessor"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" }, "types": { - "type": "array", - "items": { "$ref": "#/$defs/typeModifiers" }, - "additionalItems": false + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'enumMember'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["enumMember"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", - "items": { "type": "string", "enum": ["requiresQuotes"] }, - "additionalItems": false + "additionalItems": false, + "items": { + "enum": ["requiresQuotes"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["enumMember"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'typeLike'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["typeLike"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", - "enum": ["abstract", "exported", "unused"] + "enum": ["abstract", "exported", "unused"], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["typeLike"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'class'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["class"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", + "additionalItems": false, "items": { - "type": "string", - "enum": ["abstract", "exported", "unused"] + "enum": ["abstract", "exported", "unused"], + "type": "string" }, - "additionalItems": false + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["class"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'interface'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["interface"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", - "items": { "type": "string", "enum": ["exported", "unused"] }, - "additionalItems": false + "additionalItems": false, + "items": { + "enum": ["exported", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["interface"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'typeAlias'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["typeAlias"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", - "items": { "type": "string", "enum": ["exported", "unused"] }, - "additionalItems": false + "additionalItems": false, + "items": { + "enum": ["exported", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["typeAlias"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'enum'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["enum"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", - "items": { "type": "string", "enum": ["exported", "unused"] }, - "additionalItems": false + "additionalItems": false, + "items": { + "enum": ["exported", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["enum"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" }, { - "type": "object", + "additionalProperties": false, "description": "Selector 'typeParameter'", "properties": { - "format": { "$ref": "#/$defs/formatOptionsConfig" }, - "custom": { "$ref": "#/$defs/matchRegexConfig" }, - "leadingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "trailingUnderscore": { "$ref": "#/$defs/underscoreOptions" }, - "prefix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "suffix": { "$ref": "#/$defs/prefixSuffixConfig" }, - "failureMessage": { "type": "string" }, + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, "filter": { "oneOf": [ - { "type": "string", "minLength": 1 }, - { "$ref": "#/$defs/matchRegexConfig" } + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } ] }, - "selector": { "type": "string", "enum": ["typeParameter"] }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, "modifiers": { - "type": "array", - "items": { "type": "string", "enum": ["unused"] }, - "additionalItems": false + "additionalItems": false, + "items": { + "enum": ["unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["typeParameter"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" } }, "required": ["selector", "format"], - "additionalProperties": false + "type": "object" } ] }, - "additionalItems": false + "type": "array" } diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot b/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot index 41253c2afd32..af652bc7e381 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot @@ -6,11 +6,16 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "ignoredTypeNames": { "type": "array", "items": { "type": "string" } } + "ignoredTypeNames": { + "items": { + "type": "string" + }, + "type": "array" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot index 2aa1a9d0161c..b7481d1000ce 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot @@ -6,12 +6,16 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "ignoreArrowShorthand": { "type": "boolean" }, - "ignoreVoidOperator": { "type": "boolean" } + "ignoreArrowShorthand": { + "type": "boolean" + }, + "ignoreVoidOperator": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot index 4fea0452f152..d111b2e37297 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot @@ -7,11 +7,15 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { "additionalProperties": false, - "type": "object", "properties": { - "ignoreIntersections": { "type": "boolean" }, - "ignoreUnions": { "type": "boolean" } - } + "ignoreIntersections": { + "type": "boolean" + }, + "ignoreUnions": { + "type": "boolean" + } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot b/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot index 05731db66491..e863a0f81ccd 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot @@ -6,32 +6,32 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { "allow": { - "type": "array", "items": { "enum": [ - "functions", "arrowFunctions", + "asyncFunctions", + "asyncMethods", + "constructors", + "decoratedFunctions", + "functions", "generatorFunctions", - "methods", "generatorMethods", "getters", - "setters", - "constructors", + "methods", + "overrideMethods", "private-constructors", "protected-constructors", - "asyncFunctions", - "asyncMethods", - "decoratedFunctions", - "overrideMethods" + "setters" ] }, + "type": "array", "uniqueItems": true } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot b/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot index 324d9dadff98..fa4dbf83d2c6 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot @@ -6,9 +6,13 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "additionalProperties": false, - "properties": { "allowSingleExtends": { "type": "boolean" } } + "properties": { + "allowSingleExtends": { + "type": "boolean" + } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-explicit-any.shot b/packages/eslint-plugin/tests/schema-snapshots/no-explicit-any.shot index fdb1ddf910c8..0a857d215544 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-explicit-any.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-explicit-any.shot @@ -6,7 +6,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "additionalProperties": false, "properties": { "fixToUnknown": { @@ -17,7 +16,8 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "description": "Whether to ignore rest parameter arrays.", "type": "boolean" } - } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot index 9ee6da05e840..d28f8cb1fabb 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot @@ -7,35 +7,57 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos { "anyOf": [ { - "type": "array", - "items": [{ "enum": ["functions"] }], + "items": [ + { + "enum": ["functions"] + } + ], + "maxItems": 1, "minItems": 0, - "maxItems": 1 + "type": "array" }, { - "type": "array", "items": [ - { "enum": ["all"] }, { - "type": "object", + "enum": ["all"] + }, + { + "additionalProperties": false, "properties": { - "conditionalAssign": { "type": "boolean" }, - "nestedBinaryExpressions": { "type": "boolean" }, - "returnAssign": { "type": "boolean" }, + "allowParensAfterCommentPattern": { + "type": "string" + }, + "conditionalAssign": { + "type": "boolean" + }, + "enforceForArrowConditionals": { + "type": "boolean" + }, + "enforceForFunctionPrototypeMethods": { + "type": "boolean" + }, + "enforceForNewInMemberExpressions": { + "type": "boolean" + }, + "enforceForSequenceExpressions": { + "type": "boolean" + }, "ignoreJSX": { - "enum": ["none", "all", "single-line", "multi-line"] + "enum": ["all", "multi-line", "none", "single-line"] + }, + "nestedBinaryExpressions": { + "type": "boolean" }, - "enforceForArrowConditionals": { "type": "boolean" }, - "enforceForSequenceExpressions": { "type": "boolean" }, - "enforceForNewInMemberExpressions": { "type": "boolean" }, - "enforceForFunctionPrototypeMethods": { "type": "boolean" }, - "allowParensAfterCommentPattern": { "type": "string" } + "returnAssign": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ], + "maxItems": 2, "minItems": 0, - "maxItems": 2 + "type": "array" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extraneous-class.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extraneous-class.shot index d1c635f49215..b02bb56e590a 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-extraneous-class.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extraneous-class.shot @@ -6,7 +6,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "additionalProperties": false, "properties": { "allowConstructorOnly": { @@ -25,7 +24,8 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "description": "Whether to allow extraneous classes that include a decorator.", "type": "boolean" } - } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot b/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot index 8d9914840cb1..1218cb2d3296 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot @@ -6,18 +6,18 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "ignoreVoid": { - "description": "Whether to ignore \`void\` expressions.", - "type": "boolean" - }, "ignoreIIFE": { "description": "Whether to ignore async IIFEs (Immediately Invocated Function Expressions).", "type": "boolean" + }, + "ignoreVoid": { + "description": "Whether to ignore \`void\` expressions.", + "type": "boolean" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot b/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot index cfddb353a5b4..c913653a0078 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot @@ -6,12 +6,16 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "ignoreParameters": { "type": "boolean" }, - "ignoreProperties": { "type": "boolean" } + "ignoreParameters": { + "type": "boolean" + }, + "ignoreProperties": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-this.shot b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-this.shot index 68b915024f8f..75cd5974f149 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-this.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-this.shot @@ -6,11 +6,14 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "capIsConstructor": { "type": "boolean", "default": true } + "capIsConstructor": { + "default": true, + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot index d4cc22682f95..0a10715c476c 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot @@ -6,17 +6,27 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { + "allowAsThisParameter": { + "type": "boolean" + }, "allowInGenericTypeArguments": { "oneOf": [ - { "type": "boolean" }, - { "type": "array", "items": { "type": "string" }, "minLength": 1 } + { + "type": "boolean" + }, + { + "items": { + "type": "string" + }, + "minLength": 1, + "type": "array" + } ] - }, - "allowAsThisParameter": { "type": "boolean" } + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot index 988516986a17..5628d7b9927a 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot @@ -6,29 +6,57 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "detectObjects": { "type": "boolean", "default": false }, - "enforceConst": { "type": "boolean", "default": false }, + "detectObjects": { + "default": false, + "type": "boolean" + }, + "enforceConst": { + "default": false, + "type": "boolean" + }, "ignore": { - "type": "array", "items": { "anyOf": [ - { "type": "number" }, - { "type": "string", "pattern": "^[+-]?(?:0|[1-9][0-9]*)n$" } + { + "type": "number" + }, + { + "pattern": "^[+-]?(?:0|[1-9][0-9]*)n$", + "type": "string" + } ] }, + "type": "array", "uniqueItems": true }, - "ignoreArrayIndexes": { "type": "boolean", "default": false }, - "ignoreDefaultValues": { "type": "boolean", "default": false }, - "ignoreClassFieldInitialValues": { "type": "boolean", "default": false }, - "ignoreNumericLiteralTypes": { "type": "boolean" }, - "ignoreEnums": { "type": "boolean" }, - "ignoreReadonlyClassProperties": { "type": "boolean" }, - "ignoreTypeIndexes": { "type": "boolean" } + "ignoreArrayIndexes": { + "default": false, + "type": "boolean" + }, + "ignoreClassFieldInitialValues": { + "default": false, + "type": "boolean" + }, + "ignoreDefaultValues": { + "default": false, + "type": "boolean" + }, + "ignoreEnums": { + "type": "boolean" + }, + "ignoreNumericLiteralTypes": { + "type": "boolean" + }, + "ignoreReadonlyClassProperties": { + "type": "boolean" + }, + "ignoreTypeIndexes": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot b/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot index 158ac751246c..8f66e54f40de 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot @@ -6,9 +6,14 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", - "properties": { "checkNever": { "type": "boolean", "default": false } }, - "additionalProperties": false + "additionalProperties": false, + "properties": { + "checkNever": { + "default": false, + "type": "boolean" + } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot b/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot index ac1412beabf2..be4e2d561120 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot @@ -6,27 +6,43 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "properties": { - "checksConditionals": { "type": "boolean" }, + "checksConditionals": { + "type": "boolean" + }, + "checksSpreads": { + "type": "boolean" + }, "checksVoidReturn": { "oneOf": [ - { "type": "boolean" }, + { + "type": "boolean" + }, { "additionalProperties": false, "properties": { - "arguments": { "type": "boolean" }, - "attributes": { "type": "boolean" }, - "properties": { "type": "boolean" }, - "returns": { "type": "boolean" }, - "variables": { "type": "boolean" } + "arguments": { + "type": "boolean" + }, + "attributes": { + "type": "boolean" + }, + "properties": { + "type": "boolean" + }, + "returns": { + "type": "boolean" + }, + "variables": { + "type": "boolean" + } }, "type": "object" } ] - }, - "checksSpreads": { "type": "boolean" } - } + } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-namespace.shot b/packages/eslint-plugin/tests/schema-snapshots/no-namespace.shot index 07d55607e3ca..79c1f36922de 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-namespace.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-namespace.shot @@ -6,7 +6,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { "allowDeclarations": { "description": "Whether to allow \`declare\` with custom TypeScript namespaces.", @@ -17,7 +17,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "type": "boolean" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot b/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot index 81f9be90ffdb..61f33831a071 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot @@ -6,12 +6,16 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "builtinGlobals": { "type": "boolean" }, - "ignoreDeclarationMerge": { "type": "boolean" } + "builtinGlobals": { + "type": "boolean" + }, + "ignoreDeclarationMerge": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot index daa3b544dfc9..5549d66f1f06 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot @@ -7,100 +7,135 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos { "anyOf": [ { - "type": "array", "items": { "anyOf": [ - { "type": "string" }, { - "type": "object", + "type": "string" + }, + { + "additionalProperties": false, "properties": { - "name": { "type": "string" }, - "message": { "type": "string", "minLength": 1 }, - "importNames": { "type": "array", "items": { "type": "string" } }, - "allowTypeImports": { "type": "boolean", "default": false } + "allowTypeImports": { + "default": false, + "type": "boolean" + }, + "importNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "minLength": 1, + "type": "string" + }, + "name": { + "type": "string" + } }, - "additionalProperties": false, - "required": ["name"] + "required": ["name"], + "type": "object" } ] }, + "type": "array", "uniqueItems": true }, { - "type": "array", + "additionalItems": false, "items": [ { - "type": "object", + "additionalProperties": false, "properties": { "paths": { - "type": "array", "items": { "anyOf": [ - { "type": "string" }, { - "type": "object", + "type": "string" + }, + { + "additionalProperties": false, "properties": { - "name": { "type": "string" }, - "message": { "type": "string", "minLength": 1 }, + "allowTypeImports": { + "default": false, + "type": "boolean" + }, "importNames": { - "type": "array", - "items": { "type": "string" } + "items": { + "type": "string" + }, + "type": "array" }, - "allowTypeImports": { - "type": "boolean", - "default": false + "message": { + "minLength": 1, + "type": "string" + }, + "name": { + "type": "string" } }, - "additionalProperties": false, - "required": ["name"] + "required": ["name"], + "type": "object" } ] }, + "type": "array", "uniqueItems": true }, "patterns": { "anyOf": [ { + "items": { + "type": "string" + }, "type": "array", - "items": { "type": "string" }, "uniqueItems": true }, { - "type": "array", "items": { - "type": "object", + "additionalProperties": false, "properties": { - "importNames": { - "type": "array", - "items": { "type": "string" }, - "minItems": 1, - "uniqueItems": true + "allowTypeImports": { + "default": false, + "type": "boolean" + }, + "caseSensitive": { + "type": "boolean" }, "group": { + "items": { + "type": "string" + }, + "minItems": 1, "type": "array", - "items": { "type": "string" }, + "uniqueItems": true + }, + "importNames": { + "items": { + "type": "string" + }, "minItems": 1, + "type": "array", "uniqueItems": true }, - "message": { "type": "string", "minLength": 1 }, - "caseSensitive": { "type": "boolean" }, - "allowTypeImports": { - "type": "boolean", - "default": false + "message": { + "minLength": 1, + "type": "string" } }, - "additionalProperties": false, - "required": ["group"] + "required": ["group"], + "type": "object" }, + "type": "array", "uniqueItems": true } ] } }, - "additionalProperties": false + "type": "object" } ], - "additionalItems": false + "type": "array" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot b/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot index f4abf1ef70c2..d16291030d6b 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot @@ -6,16 +6,31 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "builtinGlobals": { "type": "boolean" }, - "hoist": { "enum": ["all", "functions", "never"] }, - "allow": { "type": "array", "items": { "type": "string" } }, - "ignoreOnInitialization": { "type": "boolean" }, - "ignoreTypeValueShadow": { "type": "boolean" }, - "ignoreFunctionTypeParameterNameValueShadow": { "type": "boolean" } + "allow": { + "items": { + "type": "string" + }, + "type": "array" + }, + "builtinGlobals": { + "type": "boolean" + }, + "hoist": { + "enum": ["all", "functions", "never"] + }, + "ignoreFunctionTypeParameterNameValueShadow": { + "type": "boolean" + }, + "ignoreOnInitialization": { + "type": "boolean" + }, + "ignoreTypeValueShadow": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-this-alias.shot b/packages/eslint-plugin/tests/schema-snapshots/no-this-alias.shot index 1e6fd33384e6..7bf1f2354300 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-this-alias.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-this-alias.shot @@ -6,7 +6,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "additionalProperties": false, "properties": { "allowDestructuring": { @@ -15,10 +14,13 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "allowedNames": { "description": "Names to ignore, such as [\\"self\\"] for \`const self = this;\`.", - "type": "array", - "items": { "type": "string" } + "items": { + "type": "string" + }, + "type": "array" } - } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-throw-literal.shot b/packages/eslint-plugin/tests/schema-snapshots/no-throw-literal.shot index e85ccf93c931..eb5380cdecc7 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-throw-literal.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-throw-literal.shot @@ -6,12 +6,16 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "allowThrowingAny": { "type": "boolean" }, - "allowThrowingUnknown": { "type": "boolean" } + "allowThrowingAny": { + "type": "boolean" + }, + "allowThrowingUnknown": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot index 66dcd5de4e57..4d3337557272 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot @@ -6,16 +6,16 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { "allowAliases": { "description": "Whether to allow direct one-to-one type aliases.", "enum": [ "always", - "never", - "in-unions", "in-intersections", - "in-unions-and-intersections" + "in-unions", + "in-unions-and-intersections", + "never" ] }, "allowCallbacks": { @@ -30,42 +30,42 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "description": "Whether to allow type aliases with constructors.", "enum": ["always", "never"] }, + "allowGenerics": { + "description": "Whether to allow type aliases with generic types.", + "enum": ["always", "never"] + }, "allowLiterals": { "description": "Whether to allow type aliases with object literal types.", "enum": [ "always", - "never", - "in-unions", "in-intersections", - "in-unions-and-intersections" + "in-unions", + "in-unions-and-intersections", + "never" ] }, "allowMappedTypes": { "description": "Whether to allow type aliases with mapped types.", "enum": [ "always", - "never", - "in-unions", "in-intersections", - "in-unions-and-intersections" + "in-unions", + "in-unions-and-intersections", + "never" ] }, "allowTupleTypes": { "description": "Whether to allow type aliases with tuple types.", "enum": [ "always", - "never", - "in-unions", "in-intersections", - "in-unions-and-intersections" + "in-unions", + "in-unions-and-intersections", + "never" ] - }, - "allowGenerics": { - "description": "Whether to allow type aliases with generic types.", - "enum": ["always", "never"] } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot index 7a8270778792..faf2bf9e1822 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot @@ -6,18 +6,18 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "allowComparingNullableBooleansToTrue": { - "description": "Whether to allow comparisons between nullable boolean variables and \`true\`.", - "type": "boolean" - }, "allowComparingNullableBooleansToFalse": { "description": "Whether to allow comparisons between nullable boolean variables and \`false\`.", "type": "boolean" + }, + "allowComparingNullableBooleansToTrue": { + "description": "Whether to allow comparisons between nullable boolean variables and \`true\`.", + "type": "boolean" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot index e38f876cca21..4f7fef6518ec 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot @@ -6,7 +6,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { "allowConstantLoopConditions": { "description": "Whether to ignore constant loop conditions, such as \`while (true)\`.", @@ -17,7 +17,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "type": "boolean" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-assertion.shot index 3e20bd213047..29683a8039ce 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-assertion.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-assertion.shot @@ -6,14 +6,16 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "properties": { "typesToIgnore": { "description": "A list of type names to ignore.", - "type": "array", - "items": { "type": "string" } + "items": { + "type": "string" + }, + "type": "array" } - } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot index b4741f9ef969..43950ac51cea 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot @@ -6,14 +6,26 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "allowShortCircuit": { "type": "boolean", "default": false }, - "allowTernary": { "type": "boolean", "default": false }, - "allowTaggedTemplates": { "type": "boolean", "default": false }, - "enforceForJSX": { "type": "boolean", "default": false } + "allowShortCircuit": { + "default": false, + "type": "boolean" + }, + "allowTaggedTemplates": { + "default": false, + "type": "boolean" + }, + "allowTernary": { + "default": false, + "type": "boolean" + }, + "enforceForJSX": { + "default": false, + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot index ef5cafaacc37..df5e87ceced5 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot @@ -7,20 +7,38 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { "oneOf": [ - { "enum": ["all", "local"] }, { - "type": "object", + "enum": ["all", "local"] + }, + { + "additionalProperties": false, "properties": { - "vars": { "enum": ["all", "local"] }, - "varsIgnorePattern": { "type": "string" }, - "args": { "enum": ["all", "after-used", "none"] }, - "ignoreRestSiblings": { "type": "boolean" }, - "argsIgnorePattern": { "type": "string" }, - "caughtErrors": { "enum": ["all", "none"] }, - "caughtErrorsIgnorePattern": { "type": "string" }, - "destructuredArrayIgnorePattern": { "type": "string" } + "args": { + "enum": ["after-used", "all", "none"] + }, + "argsIgnorePattern": { + "type": "string" + }, + "caughtErrors": { + "enum": ["all", "none"] + }, + "caughtErrorsIgnorePattern": { + "type": "string" + }, + "destructuredArrayIgnorePattern": { + "type": "string" + }, + "ignoreRestSiblings": { + "type": "boolean" + }, + "vars": { + "enum": ["all", "local"] + }, + "varsIgnorePattern": { + "type": "string" + } }, - "additionalProperties": false + "type": "object" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot index 1cb658fa3dcf..cfe91c2c7b7e 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot @@ -7,19 +7,35 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { "oneOf": [ - { "enum": ["nofunc"] }, { - "type": "object", + "enum": ["nofunc"] + }, + { + "additionalProperties": false, "properties": { - "functions": { "type": "boolean" }, - "classes": { "type": "boolean" }, - "enums": { "type": "boolean" }, - "variables": { "type": "boolean" }, - "typedefs": { "type": "boolean" }, - "ignoreTypeReferences": { "type": "boolean" }, - "allowNamedExports": { "type": "boolean" } + "allowNamedExports": { + "type": "boolean" + }, + "classes": { + "type": "boolean" + }, + "enums": { + "type": "boolean" + }, + "functions": { + "type": "boolean" + }, + "ignoreTypeReferences": { + "type": "boolean" + }, + "typedefs": { + "type": "boolean" + }, + "variables": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/object-curly-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/object-curly-spacing.shot index ee7f267a7f65..25f315066bbb 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/object-curly-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/object-curly-spacing.shot @@ -5,14 +5,20 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # SCHEMA: [ - { "enum": ["always", "never"] }, { - "type": "object", + "enum": ["always", "never"] + }, + { + "additionalProperties": false, "properties": { - "arraysInObjects": { "type": "boolean" }, - "objectsInObjects": { "type": "boolean" } + "arraysInObjects": { + "type": "boolean" + }, + "objectsInObjects": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot index a29eeddd0e51..0ab454b90c05 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot @@ -6,29 +6,16 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos { "$defs": { - "paddingType": { "enum": ["any", "never", "always"] }, + "paddingType": { + "enum": ["always", "any", "never"] + }, "statementType": { "anyOf": [ { "enum": [ "*", - "block-like", - "exports", - "require", - "directive", - "expression", - "iife", - "multiline-block-like", - "multiline-expression", - "multiline-const", - "multiline-let", - "multiline-var", - "singleline-const", - "singleline-let", - "singleline-var", "block", - "empty", - "function", + "block-like", "break", "case", "class", @@ -36,45 +23,45 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "continue", "debugger", "default", + "directive", "do", + "empty", "export", + "exports", + "expression", "for", + "function", "if", + "iife", "import", + "interface", "let", + "multiline-block-like", + "multiline-const", + "multiline-expression", + "multiline-let", + "multiline-var", + "require", "return", + "singleline-const", + "singleline-let", + "singleline-var", "switch", "throw", "try", + "type", "var", "while", - "with", - "interface", - "type" + "with" ] }, { - "type": "array", + "additionalItems": false, "items": { "enum": [ "*", - "block-like", - "exports", - "require", - "directive", - "expression", - "iife", - "multiline-block-like", - "multiline-expression", - "multiline-const", - "multiline-let", - "multiline-var", - "singleline-const", - "singleline-let", - "singleline-var", "block", - "empty", - "function", + "block-like", "break", "case", "class", @@ -82,42 +69,63 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "continue", "debugger", "default", + "directive", "do", + "empty", "export", + "exports", + "expression", "for", + "function", "if", + "iife", "import", + "interface", "let", + "multiline-block-like", + "multiline-const", + "multiline-expression", + "multiline-let", + "multiline-var", + "require", "return", + "singleline-const", + "singleline-let", + "singleline-var", "switch", "throw", "try", + "type", "var", "while", - "with", - "interface", - "type" + "with" ] }, "minItems": 1, - "uniqueItems": true, - "additionalItems": false + "type": "array", + "uniqueItems": true } ] } }, - "type": "array", + "additionalItems": false, "items": { - "type": "object", + "additionalProperties": false, "properties": { - "blankLine": { "$ref": "#/$defs/paddingType" }, - "prev": { "$ref": "#/$defs/statementType" }, - "next": { "$ref": "#/$defs/statementType" } + "blankLine": { + "$ref": "#/$defs/paddingType" + }, + "next": { + "$ref": "#/$defs/statementType" + }, + "prev": { + "$ref": "#/$defs/statementType" + } }, - "additionalProperties": false, - "required": ["blankLine", "prev", "next"] + "required": ["blankLine", "prev", "next"], + "type": "object" }, - "additionalItems": false + "type": "array" } diff --git a/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot b/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot index ffb4847eb4d7..f317443ca001 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot @@ -9,26 +9,30 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "$defs": { "modifier": { "enum": [ - "readonly", "private", - "protected", - "public", "private readonly", + "protected", "protected readonly", - "public readonly" + "public", + "public readonly", + "readonly" ] } }, - "type": "object", + "additionalProperties": false, "properties": { "allow": { - "type": "array", - "items": { "$ref": "#/items/0/$defs/modifier" }, - "minItems": 1 + "items": { + "$ref": "#/items/0/$defs/modifier" + }, + "minItems": 1, + "type": "array" }, - "prefer": { "enum": ["class-property", "parameter-property"] } + "prefer": { + "enum": ["class-property", "parameter-property"] + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot index 2af3296291ee..9bbb15fe6ddb 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot @@ -6,9 +6,13 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", - "properties": { "allowBitwiseExpressions": { "type": "boolean" } }, - "additionalProperties": false + "additionalProperties": false, + "properties": { + "allowBitwiseExpressions": { + "type": "boolean" + } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot index 9b472307161c..13091c88c649 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot @@ -6,16 +6,22 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "ignoreConditionalTests": { "type": "boolean" }, - "ignoreTernaryTests": { "type": "boolean" }, - "ignoreMixedLogicalExpressions": { "type": "boolean" }, "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": { "type": "boolean" + }, + "ignoreConditionalTests": { + "type": "boolean" + }, + "ignoreMixedLogicalExpressions": { + "type": "boolean" + }, + "ignoreTernaryTests": { + "type": "boolean" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot index 179b0f8cfb4d..332e54184b30 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot @@ -6,80 +6,113 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "additionalProperties": false, "properties": { "allow": { - "type": "array", "items": { "oneOf": [ - { "type": "string" }, { - "type": "object", + "type": "string" + }, + { "additionalProperties": false, "properties": { - "from": { "type": "string", "enum": ["file"] }, + "from": { + "enum": ["file"], + "type": "string" + }, "name": { "oneOf": [ - { "type": "string" }, { - "type": "array", + "type": "string" + }, + { + "items": { + "type": "string" + }, "minItems": 1, - "uniqueItems": true, - "items": { "type": "string" } + "type": "array", + "uniqueItems": true } ] }, - "path": { "type": "string" } + "path": { + "type": "string" + } }, - "required": ["from", "name"] + "required": ["from", "name"], + "type": "object" }, { - "type": "object", "additionalProperties": false, "properties": { - "from": { "type": "string", "enum": ["lib"] }, + "from": { + "enum": ["lib"], + "type": "string" + }, "name": { "oneOf": [ - { "type": "string" }, { - "type": "array", + "type": "string" + }, + { + "items": { + "type": "string" + }, "minItems": 1, - "uniqueItems": true, - "items": { "type": "string" } + "type": "array", + "uniqueItems": true } ] } }, - "required": ["from", "name"] + "required": ["from", "name"], + "type": "object" }, { - "type": "object", "additionalProperties": false, "properties": { - "from": { "type": "string", "enum": ["package"] }, + "from": { + "enum": ["package"], + "type": "string" + }, "name": { "oneOf": [ - { "type": "string" }, { - "type": "array", + "type": "string" + }, + { + "items": { + "type": "string" + }, "minItems": 1, - "uniqueItems": true, - "items": { "type": "string" } + "type": "array", + "uniqueItems": true } ] }, - "package": { "type": "string" } + "package": { + "type": "string" + } }, - "required": ["from", "name", "package"] + "required": ["from", "name", "package"], + "type": "object" } ] - } + }, + "type": "array" + }, + "checkParameterProperties": { + "type": "boolean" + }, + "ignoreInferredTypes": { + "type": "boolean" }, - "checkParameterProperties": { "type": "boolean" }, - "ignoreInferredTypes": { "type": "boolean" }, - "treatMethodsAsReadonly": { "type": "boolean" } - } + "treatMethodsAsReadonly": { + "type": "boolean" + } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot index 6badcd0c30e8..34e4a22204a9 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot @@ -7,7 +7,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { "additionalProperties": false, - "properties": { "onlyInlineLambdas": { "type": "boolean" } }, + "properties": { + "onlyInlineLambdas": { + "type": "boolean" + } + }, "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot b/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot index 428f27957eca..c073af42009a 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot @@ -6,7 +6,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { "allowAny": { "description": "Whether to consider \`any\` and \`unknown\` to be Promises.", @@ -14,15 +14,25 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "allowedPromiseNames": { "description": "Any extra names of classes or interfaces to be considered Promises.", - "type": "array", - "items": { "type": "string" } + "items": { + "type": "string" + }, + "type": "array" }, - "checkArrowFunctions": { "type": "boolean" }, - "checkFunctionDeclarations": { "type": "boolean" }, - "checkFunctionExpressions": { "type": "boolean" }, - "checkMethodDeclarations": { "type": "boolean" } + "checkArrowFunctions": { + "type": "boolean" + }, + "checkFunctionDeclarations": { + "type": "boolean" + }, + "checkFunctionExpressions": { + "type": "boolean" + }, + "checkMethodDeclarations": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/quotes.shot b/packages/eslint-plugin/tests/schema-snapshots/quotes.shot index e422d74b82d6..bf7bb170ed05 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/quotes.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/quotes.shot @@ -5,17 +5,25 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # SCHEMA: [ - { "enum": ["single", "double", "backtick"] }, + { + "enum": ["backtick", "double", "single"] + }, { "anyOf": [ - { "enum": ["avoid-escape"] }, { - "type": "object", + "enum": ["avoid-escape"] + }, + { + "additionalProperties": false, "properties": { - "avoidEscape": { "type": "boolean" }, - "allowTemplateLiterals": { "type": "boolean" } + "allowTemplateLiterals": { + "type": "boolean" + }, + "avoidEscape": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/require-array-sort-compare.shot b/packages/eslint-plugin/tests/schema-snapshots/require-array-sort-compare.shot index 195dc21d269a..938d7b6887a3 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/require-array-sort-compare.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/require-array-sort-compare.shot @@ -6,13 +6,13 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "properties": { "ignoreStringArrays": { "description": "Whether to ignore arrays in which all elements are strings.", "type": "boolean" } - } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot b/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot index 61d659cf5fb0..a1727d55fca7 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot @@ -6,18 +6,18 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "additionalProperties": false, "properties": { - "checkCompoundAssignments": { - "description": "Whether to check compound assignments such as \`+=\`.", - "type": "boolean" - }, "allowAny": { "description": "Whether to allow \`any\` typed values.", "type": "boolean" + }, + "checkCompoundAssignments": { + "description": "Whether to check compound assignments such as \`+=\`.", + "type": "boolean" } - } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot index 18109d7993c3..a5af1c8d0630 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot @@ -6,33 +6,33 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "properties": { - "allowNumber": { - "description": "Whether to allow \`number\` typed values in template expressions.", + "allowAny": { + "description": "Whether to allow \`any\` typed values in template expressions.", "type": "boolean" }, "allowBoolean": { "description": "Whether to allow \`boolean\` typed values in template expressions.", "type": "boolean" }, - "allowAny": { - "description": "Whether to allow \`any\` typed values in template expressions.", + "allowNever": { + "description": "Whether to allow \`never\` typed values in template expressions.", "type": "boolean" }, "allowNullish": { "description": "Whether to allow \`nullish\` typed values in template expressions.", "type": "boolean" }, - "allowRegExp": { - "description": "Whether to allow \`regexp\` typed values in template expressions.", + "allowNumber": { + "description": "Whether to allow \`number\` typed values in template expressions.", "type": "boolean" }, - "allowNever": { - "description": "Whether to allow \`never\` typed values in template expressions.", + "allowRegExp": { + "description": "Whether to allow \`regexp\` typed values in template expressions.", "type": "boolean" } - } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/return-await.shot b/packages/eslint-plugin/tests/schema-snapshots/return-await.shot index b90fc5fdffd5..7d0a6d5e142e 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/return-await.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/return-await.shot @@ -4,7 +4,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos " # SCHEMA: -[{ "enum": ["in-try-catch", "always", "never"] }] +[ + { + "enum": ["always", "in-try-catch", "never"] + } +] # TYPES: diff --git a/packages/eslint-plugin/tests/schema-snapshots/semi.shot b/packages/eslint-plugin/tests/schema-snapshots/semi.shot index e7694dac05cc..33817851eec0 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/semi.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/semi.shot @@ -7,34 +7,42 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos { "anyOf": [ { - "type": "array", "items": [ - { "enum": ["never"] }, { - "type": "object", + "enum": ["never"] + }, + { + "additionalProperties": false, "properties": { "beforeStatementContinuationChars": { "enum": ["always", "any", "never"] } }, - "additionalProperties": false + "type": "object" } ], + "maxItems": 2, "minItems": 0, - "maxItems": 2 + "type": "array" }, { - "type": "array", "items": [ - { "enum": ["always"] }, { - "type": "object", - "properties": { "omitLastInOneLineBlock": { "type": "boolean" } }, - "additionalProperties": false + "enum": ["always"] + }, + { + "additionalProperties": false, + "properties": { + "omitLastInOneLineBlock": { + "type": "boolean" + } + }, + "type": "object" } ], + "maxItems": 2, "minItems": 0, - "maxItems": 2 + "type": "array" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot b/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot index 1972e0948308..d84cff0e09d6 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot @@ -6,7 +6,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "properties": { "checkIntersections": { "description": "Whether to check intersection types.", @@ -18,26 +17,27 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "groupOrder": { "description": "Ordering of the groups.", - "type": "array", "items": { - "type": "string", "enum": [ "conditional", "function", "import", "intersection", "keyword", - "nullish", "literal", "named", + "nullish", "object", "operator", "tuple", "union" - ] - } + ], + "type": "string" + }, + "type": "array" } - } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot b/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot index 99dd9b10885a..1cc7a00b7d7b 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot @@ -7,15 +7,23 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { "oneOf": [ - { "enum": ["always", "never"] }, { - "type": "object", + "enum": ["always", "never"] + }, + { + "additionalProperties": false, "properties": { - "keywords": { "enum": ["always", "never", "off"] }, - "functions": { "enum": ["always", "never", "off"] }, - "classes": { "enum": ["always", "never", "off"] } + "classes": { + "enum": ["always", "never", "off"] + }, + "functions": { + "enum": ["always", "never", "off"] + }, + "keywords": { + "enum": ["always", "never", "off"] + } }, - "additionalProperties": false + "type": "object" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot b/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot index 7f5367c019c2..1c2337a29b79 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot @@ -7,15 +7,23 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { "oneOf": [ - { "enum": ["always", "never"] }, { - "type": "object", + "enum": ["always", "never"] + }, + { + "additionalProperties": false, "properties": { - "anonymous": { "enum": ["always", "never", "ignore"] }, - "named": { "enum": ["always", "never", "ignore"] }, - "asyncArrow": { "enum": ["always", "never", "ignore"] } + "anonymous": { + "enum": ["always", "ignore", "never"] + }, + "asyncArrow": { + "enum": ["always", "ignore", "never"] + }, + "named": { + "enum": ["always", "ignore", "never"] + } }, - "additionalProperties": false + "type": "object" } ] } diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-infix-ops.shot b/packages/eslint-plugin/tests/schema-snapshots/space-infix-ops.shot index e96e7675636a..92fd6d7dd04f 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/space-infix-ops.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/space-infix-ops.shot @@ -6,9 +6,14 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", - "properties": { "int32Hint": { "type": "boolean", "default": false } }, - "additionalProperties": false + "additionalProperties": false, + "properties": { + "int32Hint": { + "default": false, + "type": "boolean" + } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot index c2d2c3a4d001..140b7e556a48 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot @@ -6,21 +6,37 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "allowString": { "type": "boolean" }, - "allowNumber": { "type": "boolean" }, - "allowNullableObject": { "type": "boolean" }, - "allowNullableBoolean": { "type": "boolean" }, - "allowNullableString": { "type": "boolean" }, - "allowNullableNumber": { "type": "boolean" }, - "allowNullableEnum": { "type": "boolean" }, - "allowAny": { "type": "boolean" }, + "allowAny": { + "type": "boolean" + }, + "allowNullableBoolean": { + "type": "boolean" + }, + "allowNullableEnum": { + "type": "boolean" + }, + "allowNullableNumber": { + "type": "boolean" + }, + "allowNullableObject": { + "type": "boolean" + }, + "allowNullableString": { + "type": "boolean" + }, + "allowNumber": { + "type": "boolean" + }, "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": { "type": "boolean" + }, + "allowString": { + "type": "boolean" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot b/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot index 318312764efe..c5b400712bf4 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot @@ -6,13 +6,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "lib": { "enum": ["always", "never"] }, - "path": { "enum": ["always", "never"] }, - "types": { "enum": ["always", "never", "prefer-import"] } + "lib": { + "enum": ["always", "never"] + }, + "path": { + "enum": ["always", "never"] + }, + "types": { + "enum": ["always", "never", "prefer-import"] + } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot index 8506ccbdd7f8..777af409d0b3 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot @@ -6,66 +6,94 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" }, + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + }, "overrides": { - "type": "object", + "additionalProperties": false, "properties": { - "colon": { - "type": "object", - "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } - }, - "additionalProperties": false - }, "arrow": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, - "variable": { - "type": "object", + "colon": { + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "parameter": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "property": { - "type": "object", + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" }, "returnType": { - "type": "object", + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "variable": { + "additionalProperties": false, "properties": { - "before": { "type": "boolean" }, - "after": { "type": "boolean" } + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } }, - "additionalProperties": false + "type": "object" } }, - "additionalProperties": false + "type": "object" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/typedef.shot b/packages/eslint-plugin/tests/schema-snapshots/typedef.shot index 12921f4a37a8..d08f373ab797 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/typedef.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/typedef.shot @@ -6,17 +6,33 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", "properties": { - "arrayDestructuring": { "type": "boolean" }, - "arrowParameter": { "type": "boolean" }, - "memberVariableDeclaration": { "type": "boolean" }, - "objectDestructuring": { "type": "boolean" }, - "parameter": { "type": "boolean" }, - "propertyDeclaration": { "type": "boolean" }, - "variableDeclaration": { "type": "boolean" }, - "variableDeclarationIgnoreFunction": { "type": "boolean" } - } + "arrayDestructuring": { + "type": "boolean" + }, + "arrowParameter": { + "type": "boolean" + }, + "memberVariableDeclaration": { + "type": "boolean" + }, + "objectDestructuring": { + "type": "boolean" + }, + "parameter": { + "type": "boolean" + }, + "propertyDeclaration": { + "type": "boolean" + }, + "variableDeclaration": { + "type": "boolean" + }, + "variableDeclarationIgnoreFunction": { + "type": "boolean" + } + }, + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schema-snapshots/unbound-method.shot b/packages/eslint-plugin/tests/schema-snapshots/unbound-method.shot index e1c46e3f5237..4ce3ddd4a511 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/unbound-method.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/unbound-method.shot @@ -6,14 +6,14 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "type": "object", + "additionalProperties": false, "properties": { "ignoreStatic": { "description": "Whether to skip checking whether \`static\` methods are correctly bound.", "type": "boolean" } }, - "additionalProperties": false + "type": "object" } ] diff --git a/packages/eslint-plugin/tests/schemas.test.ts b/packages/eslint-plugin/tests/schemas.test.ts index 9b00f0575989..616f9e7565fa 100644 --- a/packages/eslint-plugin/tests/schemas.test.ts +++ b/packages/eslint-plugin/tests/schemas.test.ts @@ -33,7 +33,31 @@ describe('Rule schemas should be convertible to TS types for documentation purpo (ruleName === ONLY ? it.only : it)(ruleName, () => { const schemaString = format( - JSON.stringify(ruleDef.meta.schema), + JSON.stringify( + ruleDef.meta.schema, + (k, v: unknown) => { + if (k === 'enum' && Array.isArray(v)) { + // sort enum arrays for consistency regardless of source order + v.sort(); + } else if ( + typeof v === 'object' && + v != null && + !Array.isArray(v) + ) { + // sort properties for consistency regardless of source order + return Object.fromEntries( + Object.entries(v).sort(([a], [b]) => a.localeCompare(b)), + ); + } + return v; + }, + // use the indent feature as it forces all objects to be multiline + // if we don't do this then prettier decides what objects are multiline + // based on what fits on a line - which looks less consistent + // and makes changes harder to understand as you can have multiple + // changes per line, or adding a prop can restructure an object + 2, + ), prettierConfigJson, ); const compilationResult = compile(ruleDef.meta.schema); @@ -108,7 +132,7 @@ const VALID_SCHEMA_PROPS = new Set([ describe('Rules should only define valid keys on schemas', () => { for (const [ruleName, ruleDef] of Object.entries(rules)) { (ruleName === ONLY ? it.only : it)(ruleName, () => { - JSON.stringify(ruleDef.meta.schema, (key, value) => { + JSON.stringify(ruleDef.meta.schema, (key, value: unknown) => { if (key === '') { // the root object will have key "" return value; diff --git a/packages/website/src/components/editor/createProvideCodeActions.ts b/packages/website/src/components/editor/createProvideCodeActions.ts index 7f26faec7044..a5eae9f849a9 100644 --- a/packages/website/src/components/editor/createProvideCodeActions.ts +++ b/packages/website/src/components/editor/createProvideCodeActions.ts @@ -34,9 +34,9 @@ export function createProvideCodeActions( edits: [ { resource: model.uri, - // @ts-expect-error monaco for ts >= 4.8 + // monaco for ts >= 4.8 textEdit: editOperation, - // monaco for ts < 4.8 + // @ts-expect-error monaco for ts < 4.8 edit: editOperation, }, ], diff --git a/yarn.lock b/yarn.lock index 0d776941ef73..2f730dacb5c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5434,12 +5434,7 @@ color-support@^1.1.3: resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== -colord@^2.9.1: - version "2.9.1" - resolved "https://registry.yarnpkg.com/colord/-/colord-2.9.1.tgz#c961ea0efeb57c9f0f4834458f26cb9cc4a3f90e" - integrity sha512-4LBMSt09vR0uLnPVkOUBnmxgoaeN4ewRbx801wY/bXcltXfpR/G46OdWn96XpYmCWuYvO46aBZP4NgX8HpNAcw== - -colord@^2.9.3: +colord@^2.9.1, colord@^2.9.3: version "2.9.3" resolved "https://registry.yarnpkg.com/colord/-/colord-2.9.3.tgz#4f8ce919de456f1d5c1c368c307fe20f3e59fb43" integrity sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw== @@ -6942,7 +6937,7 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz#c7f0f956124ce677047ddbc192a68f999454dedc" integrity sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ== -eslint@*: +eslint@*, eslint@^8.34.0: version "8.38.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.38.0.tgz#a62c6f36e548a5574dd35728ac3c6209bd1e2f1a" integrity sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg== @@ -6988,52 +6983,6 @@ eslint@*: strip-json-comments "^3.1.0" text-table "^0.2.0" -eslint@^8.34.0: - version "8.36.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.36.0.tgz#1bd72202200a5492f91803b113fb8a83b11285cf" - integrity sha512-Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw== - dependencies: - "@eslint-community/eslint-utils" "^4.2.0" - "@eslint-community/regexpp" "^4.4.0" - "@eslint/eslintrc" "^2.0.1" - "@eslint/js" "8.36.0" - "@humanwhocodes/config-array" "^0.11.8" - "@humanwhocodes/module-importer" "^1.0.1" - "@nodelib/fs.walk" "^1.2.8" - ajv "^6.10.0" - chalk "^4.0.0" - cross-spawn "^7.0.2" - debug "^4.3.2" - doctrine "^3.0.0" - escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" - eslint-visitor-keys "^3.3.0" - espree "^9.5.0" - esquery "^1.4.2" - esutils "^2.0.2" - fast-deep-equal "^3.1.3" - file-entry-cache "^6.0.1" - find-up "^5.0.0" - glob-parent "^6.0.2" - globals "^13.19.0" - grapheme-splitter "^1.0.4" - ignore "^5.2.0" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - is-glob "^4.0.0" - is-path-inside "^3.0.3" - js-sdsl "^4.1.4" - js-yaml "^4.1.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.4.1" - lodash.merge "^4.6.2" - minimatch "^3.1.2" - natural-compare "^1.4.0" - optionator "^0.9.1" - strip-ansi "^6.0.1" - strip-json-comments "^3.1.0" - text-table "^0.2.0" - espree@^9.5.0, espree@^9.5.1: version "9.5.1" resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.1.tgz#4f26a4d5f18905bf4f2e0bd99002aab807e96dd4" @@ -11929,16 +11878,7 @@ postcss-zindex@^5.1.0: resolved "https://registry.yarnpkg.com/postcss-zindex/-/postcss-zindex-5.1.0.tgz#4a5c7e5ff1050bd4c01d95b1847dfdcc58a496ff" integrity sha512-fgFMf0OtVSBR1va1JNHYgMxYk73yhn/qb4uQDq1DLGYolz8gHCyr/sesEuGUaYs58E3ZJRcpoGuPVoB7Meiq9A== -postcss@^8.3.11, postcss@^8.4.13, postcss@^8.4.14, postcss@^8.4.7: - version "8.4.14" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf" - integrity sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig== - dependencies: - nanoid "^3.3.4" - picocolors "^1.0.0" - source-map-js "^1.0.2" - -postcss@^8.4.21: +postcss@^8.3.11, postcss@^8.4.13, postcss@^8.4.14, postcss@^8.4.21, postcss@^8.4.7: version "8.4.21" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.21.tgz#c639b719a57efc3187b13a1d765675485f4134f4" integrity sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg== From ddeb0f6879169951467d90f7666107b08e5d97c2 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 14 Apr 2023 10:06:21 +0930 Subject: [PATCH 04/16] fix printing of multiline descriptions --- .../explicit-module-boundary-types.shot | 12 ++++++++---- .../rule-schema-to-typescript-types/src/index.ts | 11 +++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot index b14497080b79..e2d88dc8061a 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot @@ -43,13 +43,17 @@ type Options = [ { /** Whether to ignore arguments that are explicitly typed as \`any\`. */ allowArgumentsExplicitlyTypedAsAny?: boolean; - /** Whether to ignore return type annotations on body-less arrow functions that return an \`as const\` type assertion. -You must still type the parameters of the function. */ + /** + * Whether to ignore return type annotations on body-less arrow functions that return an \`as const\` type assertion. + * You must still type the parameters of the function. + */ allowDirectConstAssertionInArrowFunctions?: boolean; /** An array of function/method names that will not have their arguments or return values checked. */ allowedNames?: string[]; - /** Whether to ignore return type annotations on functions immediately returning another function expression. -You must still type the parameters of the function. */ + /** + * Whether to ignore return type annotations on functions immediately returning another function expression. + * You must still type the parameters of the function. + */ allowHigherOrderFunctions?: boolean; /** Whether to ignore type annotations on the variable of a function expresion. */ allowTypedFunctionExpressions?: boolean; diff --git a/packages/rule-schema-to-typescript-types/src/index.ts b/packages/rule-schema-to-typescript-types/src/index.ts index ba79614d6b50..ac1b0371f022 100644 --- a/packages/rule-schema-to-typescript-types/src/index.ts +++ b/packages/rule-schema-to-typescript-types/src/index.ts @@ -466,11 +466,18 @@ function getCommentLines(schema: JSONSchema4): string[] { } return lines; } -function printComment({ commentLines }: GeneratedResult): string { - if (commentLines == null || commentLines.length === 0) { +function printComment({ + commentLines: commentLinesIn, +}: GeneratedResult): string { + if (commentLinesIn == null || commentLinesIn.length === 0) { return ''; } + const commentLines: string[] = []; + for (const line of commentLinesIn) { + commentLines.push(...line.split('\n')); + } + if (commentLines.length === 1) { return `/** ${commentLines[0]} */\n`; } From dd3fb3d89cf34b91bc2d178e251961a64c57352b Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 14 Apr 2023 10:13:00 +0930 Subject: [PATCH 05/16] fix handling of maxItems for tuples --- .../tests/schema-snapshots/func-call-spacing.shot | 3 +-- .../tests/schema-snapshots/init-declarations.shot | 3 +-- .../eslint-plugin/tests/schema-snapshots/no-extra-parens.shot | 3 +-- packages/eslint-plugin/tests/schema-snapshots/semi.shot | 2 -- packages/rule-schema-to-typescript-types/src/index.ts | 2 +- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot index 2bbd7d74d020..ccc0b15f5fb9 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot @@ -50,9 +50,8 @@ type Options = { allowNewlines?: boolean; }, - ...unknown[], ] ) - | ([] | ['never', ...unknown[]]); + | ([] | ['never']); " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot b/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot index 51b5b96c84b7..222eed21d915 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot @@ -42,7 +42,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = - | ([] | ['always', ...unknown[]]) + | ([] | ['always']) | ( | [] | ['never'] @@ -51,7 +51,6 @@ type Options = { ignoreForLoopInit?: boolean; }, - ...unknown[], ] ); " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot index d28f8cb1fabb..3411a42bbc69 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot @@ -82,9 +82,8 @@ type Options = nestedBinaryExpressions?: boolean; returnAssign?: boolean; }, - ...unknown[], ] ) - | ([] | ['functions', ...unknown[]]); + | ([] | ['functions']); " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/semi.shot b/packages/eslint-plugin/tests/schema-snapshots/semi.shot index 33817851eec0..75439c72e818 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/semi.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/semi.shot @@ -59,7 +59,6 @@ type Options = { omitLastInOneLineBlock?: boolean; }, - ...unknown[], ] ) | ( @@ -70,7 +69,6 @@ type Options = { beforeStatementContinuationChars?: 'always' | 'any' | 'never'; }, - ...unknown[], ] ); " diff --git a/packages/rule-schema-to-typescript-types/src/index.ts b/packages/rule-schema-to-typescript-types/src/index.ts index ac1b0371f022..4742d5aa06ec 100644 --- a/packages/rule-schema-to-typescript-types/src/index.ts +++ b/packages/rule-schema-to-typescript-types/src/index.ts @@ -316,7 +316,7 @@ function generateArrayType( } else { // treat as a tuple items = schema.items; - if (hasMaxItems) { + if (hasMaxItems && items.length < maxItems) { spreadItemSchema = typeof schema.additionalItems === 'object' ? schema.additionalItems From e7b686c9f27c08b72b31b43d29fd54794ed45e4b Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 14 Apr 2023 11:12:27 +0930 Subject: [PATCH 06/16] cleanup more schemas --- .../src/rules/lines-between-class-members.ts | 3 +- .../src/rules/member-delimiter-style.ts | 68 +- .../src/rules/member-ordering.ts | 120 +- .../eslint-plugin/src/rules/no-type-alias.ts | 37 +- .../src/rules/type-annotation-spacing.ts | 31 +- .../member-delimiter-style.shot | 141 +- .../schema-snapshots/member-ordering.shot | 3976 ++--------------- .../tests/schema-snapshots/no-type-alias.shot | 107 +- .../type-annotation-spacing.shot | 115 +- packages/eslint-plugin/tests/schemas.test.ts | 3 +- .../src/index.ts | 37 +- .../website/plugins/generated-rule-docs.ts | 5 +- patches/@types+json-schema+7.0.11.patch | 35 + 13 files changed, 695 insertions(+), 3983 deletions(-) create mode 100644 patches/@types+json-schema+7.0.11.patch diff --git a/packages/eslint-plugin/src/rules/lines-between-class-members.ts b/packages/eslint-plugin/src/rules/lines-between-class-members.ts index 1b2266900ef5..e88e42d477af 100644 --- a/packages/eslint-plugin/src/rules/lines-between-class-members.ts +++ b/packages/eslint-plugin/src/rules/lines-between-class-members.ts @@ -1,5 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import * as util from '../util'; import { getESLintCoreRule } from '../util/getESLintCoreRule'; @@ -23,7 +24,7 @@ const schema = Object.values( }, }, ), -); +) as JSONSchema4[]; export default util.createRule({ name: 'lines-between-class-members', diff --git a/packages/eslint-plugin/src/rules/member-delimiter-style.ts b/packages/eslint-plugin/src/rules/member-delimiter-style.ts index 62fe1cd9079d..fb14ad32910c 100644 --- a/packages/eslint-plugin/src/rules/member-delimiter-style.ts +++ b/packages/eslint-plugin/src/rules/member-delimiter-style.ts @@ -1,5 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import * as util from '../util'; @@ -47,30 +48,6 @@ type MakeFixFunctionReturnType = | ((fixer: TSESLint.RuleFixer) => TSESLint.RuleFix) | null; -const definition = { - type: 'object', - properties: { - multiline: { - type: 'object', - properties: { - delimiter: { enum: ['none', 'semi', 'comma'] }, - requireLast: { type: 'boolean' }, - }, - additionalProperties: false, - }, - singleline: { - type: 'object', - properties: { - // note can't have "none" for single line delimiter as it's invalid syntax - delimiter: { enum: ['semi', 'comma'] }, - requireLast: { type: 'boolean' }, - }, - additionalProperties: false, - }, - }, - additionalProperties: false, -}; - const isLastTokenEndOfLine = (token: LastTokenType, line: string): boolean => { const positionInLine = token.loc.start.column; @@ -132,6 +109,29 @@ const makeFixFunction = ({ }; }; +const BASE_SCHEMA: JSONSchema4 = { + type: 'object', + properties: { + multiline: { + type: 'object', + properties: { + delimiter: { $ref: '#/items/0/$defs/multiLineOption' }, + requireLast: { type: 'boolean' }, + }, + additionalProperties: false, + }, + singleline: { + type: 'object', + properties: { + delimiter: { $ref: '#/items/0/$defs/singleLineOption' }, + requireLast: { type: 'boolean' }, + }, + additionalProperties: false, + }, + }, + additionalProperties: false, +}; + export default util.createRule({ name: 'member-delimiter-style', meta: { @@ -149,20 +149,32 @@ export default util.createRule({ }, schema: [ { + $defs: { + multiLineOption: { enum: ['none', 'semi', 'comma'] }, + // note can't have "none" for single line delimiter as it's invalid syntax + singleLineOption: { enum: ['semi', 'comma'] }, + // note - need to define this last as it references the enums + delimiterConfig: BASE_SCHEMA, + }, type: 'object', - properties: Object.assign({}, definition.properties, { + properties: { + ...BASE_SCHEMA.properties, overrides: { type: 'object', properties: { - interface: definition, - typeLiteral: definition, + interface: { + $ref: '#/items/0/$defs/delimiterConfig', + }, + typeLiteral: { + $ref: '#/items/0/$defs/delimiterConfig', + }, }, additionalProperties: false, }, multilineDetection: { enum: ['brackets', 'last-member'], }, - }), + }, additionalProperties: false, }, ], diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index bc25dc8ce2bc..10139c155c97 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -85,42 +85,34 @@ const neverConfig: JSONSchema.JSONSchema4 = { enum: ['never'], }; -const arrayConfig = (memberTypes: MemberType[]): JSONSchema.JSONSchema4 => ({ +const arrayConfig = (memberTypes: string): JSONSchema.JSONSchema4 => ({ type: 'array', items: { oneOf: [ { - enum: memberTypes, + $ref: memberTypes, }, { type: 'array', items: { - enum: memberTypes, + $ref: memberTypes, }, }, ], }, }); -const objectConfig = (memberTypes: MemberType[]): JSONSchema.JSONSchema4 => ({ +const objectConfig = (memberTypes: string): JSONSchema.JSONSchema4 => ({ type: 'object', properties: { memberTypes: { oneOf: [arrayConfig(memberTypes), neverConfig], }, order: { - type: 'string', - enum: [ - 'alphabetically', - 'alphabetically-case-insensitive', - 'as-written', - 'natural', - 'natural-case-insensitive', - ], + $ref: '#/items/0/$defs/orderOptions', }, optionalityOrder: { - type: 'string', - enum: ['optional-first', 'required-first'], + $ref: '#/items/0/$defs/optionalityOrderOptions', }, }, additionalProperties: false, @@ -635,70 +627,68 @@ export default util.createRule({ }, schema: [ { - type: 'object', - properties: { - default: { - oneOf: [ - neverConfig, - arrayConfig(allMemberTypes), - objectConfig(allMemberTypes), + $defs: { + orderOptions: { + type: 'string', + enum: [ + 'alphabetically', + 'alphabetically-case-insensitive', + 'as-written', + 'natural', + 'natural-case-insensitive', ], }, - classes: { - oneOf: [ - neverConfig, - arrayConfig(allMemberTypes), - objectConfig(allMemberTypes), + optionalityOrderOptions: { + type: 'string', + enum: ['optional-first', 'required-first'], + }, + allItems: { + type: 'string', + enum: allMemberTypes, + }, + typeItems: { + type: 'string', + enum: [ + 'readonly-signature', + 'signature', + 'readonly-field', + 'field', + 'method', + 'constructor', ], }, - classExpressions: { + + baseConfig: { oneOf: [ neverConfig, - arrayConfig(allMemberTypes), - objectConfig(allMemberTypes), + arrayConfig('#/items/0/$defs/allItems'), + objectConfig('#/items/0/$defs/allItems'), ], }, - interfaces: { + typesConfig: { oneOf: [ neverConfig, - arrayConfig([ - 'readonly-signature', - 'signature', - 'readonly-field', - 'field', - 'method', - 'constructor', - ]), - objectConfig([ - 'readonly-signature', - 'signature', - 'readonly-field', - 'field', - 'method', - 'constructor', - ]), + arrayConfig('#/items/0/$defs/typeItems'), + objectConfig('#/items/0/$defs/typeItems'), ], }, + }, + type: 'object', + properties: { + default: { + $ref: '#/items/0/$defs/baseConfig', + }, + classes: { + $ref: '#/items/0/$defs/baseConfig', + }, + classExpressions: { + $ref: '#/items/0/$defs/baseConfig', + }, + interfaces: { + $ref: '#/items/0/$defs/typesConfig', + }, typeLiterals: { - oneOf: [ - neverConfig, - arrayConfig([ - 'readonly-signature', - 'signature', - 'readonly-field', - 'field', - 'method', - 'constructor', - ]), - objectConfig([ - 'readonly-signature', - 'signature', - 'readonly-field', - 'field', - 'method', - 'constructor', - ]), - ], + $ref: '#/items/0/$defs/typesConfig', }, }, additionalProperties: false, diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index 16f811dc118b..7356f00fbc59 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -9,13 +9,6 @@ type Values = | 'in-unions' | 'in-intersections' | 'in-unions-and-intersections'; -const enumValues: Values[] = [ - 'always', - 'never', - 'in-unions', - 'in-intersections', - 'in-unions-and-intersections', -]; type Options = [ { @@ -55,40 +48,54 @@ export default util.createRule({ }, schema: [ { + $defs: { + expandedOptions: { + enum: [ + 'always', + 'never', + 'in-unions', + 'in-intersections', + 'in-unions-and-intersections', + ] satisfies Values[], + }, + simpleOptions: { + enum: ['always', 'never'], + }, + }, type: 'object', properties: { allowAliases: { description: 'Whether to allow direct one-to-one type aliases.', - enum: enumValues, + $ref: '#/items/0/$defs/expandedOptions', }, allowCallbacks: { description: 'Whether to allow type aliases for callbacks.', - enum: ['always', 'never'], + $ref: '#/items/0/$defs/simpleOptions', }, allowConditionalTypes: { description: 'Whether to allow type aliases for conditional types.', - enum: ['always', 'never'], + $ref: '#/items/0/$defs/simpleOptions', }, allowConstructors: { description: 'Whether to allow type aliases with constructors.', - enum: ['always', 'never'], + $ref: '#/items/0/$defs/simpleOptions', }, allowLiterals: { description: 'Whether to allow type aliases with object literal types.', - enum: enumValues, + $ref: '#/items/0/$defs/expandedOptions', }, allowMappedTypes: { description: 'Whether to allow type aliases with mapped types.', - enum: enumValues, + $ref: '#/items/0/$defs/expandedOptions', }, allowTupleTypes: { description: 'Whether to allow type aliases with tuple types.', - enum: enumValues, + $ref: '#/items/0/$defs/expandedOptions', }, allowGenerics: { description: 'Whether to allow type aliases with generic types.', - enum: ['always', 'never'], + $ref: '#/items/0/$defs/simpleOptions', }, }, additionalProperties: false, diff --git a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts index 37d7b18d6355..f3ad45e9dc5e 100644 --- a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts +++ b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts @@ -39,15 +39,6 @@ type MessageIds = | 'unexpectedSpaceBefore' | 'unexpectedSpaceBetween'; -const definition = { - type: 'object', - properties: { - before: { type: 'boolean' }, - after: { type: 'boolean' }, - }, - additionalProperties: false, -}; - function createRules(options?: Config): WhitespaceRules { const globals = { ...(options?.before !== undefined ? { before: options.before } : {}), @@ -127,6 +118,16 @@ export default util.createRule({ }, schema: [ { + $defs: { + spacingConfig: { + type: 'object', + properties: { + before: { type: 'boolean' }, + after: { type: 'boolean' }, + }, + additionalProperties: false, + }, + }, type: 'object', properties: { before: { type: 'boolean' }, @@ -134,12 +135,12 @@ export default util.createRule({ overrides: { type: 'object', properties: { - colon: definition, - arrow: definition, - variable: definition, - parameter: definition, - property: definition, - returnType: definition, + colon: { $ref: '#/items/0/$defs/spacingConfig' }, + arrow: { $ref: '#/items/0/$defs/spacingConfig' }, + variable: { $ref: '#/items/0/$defs/spacingConfig' }, + parameter: { $ref: '#/items/0/$defs/spacingConfig' }, + property: { $ref: '#/items/0/$defs/spacingConfig' }, + returnType: { $ref: '#/items/0/$defs/spacingConfig' }, }, additionalProperties: false, }, diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot b/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot index 9e19fee531bd..6b5cf0a4a419 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot @@ -6,13 +6,51 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { + "$defs": { + "delimiterConfig": { + "additionalProperties": false, + "properties": { + "multiline": { + "additionalProperties": false, + "properties": { + "delimiter": { + "$ref": "#/items/0/$defs/multiLineOption" + }, + "requireLast": { + "type": "boolean" + } + }, + "type": "object" + }, + "singleline": { + "additionalProperties": false, + "properties": { + "delimiter": { + "$ref": "#/items/0/$defs/singleLineOption" + }, + "requireLast": { + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "multiLineOption": { + "enum": ["comma", "none", "semi"] + }, + "singleLineOption": { + "enum": ["comma", "semi"] + } + }, "additionalProperties": false, "properties": { "multiline": { "additionalProperties": false, "properties": { "delimiter": { - "enum": ["comma", "none", "semi"] + "$ref": "#/items/0/$defs/multiLineOption" }, "requireLast": { "type": "boolean" @@ -27,64 +65,10 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "interface": { - "additionalProperties": false, - "properties": { - "multiline": { - "additionalProperties": false, - "properties": { - "delimiter": { - "enum": ["comma", "none", "semi"] - }, - "requireLast": { - "type": "boolean" - } - }, - "type": "object" - }, - "singleline": { - "additionalProperties": false, - "properties": { - "delimiter": { - "enum": ["comma", "semi"] - }, - "requireLast": { - "type": "boolean" - } - }, - "type": "object" - } - }, - "type": "object" + "$ref": "#/items/0/$defs/delimiterConfig" }, "typeLiteral": { - "additionalProperties": false, - "properties": { - "multiline": { - "additionalProperties": false, - "properties": { - "delimiter": { - "enum": ["comma", "none", "semi"] - }, - "requireLast": { - "type": "boolean" - } - }, - "type": "object" - }, - "singleline": { - "additionalProperties": false, - "properties": { - "delimiter": { - "enum": ["comma", "semi"] - }, - "requireLast": { - "type": "boolean" - } - }, - "type": "object" - } - }, - "type": "object" + "$ref": "#/items/0/$defs/delimiterConfig" } }, "type": "object" @@ -93,7 +77,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "delimiter": { - "enum": ["comma", "semi"] + "$ref": "#/items/0/$defs/singleLineOption" }, "requireLast": { "type": "boolean" @@ -109,37 +93,34 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: +type MultiLineOption = 'comma' | 'none' | 'semi'; + +type SingleLineOption = 'comma' | 'semi'; + +type DelimiterConfig = { + multiline?: { + delimiter?: MultiLineOption; + requireLast?: boolean; + }; + singleline?: { + delimiter?: SingleLineOption; + requireLast?: boolean; + }; +}; + type Options = [ { multiline?: { - delimiter?: 'comma' | 'none' | 'semi'; + delimiter?: MultiLineOption; requireLast?: boolean; }; multilineDetection?: 'brackets' | 'last-member'; overrides?: { - interface?: { - multiline?: { - delimiter?: 'comma' | 'none' | 'semi'; - requireLast?: boolean; - }; - singleline?: { - delimiter?: 'comma' | 'semi'; - requireLast?: boolean; - }; - }; - typeLiteral?: { - multiline?: { - delimiter?: 'comma' | 'none' | 'semi'; - requireLast?: boolean; - }; - singleline?: { - delimiter?: 'comma' | 'semi'; - requireLast?: boolean; - }; - }; + interface?: DelimiterConfig; + typeLiteral?: DelimiterConfig; }; singleline?: { - delimiter?: 'comma' | 'semi'; + delimiter?: SingleLineOption; requireLast?: boolean; }; }, diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot index 483ea0bc2c3d..c6e04d7150c3 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot @@ -6,9 +6,144 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "additionalProperties": false, - "properties": { - "classes": { + "$defs": { + "allItems": { + "enum": [ + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", + "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", + "#private-static-readonly-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", + "decorated-field", + "decorated-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", + "instance-field", + "instance-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", + "private-decorated-field", + "private-decorated-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", + "private-instance-field", + "private-instance-get", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", + "private-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", + "private-static-method", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", + "protected-constructor", + "protected-decorated-field", + "protected-decorated-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", + "protected-instance-get", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", + "protected-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", + "protected-static-set", + "protected-static-static-initialization", + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", + "public-decorated-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", + "public-instance-get", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", + "public-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", + "public-static-set", + "public-static-static-initialization", + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" + ], + "type": "string" + }, + "baseConfig": { "oneOf": [ { "enum": ["never"], @@ -18,275 +153,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "items": { "oneOf": [ { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] + "$ref": "#/items/0/$defs/allItems" }, { "items": { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] + "$ref": "#/items/0/$defs/allItems" }, "type": "array" } @@ -303,275 +174,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "items": { "oneOf": [ { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] + "$ref": "#/items/0/$defs/allItems" }, { "items": { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] + "$ref": "#/items/0/$defs/allItems" }, "type": "array" } @@ -586,25 +193,42 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos ] }, "optionalityOrder": { - "enum": ["optional-first", "required-first"], - "type": "string" + "$ref": "#/items/0/$defs/optionalityOrderOptions" }, "order": { - "enum": [ - "alphabetically", - "alphabetically-case-insensitive", - "as-written", - "natural", - "natural-case-insensitive" - ], - "type": "string" + "$ref": "#/items/0/$defs/orderOptions" } }, "type": "object" } ] }, - "classExpressions": { + "optionalityOrderOptions": { + "enum": ["optional-first", "required-first"], + "type": "string" + }, + "orderOptions": { + "enum": [ + "alphabetically", + "alphabetically-case-insensitive", + "as-written", + "natural", + "natural-case-insensitive" + ], + "type": "string" + }, + "typeItems": { + "enum": [ + "constructor", + "field", + "method", + "readonly-field", + "readonly-signature", + "signature" + ], + "type": "string" + }, + "typesConfig": { "oneOf": [ { "enum": ["never"], @@ -614,275 +238,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "items": { "oneOf": [ { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] + "$ref": "#/items/0/$defs/typeItems" }, { "items": { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] + "$ref": "#/items/0/$defs/typeItems" }, "type": "array" } @@ -899,275 +259,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "items": { "oneOf": [ { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] + "$ref": "#/items/0/$defs/typeItems" }, { "items": { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] + "$ref": "#/items/0/$defs/typeItems" }, "type": "array" } @@ -1182,811 +278,33 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos ] }, "optionalityOrder": { - "enum": ["optional-first", "required-first"], - "type": "string" + "$ref": "#/items/0/$defs/optionalityOrderOptions" }, "order": { - "enum": [ - "alphabetically", - "alphabetically-case-insensitive", - "as-written", - "natural", - "natural-case-insensitive" - ], - "type": "string" + "$ref": "#/items/0/$defs/orderOptions" } }, "type": "object" } ] + } + }, + "additionalProperties": false, + "properties": { + "classes": { + "$ref": "#/items/0/$defs/baseConfig" + }, + "classExpressions": { + "$ref": "#/items/0/$defs/baseConfig" }, "default": { - "oneOf": [ - { - "enum": ["never"], - "type": "string" - }, - { - "items": { - "oneOf": [ - { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] - }, - { - "items": { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] - }, - "type": "array" - } - ] - }, - "type": "array" - }, - { - "additionalProperties": false, - "properties": { - "memberTypes": { - "oneOf": [ - { - "items": { - "oneOf": [ - { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] - }, - { - "items": { - "enum": [ - "#private-field", - "#private-get", - "#private-instance-field", - "#private-instance-get", - "#private-instance-method", - "#private-instance-readonly-field", - "#private-instance-set", - "#private-instance-static-initialization", - "#private-method", - "#private-readonly-field", - "#private-set", - "#private-static-field", - "#private-static-get", - "#private-static-method", - "#private-static-readonly-field", - "#private-static-set", - "#private-static-static-initialization", - "abstract-field", - "abstract-get", - "abstract-method", - "abstract-readonly-field", - "abstract-set", - "abstract-static-initialization", - "call-signature", - "constructor", - "decorated-field", - "decorated-get", - "decorated-method", - "decorated-readonly-field", - "decorated-set", - "field", - "get", - "instance-field", - "instance-get", - "instance-method", - "instance-readonly-field", - "instance-set", - "instance-static-initialization", - "method", - "private-constructor", - "private-decorated-field", - "private-decorated-get", - "private-decorated-method", - "private-decorated-readonly-field", - "private-decorated-set", - "private-field", - "private-get", - "private-instance-field", - "private-instance-get", - "private-instance-method", - "private-instance-readonly-field", - "private-instance-set", - "private-instance-static-initialization", - "private-method", - "private-readonly-field", - "private-set", - "private-static-field", - "private-static-get", - "private-static-method", - "private-static-readonly-field", - "private-static-set", - "private-static-static-initialization", - "protected-abstract-field", - "protected-abstract-get", - "protected-abstract-method", - "protected-abstract-readonly-field", - "protected-abstract-set", - "protected-abstract-static-initialization", - "protected-constructor", - "protected-decorated-field", - "protected-decorated-get", - "protected-decorated-method", - "protected-decorated-readonly-field", - "protected-decorated-set", - "protected-field", - "protected-get", - "protected-instance-field", - "protected-instance-get", - "protected-instance-method", - "protected-instance-readonly-field", - "protected-instance-set", - "protected-instance-static-initialization", - "protected-method", - "protected-readonly-field", - "protected-set", - "protected-static-field", - "protected-static-get", - "protected-static-method", - "protected-static-readonly-field", - "protected-static-set", - "protected-static-static-initialization", - "public-abstract-field", - "public-abstract-get", - "public-abstract-method", - "public-abstract-readonly-field", - "public-abstract-set", - "public-abstract-static-initialization", - "public-constructor", - "public-decorated-field", - "public-decorated-get", - "public-decorated-method", - "public-decorated-readonly-field", - "public-decorated-set", - "public-field", - "public-get", - "public-instance-field", - "public-instance-get", - "public-instance-method", - "public-instance-readonly-field", - "public-instance-set", - "public-instance-static-initialization", - "public-method", - "public-readonly-field", - "public-set", - "public-static-field", - "public-static-get", - "public-static-method", - "public-static-readonly-field", - "public-static-set", - "public-static-static-initialization", - "readonly-field", - "readonly-signature", - "set", - "signature", - "static-field", - "static-get", - "static-initialization", - "static-method", - "static-readonly-field", - "static-set", - "static-static-initialization" - ] - }, - "type": "array" - } - ] - }, - "type": "array" - }, - { - "enum": ["never"], - "type": "string" - } - ] - }, - "optionalityOrder": { - "enum": ["optional-first", "required-first"], - "type": "string" - }, - "order": { - "enum": [ - "alphabetically", - "alphabetically-case-insensitive", - "as-written", - "natural", - "natural-case-insensitive" - ], - "type": "string" - } - }, - "type": "object" - } - ] + "$ref": "#/items/0/$defs/baseConfig" }, "interfaces": { - "oneOf": [ - { - "enum": ["never"], - "type": "string" - }, - { - "items": { - "oneOf": [ - { - "enum": [ - "constructor", - "field", - "method", - "readonly-field", - "readonly-signature", - "signature" - ] - }, - { - "items": { - "enum": [ - "constructor", - "field", - "method", - "readonly-field", - "readonly-signature", - "signature" - ] - }, - "type": "array" - } - ] - }, - "type": "array" - }, - { - "additionalProperties": false, - "properties": { - "memberTypes": { - "oneOf": [ - { - "items": { - "oneOf": [ - { - "enum": [ - "constructor", - "field", - "method", - "readonly-field", - "readonly-signature", - "signature" - ] - }, - { - "items": { - "enum": [ - "constructor", - "field", - "method", - "readonly-field", - "readonly-signature", - "signature" - ] - }, - "type": "array" - } - ] - }, - "type": "array" - }, - { - "enum": ["never"], - "type": "string" - } - ] - }, - "optionalityOrder": { - "enum": ["optional-first", "required-first"], - "type": "string" - }, - "order": { - "enum": [ - "alphabetically", - "alphabetically-case-insensitive", - "as-written", - "natural", - "natural-case-insensitive" - ], - "type": "string" - } - }, - "type": "object" - } - ] + "$ref": "#/items/0/$defs/typesConfig" }, "typeLiterals": { - "oneOf": [ - { - "enum": ["never"], - "type": "string" - }, - { - "items": { - "oneOf": [ - { - "enum": [ - "constructor", - "field", - "method", - "readonly-field", - "readonly-signature", - "signature" - ] - }, - { - "items": { - "enum": [ - "constructor", - "field", - "method", - "readonly-field", - "readonly-signature", - "signature" - ] - }, - "type": "array" - } - ] - }, - "type": "array" - }, - { - "additionalProperties": false, - "properties": { - "memberTypes": { - "oneOf": [ - { - "items": { - "oneOf": [ - { - "enum": [ - "constructor", - "field", - "method", - "readonly-field", - "readonly-signature", - "signature" - ] - }, - { - "items": { - "enum": [ - "constructor", - "field", - "method", - "readonly-field", - "readonly-signature", - "signature" - ] - }, - "type": "array" - } - ] - }, - "type": "array" - }, - { - "enum": ["never"], - "type": "string" - } - ] - }, - "optionalityOrder": { - "enum": ["optional-first", "required-first"], - "type": "string" - }, - "order": { - "enum": [ - "alphabetically", - "alphabetically-case-insensitive", - "as-written", - "natural", - "natural-case-insensitive" - ], - "type": "string" - } - }, - "type": "object" - } - ] + "$ref": "#/items/0/$defs/typesConfig" } }, "type": "object" @@ -1996,1753 +314,181 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: +type OrderOptions = + | 'alphabetically-case-insensitive' + | 'alphabetically' + | 'as-written' + | 'natural-case-insensitive' + | 'natural'; + +type OptionalityOrderOptions = 'optional-first' | 'required-first'; + +type AllItems = + | '#private-field' + | '#private-get' + | '#private-instance-field' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' + | '#private-method' + | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' + | '#private-static-method' + | '#private-static-readonly-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' + | 'call-signature' + | 'constructor' + | 'decorated-field' + | 'decorated-get' + | 'decorated-method' + | 'decorated-readonly-field' + | 'decorated-set' + | 'field' + | 'get' + | 'instance-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' + | 'instance-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' + | 'private-decorated-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' + | 'private-decorated-set' + | 'private-field' + | 'private-get' + | 'private-instance-field' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' + | 'private-instance-set' + | 'private-instance-static-initialization' + | 'private-method' + | 'private-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' + | 'private-static-method' + | 'private-static-readonly-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' + | 'protected-constructor' + | 'protected-decorated-field' + | 'protected-decorated-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' + | 'protected-instance-field' + | 'protected-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' + | 'protected-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' + | 'protected-static-method' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' + | 'public-constructor' + | 'public-decorated-field' + | 'public-decorated-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' + | 'public-instance-get' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' + | 'public-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' + | 'public-static-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' + | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' + | 'static-static-initialization'; + +type TypeItems = + | 'constructor' + | 'field' + | 'method' + | 'readonly-field' + | 'readonly-signature' + | 'signature'; + +type BaseConfig = + | 'never' + | (AllItems[] | AllItems)[] + | { + memberTypes?: 'never' | (AllItems[] | AllItems)[]; + optionalityOrder?: OptionalityOrderOptions; + order?: OrderOptions; + }; + +type TypesConfig = + | 'never' + | (TypeItems[] | TypeItems)[] + | { + memberTypes?: 'never' | (TypeItems[] | TypeItems)[]; + optionalityOrder?: OptionalityOrderOptions; + order?: OrderOptions; + }; + type Options = [ { - classes?: - | 'never' - | ( - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - ) - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - )[] - )[] - | { - memberTypes?: - | 'never' - | ( - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - ) - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - )[] - )[]; - optionalityOrder?: 'optional-first' | 'required-first'; - order?: - | 'alphabetically-case-insensitive' - | 'alphabetically' - | 'as-written' - | 'natural-case-insensitive' - | 'natural'; - }; - classExpressions?: - | 'never' - | ( - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - ) - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - )[] - )[] - | { - memberTypes?: - | 'never' - | ( - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - ) - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - )[] - )[]; - optionalityOrder?: 'optional-first' | 'required-first'; - order?: - | 'alphabetically-case-insensitive' - | 'alphabetically' - | 'as-written' - | 'natural-case-insensitive' - | 'natural'; - }; - default?: - | 'never' - | ( - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - ) - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - )[] - )[] - | { - memberTypes?: - | 'never' - | ( - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - ) - | ( - | '#private-field' - | '#private-get' - | '#private-instance-field' - | '#private-instance-get' - | '#private-instance-method' - | '#private-instance-readonly-field' - | '#private-instance-set' - | '#private-instance-static-initialization' - | '#private-method' - | '#private-readonly-field' - | '#private-set' - | '#private-static-field' - | '#private-static-get' - | '#private-static-method' - | '#private-static-readonly-field' - | '#private-static-set' - | '#private-static-static-initialization' - | 'abstract-field' - | 'abstract-get' - | 'abstract-method' - | 'abstract-readonly-field' - | 'abstract-set' - | 'abstract-static-initialization' - | 'call-signature' - | 'constructor' - | 'decorated-field' - | 'decorated-get' - | 'decorated-method' - | 'decorated-readonly-field' - | 'decorated-set' - | 'field' - | 'get' - | 'instance-field' - | 'instance-get' - | 'instance-method' - | 'instance-readonly-field' - | 'instance-set' - | 'instance-static-initialization' - | 'method' - | 'private-constructor' - | 'private-decorated-field' - | 'private-decorated-get' - | 'private-decorated-method' - | 'private-decorated-readonly-field' - | 'private-decorated-set' - | 'private-field' - | 'private-get' - | 'private-instance-field' - | 'private-instance-get' - | 'private-instance-method' - | 'private-instance-readonly-field' - | 'private-instance-set' - | 'private-instance-static-initialization' - | 'private-method' - | 'private-readonly-field' - | 'private-set' - | 'private-static-field' - | 'private-static-get' - | 'private-static-method' - | 'private-static-readonly-field' - | 'private-static-set' - | 'private-static-static-initialization' - | 'protected-abstract-field' - | 'protected-abstract-get' - | 'protected-abstract-method' - | 'protected-abstract-readonly-field' - | 'protected-abstract-set' - | 'protected-abstract-static-initialization' - | 'protected-constructor' - | 'protected-decorated-field' - | 'protected-decorated-get' - | 'protected-decorated-method' - | 'protected-decorated-readonly-field' - | 'protected-decorated-set' - | 'protected-field' - | 'protected-get' - | 'protected-instance-field' - | 'protected-instance-get' - | 'protected-instance-method' - | 'protected-instance-readonly-field' - | 'protected-instance-set' - | 'protected-instance-static-initialization' - | 'protected-method' - | 'protected-readonly-field' - | 'protected-set' - | 'protected-static-field' - | 'protected-static-get' - | 'protected-static-method' - | 'protected-static-readonly-field' - | 'protected-static-set' - | 'protected-static-static-initialization' - | 'public-abstract-field' - | 'public-abstract-get' - | 'public-abstract-method' - | 'public-abstract-readonly-field' - | 'public-abstract-set' - | 'public-abstract-static-initialization' - | 'public-constructor' - | 'public-decorated-field' - | 'public-decorated-get' - | 'public-decorated-method' - | 'public-decorated-readonly-field' - | 'public-decorated-set' - | 'public-field' - | 'public-get' - | 'public-instance-field' - | 'public-instance-get' - | 'public-instance-method' - | 'public-instance-readonly-field' - | 'public-instance-set' - | 'public-instance-static-initialization' - | 'public-method' - | 'public-readonly-field' - | 'public-set' - | 'public-static-field' - | 'public-static-get' - | 'public-static-method' - | 'public-static-readonly-field' - | 'public-static-set' - | 'public-static-static-initialization' - | 'readonly-field' - | 'readonly-signature' - | 'set' - | 'signature' - | 'static-field' - | 'static-get' - | 'static-initialization' - | 'static-method' - | 'static-readonly-field' - | 'static-set' - | 'static-static-initialization' - )[] - )[]; - optionalityOrder?: 'optional-first' | 'required-first'; - order?: - | 'alphabetically-case-insensitive' - | 'alphabetically' - | 'as-written' - | 'natural-case-insensitive' - | 'natural'; - }; - interfaces?: - | 'never' - | ( - | ( - | 'constructor' - | 'field' - | 'method' - | 'readonly-field' - | 'readonly-signature' - | 'signature' - ) - | ( - | 'constructor' - | 'field' - | 'method' - | 'readonly-field' - | 'readonly-signature' - | 'signature' - )[] - )[] - | { - memberTypes?: - | 'never' - | ( - | ( - | 'constructor' - | 'field' - | 'method' - | 'readonly-field' - | 'readonly-signature' - | 'signature' - ) - | ( - | 'constructor' - | 'field' - | 'method' - | 'readonly-field' - | 'readonly-signature' - | 'signature' - )[] - )[]; - optionalityOrder?: 'optional-first' | 'required-first'; - order?: - | 'alphabetically-case-insensitive' - | 'alphabetically' - | 'as-written' - | 'natural-case-insensitive' - | 'natural'; - }; - typeLiterals?: - | 'never' - | ( - | ( - | 'constructor' - | 'field' - | 'method' - | 'readonly-field' - | 'readonly-signature' - | 'signature' - ) - | ( - | 'constructor' - | 'field' - | 'method' - | 'readonly-field' - | 'readonly-signature' - | 'signature' - )[] - )[] - | { - memberTypes?: - | 'never' - | ( - | ( - | 'constructor' - | 'field' - | 'method' - | 'readonly-field' - | 'readonly-signature' - | 'signature' - ) - | ( - | 'constructor' - | 'field' - | 'method' - | 'readonly-field' - | 'readonly-signature' - | 'signature' - )[] - )[]; - optionalityOrder?: 'optional-first' | 'required-first'; - order?: - | 'alphabetically-case-insensitive' - | 'alphabetically' - | 'as-written' - | 'natural-case-insensitive' - | 'natural'; - }; + classes?: BaseConfig; + classExpressions?: BaseConfig; + default?: BaseConfig; + interfaces?: TypesConfig; + typeLiterals?: TypesConfig; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot index 4d3337557272..045b85293fda 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot @@ -6,10 +6,8 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "additionalProperties": false, - "properties": { - "allowAliases": { - "description": "Whether to allow direct one-to-one type aliases.", + "$defs": { + "expandedOptions": { "enum": [ "always", "in-intersections", @@ -18,51 +16,43 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "never" ] }, - "allowCallbacks": { - "description": "Whether to allow type aliases for callbacks.", + "simpleOptions": { "enum": ["always", "never"] + } + }, + "additionalProperties": false, + "properties": { + "allowAliases": { + "$ref": "#/items/0/$defs/expandedOptions", + "description": "Whether to allow direct one-to-one type aliases." + }, + "allowCallbacks": { + "$ref": "#/items/0/$defs/simpleOptions", + "description": "Whether to allow type aliases for callbacks." }, "allowConditionalTypes": { - "description": "Whether to allow type aliases for conditional types.", - "enum": ["always", "never"] + "$ref": "#/items/0/$defs/simpleOptions", + "description": "Whether to allow type aliases for conditional types." }, "allowConstructors": { - "description": "Whether to allow type aliases with constructors.", - "enum": ["always", "never"] + "$ref": "#/items/0/$defs/simpleOptions", + "description": "Whether to allow type aliases with constructors." }, "allowGenerics": { - "description": "Whether to allow type aliases with generic types.", - "enum": ["always", "never"] + "$ref": "#/items/0/$defs/simpleOptions", + "description": "Whether to allow type aliases with generic types." }, "allowLiterals": { - "description": "Whether to allow type aliases with object literal types.", - "enum": [ - "always", - "in-intersections", - "in-unions", - "in-unions-and-intersections", - "never" - ] + "$ref": "#/items/0/$defs/expandedOptions", + "description": "Whether to allow type aliases with object literal types." }, "allowMappedTypes": { - "description": "Whether to allow type aliases with mapped types.", - "enum": [ - "always", - "in-intersections", - "in-unions", - "in-unions-and-intersections", - "never" - ] + "$ref": "#/items/0/$defs/expandedOptions", + "description": "Whether to allow type aliases with mapped types." }, "allowTupleTypes": { - "description": "Whether to allow type aliases with tuple types.", - "enum": [ - "always", - "in-intersections", - "in-unions", - "in-unions-and-intersections", - "never" - ] + "$ref": "#/items/0/$defs/expandedOptions", + "description": "Whether to allow type aliases with tuple types." } }, "type": "object" @@ -72,44 +62,33 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: +type ExpandedOptions = + | 'always' + | 'in-intersections' + | 'in-unions-and-intersections' + | 'in-unions' + | 'never'; + +type SimpleOptions = 'always' | 'never'; + type Options = [ { /** Whether to allow direct one-to-one type aliases. */ - allowAliases?: - | 'always' - | 'in-intersections' - | 'in-unions-and-intersections' - | 'in-unions' - | 'never'; + allowAliases?: ExpandedOptions; /** Whether to allow type aliases for callbacks. */ - allowCallbacks?: 'always' | 'never'; + allowCallbacks?: SimpleOptions; /** Whether to allow type aliases for conditional types. */ - allowConditionalTypes?: 'always' | 'never'; + allowConditionalTypes?: SimpleOptions; /** Whether to allow type aliases with constructors. */ - allowConstructors?: 'always' | 'never'; + allowConstructors?: SimpleOptions; /** Whether to allow type aliases with generic types. */ - allowGenerics?: 'always' | 'never'; + allowGenerics?: SimpleOptions; /** Whether to allow type aliases with object literal types. */ - allowLiterals?: - | 'always' - | 'in-intersections' - | 'in-unions-and-intersections' - | 'in-unions' - | 'never'; + allowLiterals?: ExpandedOptions; /** Whether to allow type aliases with mapped types. */ - allowMappedTypes?: - | 'always' - | 'in-intersections' - | 'in-unions-and-intersections' - | 'in-unions' - | 'never'; + allowMappedTypes?: ExpandedOptions; /** Whether to allow type aliases with tuple types. */ - allowTupleTypes?: - | 'always' - | 'in-intersections' - | 'in-unions-and-intersections' - | 'in-unions' - | 'never'; + allowTupleTypes?: ExpandedOptions; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot index 777af409d0b3..5fc608ca4bce 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot @@ -6,6 +6,20 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { + "$defs": { + "spacingConfig": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + } + }, "additionalProperties": false, "properties": { "after": { @@ -18,76 +32,22 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "arrow": { - "additionalProperties": false, - "properties": { - "after": { - "type": "boolean" - }, - "before": { - "type": "boolean" - } - }, - "type": "object" + "$ref": "#/items/0/$defs/spacingConfig" }, "colon": { - "additionalProperties": false, - "properties": { - "after": { - "type": "boolean" - }, - "before": { - "type": "boolean" - } - }, - "type": "object" + "$ref": "#/items/0/$defs/spacingConfig" }, "parameter": { - "additionalProperties": false, - "properties": { - "after": { - "type": "boolean" - }, - "before": { - "type": "boolean" - } - }, - "type": "object" + "$ref": "#/items/0/$defs/spacingConfig" }, "property": { - "additionalProperties": false, - "properties": { - "after": { - "type": "boolean" - }, - "before": { - "type": "boolean" - } - }, - "type": "object" + "$ref": "#/items/0/$defs/spacingConfig" }, "returnType": { - "additionalProperties": false, - "properties": { - "after": { - "type": "boolean" - }, - "before": { - "type": "boolean" - } - }, - "type": "object" + "$ref": "#/items/0/$defs/spacingConfig" }, "variable": { - "additionalProperties": false, - "properties": { - "after": { - "type": "boolean" - }, - "before": { - "type": "boolean" - } - }, - "type": "object" + "$ref": "#/items/0/$defs/spacingConfig" } }, "type": "object" @@ -100,35 +60,22 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: +type SpacingConfig = { + after?: boolean; + before?: boolean; +}; + type Options = [ { after?: boolean; before?: boolean; overrides?: { - arrow?: { - after?: boolean; - before?: boolean; - }; - colon?: { - after?: boolean; - before?: boolean; - }; - parameter?: { - after?: boolean; - before?: boolean; - }; - property?: { - after?: boolean; - before?: boolean; - }; - returnType?: { - after?: boolean; - before?: boolean; - }; - variable?: { - after?: boolean; - before?: boolean; - }; + arrow?: SpacingConfig; + colon?: SpacingConfig; + parameter?: SpacingConfig; + property?: SpacingConfig; + returnType?: SpacingConfig; + variable?: SpacingConfig; }; }, ]; diff --git a/packages/eslint-plugin/tests/schemas.test.ts b/packages/eslint-plugin/tests/schemas.test.ts index 616f9e7565fa..19cf8280c5b1 100644 --- a/packages/eslint-plugin/tests/schemas.test.ts +++ b/packages/eslint-plugin/tests/schemas.test.ts @@ -1,6 +1,7 @@ import 'jest-specific-snapshot'; import { compile } from '@typescript-eslint/rule-schema-to-typescript-types'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import fs, { mkdirSync } from 'fs'; import path from 'path'; import { format, resolveConfig } from 'prettier'; @@ -128,7 +129,7 @@ const VALID_SCHEMA_PROPS = new Set([ 'title', 'type', 'uniqueItems', -]); +] satisfies (keyof JSONSchema4)[]); describe('Rules should only define valid keys on schemas', () => { for (const [ruleName, ruleDef] of Object.entries(rules)) { (ruleName === ONLY ? it.only : it)(ruleName, () => { diff --git a/packages/rule-schema-to-typescript-types/src/index.ts b/packages/rule-schema-to-typescript-types/src/index.ts index 4742d5aa06ec..bd7eb7f86c11 100644 --- a/packages/rule-schema-to-typescript-types/src/index.ts +++ b/packages/rule-schema-to-typescript-types/src/index.ts @@ -10,8 +10,8 @@ type RefMap = ReadonlyMap< string >; interface GeneratedResult { - code: string; - commentLines?: string[]; + readonly code: string; + readonly commentLines?: string[]; } class NotSupportedError extends Error { @@ -42,9 +42,15 @@ const prettierConfig = { */ const MAX_ITEMS_TO_TUPLIZE = 20; -export function compile(schemaIn: JSONSchema4 | JSONSchema4[]): string { +function isArray(arg: unknown): arg is readonly unknown[] { + return Array.isArray(arg); +} + +export function compile( + schemaIn: JSONSchema4 | readonly JSONSchema4[], +): string { const { schema, isArraySchema } = (() => { - if (Array.isArray(schemaIn)) { + if (isArray(schemaIn)) { return { schema: schemaIn, isArraySchema: true, @@ -110,7 +116,7 @@ function toPascalCase(key: string): string { } // keywords we probably should support but currently do not support -const UNSUPPORTED_KEYWORDS = new Set([ +const UNSUPPORTED_KEYWORDS = new Set([ 'allOf', 'dependencies', 'extends', @@ -119,7 +125,7 @@ const UNSUPPORTED_KEYWORDS = new Set([ 'multipleOf', 'not', 'patternProperties', -]); +] satisfies (keyof JSONSchema4)[]); function generateType(schema: JSONSchema4, refMap: RefMap): GeneratedResult { const unsupportedProps = Object.keys(schema).filter(key => @@ -135,7 +141,9 @@ function generateType(schema: JSONSchema4, refMap: RefMap): GeneratedResult { const refName = refMap.get(schema.$ref); if (refName == null) { throw new UnexpectedError( - `Could not find definition for $ref ${schema.$ref}`, + `Could not find definition for $ref ${ + schema.$ref + }.\nAvailable refs:\n${Array.from(refMap.keys()).join('\n')})`, schema, ); } @@ -166,7 +174,7 @@ function generateType(schema: JSONSchema4, refMap: RefMap): GeneratedResult { }; } - if (Array.isArray(schema.type)) { + if (isArray(schema.type)) { throw new NotSupportedError('schemas with multiple types', schema); } if (schema.type == null) { @@ -226,7 +234,10 @@ function printUnionType(members: (string | GeneratedResult)[]): string { }) .join('\n'); } -function generateUnionType(members: JSONSchema4Type[], refMap: RefMap): string { +function generateUnionType( + members: (JSONSchema4 | JSONSchema4Type)[], + refMap: RefMap, +): string { const memberStrings: GeneratedResult[] = []; for (const memberSchema of members) { @@ -274,7 +285,7 @@ function generateArrayType( // but that's obviously dumb and loose so let's not even bother with it throw new UnexpectedError('Unexpected missing items', schema); } - if (schema.items && !Array.isArray(schema.items) && schema.additionalItems) { + if (schema.items && !isArray(schema.items) && schema.additionalItems) { throw new NotSupportedError( 'singlely-typed array with additionalItems', schema, @@ -294,7 +305,7 @@ function generateArrayType( let items: JSONSchema4[]; let spreadItemSchema: JSONSchema4 | null = null; - if (!Array.isArray(schema.items)) { + if (!isArray(schema.items)) { if (hasMinItems || hasMaxItems) { // treat as a tuple items = Array( @@ -432,9 +443,7 @@ function generateObjectType( } const properties: string[] = []; - const required = new Set( - Array.isArray(schema.required) ? schema.required : [], - ); + const required = new Set(isArray(schema.required) ? schema.required : []); if (schema.properties) { const propertyDefs = Object.entries(schema.properties) // sort the properties so that we get consistent output regardless diff --git a/packages/website/plugins/generated-rule-docs.ts b/packages/website/plugins/generated-rule-docs.ts index 51eccfafefa0..cd219cbf3f82 100644 --- a/packages/website/plugins/generated-rule-docs.ts +++ b/packages/website/plugins/generated-rule-docs.ts @@ -253,7 +253,10 @@ export const generatedRuleDocs: Plugin = () => { optionsH2Index += 2; - if (meta.schema.length === 0) { + const hasConfig = Array.isArray(meta.schema) + ? meta.schema.length === 0 + : Object.keys(meta.schema).length === 0; + if (!hasConfig) { children.splice(optionsH2Index + 1, 0, { children: [ { diff --git a/patches/@types+json-schema+7.0.11.patch b/patches/@types+json-schema+7.0.11.patch new file mode 100644 index 000000000000..33f3206e1acb --- /dev/null +++ b/patches/@types+json-schema+7.0.11.patch @@ -0,0 +1,35 @@ +diff --git a/node_modules/@types/json-schema/index.d.ts b/node_modules/@types/json-schema/index.d.ts +index 7a92dec..44d9691 100755 +--- a/node_modules/@types/json-schema/index.d.ts ++++ b/node_modules/@types/json-schema/index.d.ts +@@ -154,9 +154,18 @@ export interface JSONSchema4 { + */ + additionalProperties?: boolean | JSONSchema4 | undefined; + ++ /** ++ * Reusable definitions that can be referenced via `$ref` ++ */ + definitions?: { + [k: string]: JSONSchema4; + } | undefined; ++ /** ++ * Reusable definitions that can be referenced via `$ref` ++ */ ++ $defs?: { ++ [k: string]: JSONSchema4; ++ } | undefined; + + /** + * This attribute is an object with property definitions that define the +@@ -232,11 +241,6 @@ export interface JSONSchema4 { + */ + extends?: string | string[] | undefined; + +- /** +- * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6 +- */ +- [k: string]: any; +- + format?: string | undefined; + } + From d396ce976e3e6dbd8532b129d21e255eb2adb829 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 14 Apr 2023 11:16:30 +0930 Subject: [PATCH 07/16] fix ci --- packages/eslint-plugin/src/rules/enum-utils/shared.ts | 2 +- packages/eslint-plugin/src/rules/no-restricted-imports.ts | 2 -- packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/eslint-plugin/src/rules/enum-utils/shared.ts b/packages/eslint-plugin/src/rules/enum-utils/shared.ts index 6a3349143aa6..e629d00e7be7 100644 --- a/packages/eslint-plugin/src/rules/enum-utils/shared.ts +++ b/packages/eslint-plugin/src/rules/enum-utils/shared.ts @@ -1,4 +1,4 @@ -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../../util'; diff --git a/packages/eslint-plugin/src/rules/no-restricted-imports.ts b/packages/eslint-plugin/src/rules/no-restricted-imports.ts index a1981e772bbd..ccb36881256d 100644 --- a/packages/eslint-plugin/src/rules/no-restricted-imports.ts +++ b/packages/eslint-plugin/src/rules/no-restricted-imports.ts @@ -40,7 +40,6 @@ const arrayOfStringsOrObjects: JSONSchema4 = { }, allowTypeImports: { type: 'boolean', - default: false, }, }, additionalProperties: false, @@ -89,7 +88,6 @@ const arrayOfStringsOrObjectPatterns: JSONSchema4 = { }, allowTypeImports: { type: 'boolean', - default: false, }, }, additionalProperties: false, diff --git a/packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts b/packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts index ac7a64727bcb..80b610d751e0 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts @@ -1,5 +1,5 @@ import type { TSESTree } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; From e67b3bf178163b620def2066b138c844007426d1 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 14 Apr 2023 11:52:42 +0930 Subject: [PATCH 08/16] fix ci again --- .../tests/schema-snapshots/no-restricted-imports.shot | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot index 5549d66f1f06..95b3c47be3ae 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot @@ -16,7 +16,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowTypeImports": { - "default": false, "type": "boolean" }, "importNames": { @@ -57,7 +56,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowTypeImports": { - "default": false, "type": "boolean" }, "importNames": { @@ -96,7 +94,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowTypeImports": { - "default": false, "type": "boolean" }, "caseSensitive": { From 455f07791350ae1c2a2ccb6023bdf37b0c2a591f Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 18 Apr 2023 13:56:16 +0930 Subject: [PATCH 09/16] review comments --- .../eslint-plugin/src/rules/array-type.ts | 2 +- .../rules/padding-line-between-statements.ts | 46 +++--- .../tests/rules/ban-types.test.ts | 21 +++ .../tests/schema-snapshots/array-type.shot | 4 +- .../tests/schema-snapshots/ban-types.shot | 14 +- .../padding-line-between-statements.shot | 148 +++++++++--------- .../website/plugins/generated-rule-docs.ts | 4 +- 7 files changed, 134 insertions(+), 105 deletions(-) diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index dba2d7be00fe..e6e78b6e0f4d 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -115,7 +115,7 @@ export default util.createRule({ properties: { default: { $ref: '#/items/0/$defs/arrayOption', - description: 'The array type expected for mutable cases...', + description: 'The array type expected for mutable cases.', }, readonly: { $ref: '#/items/0/$defs/arrayOption', diff --git a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts index d92eb197ad16..5c1825a9d027 100644 --- a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts +++ b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts @@ -594,37 +594,35 @@ export default util.createRule({ }, fixable: 'whitespace', hasSuggestions: false, - schema: { - $defs: { - paddingType: { - enum: Object.keys(PaddingTypes), - }, - statementType: { - anyOf: [ - { enum: Object.keys(StatementTypes) }, - { - type: 'array', - items: { enum: Object.keys(StatementTypes) }, - minItems: 1, - uniqueItems: true, - additionalItems: false, - }, - ], + schema: [ + { + $defs: { + paddingType: { + enum: Object.keys(PaddingTypes), + }, + statementType: { + anyOf: [ + { enum: Object.keys(StatementTypes) }, + { + type: 'array', + items: { enum: Object.keys(StatementTypes) }, + minItems: 1, + uniqueItems: true, + additionalItems: false, + }, + ], + }, }, - }, - type: 'array', - items: { type: 'object', properties: { - blankLine: { $ref: '#/$defs/paddingType' }, - prev: { $ref: '#/$defs/statementType' }, - next: { $ref: '#/$defs/statementType' }, + blankLine: { $ref: '#/items/0/$defs/paddingType' }, + prev: { $ref: '#/items/0/$defs/statementType' }, + next: { $ref: '#/items/0/$defs/statementType' }, }, additionalProperties: false, required: ['blankLine', 'prev', 'next'], }, - additionalItems: false, - }, + ], messages: { unexpectedBlankLine: 'Unexpected blank line before this statement.', expectedBlankLine: 'Expected blank line before this statement.', diff --git a/packages/eslint-plugin/tests/rules/ban-types.test.ts b/packages/eslint-plugin/tests/rules/ban-types.test.ts index 831d17a59a16..440142c1044c 100644 --- a/packages/eslint-plugin/tests/rules/ban-types.test.ts +++ b/packages/eslint-plugin/tests/rules/ban-types.test.ts @@ -657,6 +657,27 @@ let baz: object = {}; }, ], }, + { + code: 'let a: Foo;', + errors: [ + { + messageId: 'bannedTypeMessage', + data: { + name: 'Foo', + customMessage: '', + }, + line: 1, + column: 8, + }, + ], + options: [ + { + types: { + Foo: true, + }, + }, + ], + }, ...objectReduceKey( TYPE_KEYWORDS, (acc: TSESLint.InvalidTestCase[], key) => { diff --git a/packages/eslint-plugin/tests/schema-snapshots/array-type.shot b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot index ba521b1c8351..c397f881f7df 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/array-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot @@ -14,7 +14,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "properties": { "default": { "$ref": "#/items/0/$defs/arrayOption", - "description": "The array type expected for mutable cases..." + "description": "The array type expected for mutable cases." }, "readonly": { "$ref": "#/items/0/$defs/arrayOption", @@ -32,7 +32,7 @@ type ArrayOption = 'array-simple' | 'array' | 'generic'; type Options = [ { - /** The array type expected for mutable cases... */ + /** The array type expected for mutable cases. */ default?: ArrayOption; /** The array type expected for readonly cases. If omitted, the value for \`default\` will be used. */ readonly?: ArrayOption; diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot index 8c024ea803a8..b88476ad0fc6 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot @@ -30,12 +30,20 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "description": "Bans a type", "properties": { "fixWith": { - "description": "Type to autofix replace with.", + "description": "Type to autofix replace with. Note that autofixers can be applied automatically - so you need to be careful with this option.", "type": "string" }, "message": { "description": "Custom error message", "type": "string" + }, + "suggest": { + "additionalItems": false, + "description": "Types to suggest replacing with.", + "items": { + "type": "string" + }, + "type": "array" } }, "type": "object" @@ -69,10 +77,12 @@ type BanConfig = | true /** Bans a type */ | { - /** Type to autofix replace with. */ + /** Type to autofix replace with. Note that autofixers can be applied automatically - so you need to be careful with this option. */ fixWith?: string; /** Custom error message */ message?: string; + /** Types to suggest replacing with. */ + suggest?: string[]; } /** Bans the type with the default message */ | null diff --git a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot index 0ab454b90c05..a507520c50b4 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot @@ -4,60 +4,15 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos " # SCHEMA: -{ - "$defs": { - "paddingType": { - "enum": ["always", "any", "never"] - }, - "statementType": { - "anyOf": [ - { - "enum": [ - "*", - "block", - "block-like", - "break", - "case", - "class", - "const", - "continue", - "debugger", - "default", - "directive", - "do", - "empty", - "export", - "exports", - "expression", - "for", - "function", - "if", - "iife", - "import", - "interface", - "let", - "multiline-block-like", - "multiline-const", - "multiline-expression", - "multiline-let", - "multiline-var", - "require", - "return", - "singleline-const", - "singleline-let", - "singleline-var", - "switch", - "throw", - "try", - "type", - "var", - "while", - "with" - ] - }, - { - "additionalItems": false, - "items": { +[ + { + "$defs": { + "paddingType": { + "enum": ["always", "any", "never"] + }, + "statementType": { + "anyOf": [ + { "enum": [ "*", "block", @@ -101,32 +56,75 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "with" ] }, - "minItems": 1, - "type": "array", - "uniqueItems": true - } - ] - } - }, - "additionalItems": false, - "items": { + { + "additionalItems": false, + "items": { + "enum": [ + "*", + "block", + "block-like", + "break", + "case", + "class", + "const", + "continue", + "debugger", + "default", + "directive", + "do", + "empty", + "export", + "exports", + "expression", + "for", + "function", + "if", + "iife", + "import", + "interface", + "let", + "multiline-block-like", + "multiline-const", + "multiline-expression", + "multiline-let", + "multiline-var", + "require", + "return", + "singleline-const", + "singleline-let", + "singleline-var", + "switch", + "throw", + "try", + "type", + "var", + "while", + "with" + ] + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + } + ] + } + }, "additionalProperties": false, "properties": { "blankLine": { - "$ref": "#/$defs/paddingType" + "$ref": "#/items/0/$defs/paddingType" }, "next": { - "$ref": "#/$defs/statementType" + "$ref": "#/items/0/$defs/statementType" }, "prev": { - "$ref": "#/$defs/statementType" + "$ref": "#/items/0/$defs/statementType" } }, "required": ["blankLine", "prev", "next"], "type": "object" - }, - "type": "array" -} + } +] # TYPES: @@ -263,10 +261,12 @@ type StatementType = )[], ]; -type Options = { - blankLine: PaddingType; - next: StatementType; - prev: StatementType; -}[]; +type Options = [ + { + blankLine: PaddingType; + next: StatementType; + prev: StatementType; + }, +]; " `; diff --git a/packages/website/plugins/generated-rule-docs.ts b/packages/website/plugins/generated-rule-docs.ts index cd219cbf3f82..3b515fe35d90 100644 --- a/packages/website/plugins/generated-rule-docs.ts +++ b/packages/website/plugins/generated-rule-docs.ts @@ -253,10 +253,10 @@ export const generatedRuleDocs: Plugin = () => { optionsH2Index += 2; - const hasConfig = Array.isArray(meta.schema) + const hasNoConfig = Array.isArray(meta.schema) ? meta.schema.length === 0 : Object.keys(meta.schema).length === 0; - if (!hasConfig) { + if (hasNoConfig) { children.splice(optionsH2Index + 1, 0, { children: [ { From 27fe656b625f343d57a568fd60620494cc6baeea Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 18 Apr 2023 15:08:44 +0930 Subject: [PATCH 10/16] use TS to simplify types automagically --- .../src/rules/no-restricted-imports.ts | 2 + .../schema-snapshots/func-call-spacing.shot | 20 ++-- .../schema-snapshots/init-declarations.shot | 20 ++-- .../schema-snapshots/naming-convention.shot | 31 +------ .../schema-snapshots/no-extra-parens.shot | 36 ++++---- .../no-restricted-imports.shot | 56 +++++------ .../schema-snapshots/no-unused-vars.shot | 3 +- .../tests/schema-snapshots/semi.shot | 35 +++---- .../schema-snapshots/space-before-blocks.shot | 3 +- .../space-before-function-paren.shot | 3 +- .../package.json | 4 +- .../src/index.ts | 92 ++++++++++++++++++- yarn.lock | 7 ++ 13 files changed, 191 insertions(+), 121 deletions(-) diff --git a/packages/eslint-plugin/src/rules/no-restricted-imports.ts b/packages/eslint-plugin/src/rules/no-restricted-imports.ts index ccb36881256d..17e93f7febaa 100644 --- a/packages/eslint-plugin/src/rules/no-restricted-imports.ts +++ b/packages/eslint-plugin/src/rules/no-restricted-imports.ts @@ -40,6 +40,7 @@ const arrayOfStringsOrObjects: JSONSchema4 = { }, allowTypeImports: { type: 'boolean', + description: 'Disallow value imports, but allow type-only imports.', }, }, additionalProperties: false, @@ -88,6 +89,7 @@ const arrayOfStringsOrObjectPatterns: JSONSchema4 = { }, allowTypeImports: { type: 'boolean', + description: 'Disallow value imports, but allow type-only imports.', }, }, additionalProperties: false, diff --git a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot index ccc0b15f5fb9..31e44789587e 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot @@ -42,16 +42,14 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = - | ( - | [] - | ['always'] - | [ - 'always', - { - allowNewlines?: boolean; - }, - ] - ) - | ([] | ['never']); + | [] + | ['always'] + | [ + 'always', + { + allowNewlines?: boolean; + }, + ] + | ['never']; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot b/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot index 222eed21d915..2b3d70185b6e 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot @@ -42,16 +42,14 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = - | ([] | ['always']) - | ( - | [] - | ['never'] - | [ - 'never', - { - ignoreForLoopInit?: boolean; - }, - ] - ); + | [] + | ['always'] + | ['never'] + | [ + 'never', + { + ignoreForLoopInit?: boolean; + }, + ]; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot index fe9823571782..b3599e95ebb7 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot @@ -1543,8 +1543,8 @@ type MatchRegexConfig = { type FormatOptionsConfig = PredefinedFormats[] | null; -type Options = /** Selector 'default' */ -(| { +type Options = ( + | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; @@ -1572,7 +1572,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Multiple selectors in one config */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1626,7 +1625,6 @@ type Options = /** Selector 'default' */ trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } - /** Selector 'memberLike' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1650,7 +1648,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'property' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1675,7 +1672,6 @@ type Options = /** Selector 'default' */ trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } - /** Selector 'classMethod' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1698,7 +1694,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'method' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1721,7 +1716,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'classProperty' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1745,7 +1739,6 @@ type Options = /** Selector 'default' */ trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } - /** Selector 'class' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1758,7 +1751,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'typeLike' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1771,7 +1763,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'accessor' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1793,7 +1784,6 @@ type Options = /** Selector 'default' */ trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } - /** Selector 'variable' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1814,7 +1804,6 @@ type Options = /** Selector 'default' */ trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } - /** Selector 'function' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1827,7 +1816,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'objectLiteralMethod' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1840,7 +1828,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'variableLike' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1853,7 +1840,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'parameter' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1867,7 +1853,6 @@ type Options = /** Selector 'default' */ trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } - /** Selector 'enum' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1880,7 +1865,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'interface' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1893,7 +1877,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'typeAlias' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1906,7 +1889,6 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'parameterProperty' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1920,7 +1902,6 @@ type Options = /** Selector 'default' */ trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } - /** Selector 'typeProperty' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1934,7 +1915,6 @@ type Options = /** Selector 'default' */ trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } - /** Selector 'objectLiteralProperty' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1948,7 +1928,6 @@ type Options = /** Selector 'default' */ trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } - /** Selector 'typeMethod' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1961,27 +1940,25 @@ type Options = /** Selector 'default' */ suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'enumMember' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('requiresQuotes')[]; + modifiers?: 'requiresQuotes'[]; prefix?: PrefixSuffixConfig; selector: 'enumMember'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } - /** Selector 'typeParameter' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('unused')[]; + modifiers?: 'unused'[]; prefix?: PrefixSuffixConfig; selector: 'typeParameter'; suffix?: PrefixSuffixConfig; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot index 3411a42bbc69..2260ace8be4b 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot @@ -66,24 +66,22 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = - | ( - | [] - | ['all'] - | [ - 'all', - { - allowParensAfterCommentPattern?: string; - conditionalAssign?: boolean; - enforceForArrowConditionals?: boolean; - enforceForFunctionPrototypeMethods?: boolean; - enforceForNewInMemberExpressions?: boolean; - enforceForSequenceExpressions?: boolean; - ignoreJSX?: 'all' | 'multi-line' | 'none' | 'single-line'; - nestedBinaryExpressions?: boolean; - returnAssign?: boolean; - }, - ] - ) - | ([] | ['functions']); + | [] + | ['all'] + | [ + 'all', + { + allowParensAfterCommentPattern?: string; + conditionalAssign?: boolean; + enforceForArrowConditionals?: boolean; + enforceForFunctionPrototypeMethods?: boolean; + enforceForNewInMemberExpressions?: boolean; + enforceForSequenceExpressions?: boolean; + ignoreJSX?: 'all' | 'multi-line' | 'none' | 'single-line'; + nestedBinaryExpressions?: boolean; + returnAssign?: boolean; + }, + ] + | ['functions']; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot index 95b3c47be3ae..19937e101d9f 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot @@ -16,6 +16,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowTypeImports": { + "description": "Disallow value imports, but allow type-only imports.", "type": "boolean" }, "importNames": { @@ -56,6 +57,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowTypeImports": { + "description": "Disallow value imports, but allow type-only imports.", "type": "boolean" }, "importNames": { @@ -94,6 +96,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowTypeImports": { + "description": "Disallow value imports, but allow type-only imports.", "type": "boolean" }, "caseSensitive": { @@ -142,38 +145,39 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = | ( + | string | { + /** Disallow value imports, but allow type-only imports. */ allowTypeImports?: boolean; importNames?: string[]; message?: string; name: string; } - | string )[] - | ( - | [] - | [ - { - paths?: ( - | { - allowTypeImports?: boolean; - importNames?: string[]; - message?: string; - name: string; - } - | string - )[]; - patterns?: - | { - allowTypeImports?: boolean; - caseSensitive?: boolean; - group: [string, ...string[]]; - importNames?: [string, ...string[]]; - message?: string; - }[] - | string[]; - }, - ] - ); + | [] + | [ + { + paths?: ( + | { + /** Disallow value imports, but allow type-only imports. */ + allowTypeImports?: boolean; + importNames?: string[]; + message?: string; + name: string; + } + | string + )[]; + patterns?: + | { + /** Disallow value imports, but allow type-only imports. */ + allowTypeImports?: boolean; + caseSensitive?: boolean; + group: [string, ...string[]]; + importNames?: [string, ...string[]]; + message?: string; + }[] + | string[]; + }, + ]; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot index df5e87ceced5..802a33bfade6 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot @@ -48,7 +48,8 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = [ - | ('all' | 'local') + | 'all' + | 'local' | { args?: 'after-used' | 'all' | 'none'; argsIgnorePattern?: string; diff --git a/packages/eslint-plugin/tests/schema-snapshots/semi.shot b/packages/eslint-plugin/tests/schema-snapshots/semi.shot index 75439c72e818..4af2c9f108ce 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/semi.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/semi.shot @@ -51,25 +51,20 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = - | ( - | [] - | ['always'] - | [ - 'always', - { - omitLastInOneLineBlock?: boolean; - }, - ] - ) - | ( - | [] - | ['never'] - | [ - 'never', - { - beforeStatementContinuationChars?: 'always' | 'any' | 'never'; - }, - ] - ); + | [] + | ['always'] + | [ + 'always', + { + omitLastInOneLineBlock?: boolean; + }, + ] + | ['never'] + | [ + 'never', + { + beforeStatementContinuationChars?: 'always' | 'any' | 'never'; + }, + ]; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot b/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot index 1cc7a00b7d7b..96faea20aa29 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot @@ -33,7 +33,8 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = [ - | ('always' | 'never') + | 'always' + | 'never' | { classes?: 'always' | 'never' | 'off'; functions?: 'always' | 'never' | 'off'; diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot b/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot index 1c2337a29b79..67ca6e24371e 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot @@ -33,7 +33,8 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = [ - | ('always' | 'never') + | 'always' + | 'never' | { anonymous?: 'always' | 'ignore' | 'never'; asyncArrow?: 'always' | 'ignore' | 'never'; diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json index 7a35b1bd4831..ce067d04f5b1 100644 --- a/packages/rule-schema-to-typescript-types/package.json +++ b/packages/rule-schema-to-typescript-types/package.json @@ -35,7 +35,9 @@ "dependencies": { "@types/prettier": "*", "@typescript-eslint/type-utils": "5.59.0", - "prettier": "*" + "@typescript/vfs": "^1.4.0", + "prettier": "*", + "typescript": "*" }, "funding": { "type": "opencollective", diff --git a/packages/rule-schema-to-typescript-types/src/index.ts b/packages/rule-schema-to-typescript-types/src/index.ts index bd7eb7f86c11..2ab374709acf 100644 --- a/packages/rule-schema-to-typescript-types/src/index.ts +++ b/packages/rule-schema-to-typescript-types/src/index.ts @@ -1,7 +1,12 @@ +import { + createFSBackedSystem, + createVirtualTypeScriptEnvironment, +} from '@typescript/vfs'; import { requiresQuoting } from '@typescript-eslint/type-utils'; import type { JSONSchema4, JSONSchema4Type } from 'json-schema'; import path from 'path'; import { format as prettierFormat, resolveConfig } from 'prettier'; +import * as ts from 'typescript'; type RefMap = ReadonlyMap< // ref path @@ -78,10 +83,16 @@ export function compile( const optionsType = isArraySchema ? `type Options = [${typeStrings.join(',')}]` : `type Options = ${typeStrings[0]}`; - return prettierFormat( - [...refTypes, optionsType].join('\n\n'), - prettierConfig, + + const codeWithUnsimplifiedOptions = [...refTypes, optionsType].join('\n\n'); + const simplifiedOptionsType = useTsToSimplifyOptionsType( + codeWithUnsimplifiedOptions, + ); + const codeWithSimplifiedOptions = [...refTypes, simplifiedOptionsType].join( + '\n\n', ); + + return prettierFormat(codeWithSimplifiedOptions, prettierConfig); } function compileSchema( schema: JSONSchema4, @@ -493,3 +504,78 @@ function printComment({ return ['/**', ...commentLines.map(l => ` * ${l}`), ' */', ''].join('\n'); } + +const COMPILER_OPTIONS: ts.CompilerOptions = { + isolatedModules: true, + noEmit: true, + // don't print `| undefined` for optional props + exactOptionalPropertyTypes: true, + target: ts.ScriptTarget.ESNext, +}; +const PROJECT_ROOT = path.resolve(__dirname, '..', '..', '..'); +const FAKE_SCHEMA_FILENAME = 'schema.ts'; +const PRINTER = ts.createPrinter({ + removeComments: false, +}); + +/** + * This function uses TS to analyze and simplify the options type. + * This is a workaround to simplify union types from + * + * type Options = ([] | [T]) | ([] | [U]); + * + * to + * + * type Options = [] | [T] | [U]; + * + * Which happens when schemas nest `oneOf` with array types + */ +function useTsToSimplifyOptionsType(code: string): string { + const system = createFSBackedSystem( + new Map([[FAKE_SCHEMA_FILENAME, code]]), + PROJECT_ROOT, + ts, + ); + const env = createVirtualTypeScriptEnvironment( + system, + [FAKE_SCHEMA_FILENAME], + ts, + COMPILER_OPTIONS, + ); + const program = env.languageService.getProgram(); + if (program == null) { + throw new Error('Unable to get program'); + } + + const sourceFile = program.getSourceFile(FAKE_SCHEMA_FILENAME); + if (sourceFile == null) { + throw new Error('Unable to find source file'); + } + + const checker = program.getTypeChecker(); + for (const node of sourceFile.statements) { + if (ts.isTypeAliasDeclaration(node) && node.name.text === 'Options') { + const type = checker.getTypeAtLocation(node); + const typeNode = checker.typeToTypeNode( + type, + sourceFile, + // force print the type, not the type alias name + ts.NodeBuilderFlags.InTypeAlias | + // we are okay with [] + ts.NodeBuilderFlags.AllowEmptyTuple | + // don't truncate the result at all + ts.NodeBuilderFlags.NoTruncation | + // force multiline objects so prettier will consistently print multiline objects + // rather than only multi-lining if it's too long + ts.NodeBuilderFlags.MultilineObjectLiterals, + ); + return `type Options = ${PRINTER.printNode( + ts.EmitHint.Unspecified, + typeNode!, + sourceFile, + )}`; + } + } + + throw new Error('Unable to find type alias node'); +} diff --git a/yarn.lock b/yarn.lock index 1c5fd5fcd35d..f70027c9cb63 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4064,6 +4064,13 @@ dependencies: "@types/yargs-parser" "*" +"@typescript/vfs@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@typescript/vfs/-/vfs-1.4.0.tgz#2d22985c7666c9d4ce26eb025405e6f156aa32b0" + integrity sha512-Pood7yv5YWMIX+yCHo176OnF8WUlKGImFG7XlsuH14Zb1YN5+dYD3uUtS7lqZtsH7tAveNUi2NzdpQCN0yRbaw== + dependencies: + debug "^4.1.1" + "@webassemblyjs/ast@1.11.1": version "1.11.1" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7" From 9184e36d3bd00134f82076aab3ccfd872c32f8f3 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 18 Apr 2023 16:10:36 +0930 Subject: [PATCH 11/16] fix CI --- .../rules/padding-line-between-statements.ts | 47 +++--- .../padding-line-between-statements.shot | 148 +++++++++--------- .../src/index.ts | 1 + .../website/src/components/lib/jsonSchema.ts | 27 ++-- .../src/components/linter/createLinter.ts | 2 +- 5 files changed, 111 insertions(+), 114 deletions(-) diff --git a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts index 5c1825a9d027..b1e974e1b863 100644 --- a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts +++ b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts @@ -594,35 +594,38 @@ export default util.createRule({ }, fixable: 'whitespace', hasSuggestions: false, - schema: [ - { - $defs: { - paddingType: { - enum: Object.keys(PaddingTypes), - }, - statementType: { - anyOf: [ - { enum: Object.keys(StatementTypes) }, - { - type: 'array', - items: { enum: Object.keys(StatementTypes) }, - minItems: 1, - uniqueItems: true, - additionalItems: false, - }, - ], - }, + // This is intentionally an array schema as you can pass 0..n config objects + schema: { + $defs: { + paddingType: { + enum: Object.keys(PaddingTypes), + }, + statementType: { + anyOf: [ + { enum: Object.keys(StatementTypes) }, + { + type: 'array', + items: { enum: Object.keys(StatementTypes) }, + minItems: 1, + uniqueItems: true, + additionalItems: false, + }, + ], }, + }, + type: 'array', + additionalItems: false, + items: { type: 'object', properties: { - blankLine: { $ref: '#/items/0/$defs/paddingType' }, - prev: { $ref: '#/items/0/$defs/statementType' }, - next: { $ref: '#/items/0/$defs/statementType' }, + blankLine: { $ref: '#/$defs/paddingType' }, + prev: { $ref: '#/$defs/statementType' }, + next: { $ref: '#/$defs/statementType' }, }, additionalProperties: false, required: ['blankLine', 'prev', 'next'], }, - ], + }, messages: { unexpectedBlankLine: 'Unexpected blank line before this statement.', expectedBlankLine: 'Expected blank line before this statement.', diff --git a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot index a507520c50b4..0ab454b90c05 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot @@ -4,15 +4,60 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos " # SCHEMA: -[ - { - "$defs": { - "paddingType": { - "enum": ["always", "any", "never"] - }, - "statementType": { - "anyOf": [ - { +{ + "$defs": { + "paddingType": { + "enum": ["always", "any", "never"] + }, + "statementType": { + "anyOf": [ + { + "enum": [ + "*", + "block", + "block-like", + "break", + "case", + "class", + "const", + "continue", + "debugger", + "default", + "directive", + "do", + "empty", + "export", + "exports", + "expression", + "for", + "function", + "if", + "iife", + "import", + "interface", + "let", + "multiline-block-like", + "multiline-const", + "multiline-expression", + "multiline-let", + "multiline-var", + "require", + "return", + "singleline-const", + "singleline-let", + "singleline-var", + "switch", + "throw", + "try", + "type", + "var", + "while", + "with" + ] + }, + { + "additionalItems": false, + "items": { "enum": [ "*", "block", @@ -56,75 +101,32 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "with" ] }, - { - "additionalItems": false, - "items": { - "enum": [ - "*", - "block", - "block-like", - "break", - "case", - "class", - "const", - "continue", - "debugger", - "default", - "directive", - "do", - "empty", - "export", - "exports", - "expression", - "for", - "function", - "if", - "iife", - "import", - "interface", - "let", - "multiline-block-like", - "multiline-const", - "multiline-expression", - "multiline-let", - "multiline-var", - "require", - "return", - "singleline-const", - "singleline-let", - "singleline-var", - "switch", - "throw", - "try", - "type", - "var", - "while", - "with" - ] - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - } - ] - } - }, + "minItems": 1, + "type": "array", + "uniqueItems": true + } + ] + } + }, + "additionalItems": false, + "items": { "additionalProperties": false, "properties": { "blankLine": { - "$ref": "#/items/0/$defs/paddingType" + "$ref": "#/$defs/paddingType" }, "next": { - "$ref": "#/items/0/$defs/statementType" + "$ref": "#/$defs/statementType" }, "prev": { - "$ref": "#/items/0/$defs/statementType" + "$ref": "#/$defs/statementType" } }, "required": ["blankLine", "prev", "next"], "type": "object" - } -] + }, + "type": "array" +} # TYPES: @@ -261,12 +263,10 @@ type StatementType = )[], ]; -type Options = [ - { - blankLine: PaddingType; - next: StatementType; - prev: StatementType; - }, -]; +type Options = { + blankLine: PaddingType; + next: StatementType; + prev: StatementType; +}[]; " `; diff --git a/packages/rule-schema-to-typescript-types/src/index.ts b/packages/rule-schema-to-typescript-types/src/index.ts index 2ab374709acf..0f3e407819ef 100644 --- a/packages/rule-schema-to-typescript-types/src/index.ts +++ b/packages/rule-schema-to-typescript-types/src/index.ts @@ -47,6 +47,7 @@ const prettierConfig = { */ const MAX_ITEMS_TO_TUPLIZE = 20; +// https://github.com/microsoft/TypeScript/issues/17002 function isArray(arg: unknown): arg is readonly unknown[] { return Array.isArray(arg); } diff --git a/packages/website/src/components/lib/jsonSchema.ts b/packages/website/src/components/lib/jsonSchema.ts index db11292c0847..e9e54efee110 100644 --- a/packages/website/src/components/lib/jsonSchema.ts +++ b/packages/website/src/components/lib/jsonSchema.ts @@ -8,6 +8,11 @@ const defaultRuleSchema: JSONSchema4 = { enum: ['off', 'warn', 'error', 0, 1, 2], }; +// https://github.com/microsoft/TypeScript/issues/17002 +function isArray(arg: unknown): arg is readonly unknown[] { + return isArray(arg); +} + /** * Add the error level to the rule schema items * @@ -18,9 +23,9 @@ const defaultRuleSchema: JSONSchema4 = { */ export function getRuleJsonSchemaWithErrorLevel( name: string, - ruleSchema: JSONSchema4 | JSONSchema4[], + ruleSchema: JSONSchema4 | readonly JSONSchema4[], ): JSONSchema4 { - if (Array.isArray(ruleSchema)) { + if (isArray(ruleSchema)) { return { type: 'array', items: [defaultRuleSchema, ...ruleSchema], @@ -28,20 +33,8 @@ export function getRuleJsonSchemaWithErrorLevel( additionalItems: false, }; } - // TODO: delete this once we update schemas - // example: ban-ts-comment - if (Array.isArray(ruleSchema.prefixItems)) { - const { prefixItems, ...rest } = ruleSchema; - return { - ...rest, - items: [defaultRuleSchema, ...(prefixItems as JSONSchema4[])], - maxItems: ruleSchema.maxItems ? ruleSchema.maxItems + 1 : undefined, - minItems: ruleSchema.minItems ? ruleSchema.minItems + 1 : 1, - additionalItems: false, - }; - } // example: explicit-member-accessibility - if (Array.isArray(ruleSchema.items)) { + if (isArray(ruleSchema.items)) { return { ...ruleSchema, items: [defaultRuleSchema, ...ruleSchema.items], @@ -59,7 +52,7 @@ export function getRuleJsonSchemaWithErrorLevel( }; } // example eqeqeq - if (Array.isArray(ruleSchema.anyOf)) { + if (isArray(ruleSchema.anyOf)) { return { ...ruleSchema, anyOf: ruleSchema.anyOf.map(item => @@ -68,7 +61,7 @@ export function getRuleJsonSchemaWithErrorLevel( }; } // example logical-assignment-operators - if (Array.isArray(ruleSchema.oneOf)) { + if (isArray(ruleSchema.oneOf)) { return { ...ruleSchema, oneOf: ruleSchema.oneOf.map(item => diff --git a/packages/website/src/components/linter/createLinter.ts b/packages/website/src/components/linter/createLinter.ts index 30ba20fe1a43..1daa9ade5a61 100644 --- a/packages/website/src/components/linter/createLinter.ts +++ b/packages/website/src/components/linter/createLinter.ts @@ -21,7 +21,7 @@ export interface CreateLinter { name: string; description?: string; url?: string; - schema: JSONSchema.JSONSchema4; + schema: JSONSchema.JSONSchema4 | readonly JSONSchema.JSONSchema4[]; } >; configs: string[]; From 6d57bbe8e7cf6a786825fd32a7c330733d60d5e0 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Wed, 19 Apr 2023 14:41:03 +0930 Subject: [PATCH 12/16] build to an AST, then optimise AST, print AST --- .../tests/schema-snapshots/array-type.shot | 2 +- .../schema-snapshots/ban-ts-comment.shot | 2 +- .../tests/schema-snapshots/ban-types.shot | 12 +- .../tests/schema-snapshots/comma-dangle.shot | 4 +- .../consistent-type-assertions.shot | 2 +- .../explicit-function-return-type.shot | 4 +- .../explicit-member-accessibility.shot | 6 +- .../explicit-module-boundary-types.shot | 4 +- .../schema-snapshots/func-call-spacing.shot | 4 +- .../tests/schema-snapshots/key-spacing.shot | 6 +- .../schema-snapshots/member-ordering.shot | 16 +- .../schema-snapshots/naming-convention.shot | 225 +++---- .../schema-snapshots/no-extra-parens.shot | 4 +- .../no-invalid-void-type.shot | 2 +- .../no-restricted-imports.shot | 2 +- .../tests/schema-snapshots/no-type-alias.shot | 2 +- .../padding-line-between-statements.shot | 86 ++- .../tests/schema-snapshots/semi.shot | 2 +- .../package.json | 5 +- .../src/errors.ts | 17 + .../src/generateArrayType.ts | 153 +++++ .../src/generateObjectType.ts | 50 ++ .../src/generateType.ts | 124 ++++ .../src/generateUnionType.ts | 53 ++ .../src/getCommentLines.ts | 9 + .../src/index.ts | 548 +----------------- .../src/isArray.ts | 4 + .../src/optimizeAST.ts | 72 +++ .../src/printAST.ts | 168 ++++++ .../src/types.ts | 49 ++ .../website/src/components/lib/jsonSchema.ts | 2 +- yarn.lock | 7 - 32 files changed, 938 insertions(+), 708 deletions(-) create mode 100644 packages/rule-schema-to-typescript-types/src/errors.ts create mode 100644 packages/rule-schema-to-typescript-types/src/generateArrayType.ts create mode 100644 packages/rule-schema-to-typescript-types/src/generateObjectType.ts create mode 100644 packages/rule-schema-to-typescript-types/src/generateType.ts create mode 100644 packages/rule-schema-to-typescript-types/src/generateUnionType.ts create mode 100644 packages/rule-schema-to-typescript-types/src/getCommentLines.ts create mode 100644 packages/rule-schema-to-typescript-types/src/isArray.ts create mode 100644 packages/rule-schema-to-typescript-types/src/optimizeAST.ts create mode 100644 packages/rule-schema-to-typescript-types/src/printAST.ts create mode 100644 packages/rule-schema-to-typescript-types/src/types.ts diff --git a/packages/eslint-plugin/tests/schema-snapshots/array-type.shot b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot index c397f881f7df..da76d7036a86 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/array-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot @@ -28,7 +28,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: -type ArrayOption = 'array-simple' | 'array' | 'generic'; +type ArrayOption = 'array' | 'array-simple' | 'generic'; type Options = [ { diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot index aa8b0accf801..e754ff98ae5d 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot @@ -62,11 +62,11 @@ type DirectiveConfigSchema = type Options = [ { - minimumDescriptionLength?: number; 'ts-check'?: DirectiveConfigSchema; 'ts-expect-error'?: DirectiveConfigSchema; 'ts-ignore'?: DirectiveConfigSchema; 'ts-nocheck'?: DirectiveConfigSchema; + minimumDescriptionLength?: number; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot index b88476ad0fc6..68f35c203ee1 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot @@ -71,10 +71,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type BanConfig = - /** Un-bans the type (useful when paired with \`extendDefaults\`) */ - | false - /** Bans the type with the default message */ - | true /** Bans a type */ | { /** Type to autofix replace with. Note that autofixers can be applied automatically - so you need to be careful with this option. */ @@ -84,10 +80,14 @@ type BanConfig = /** Types to suggest replacing with. */ suggest?: string[]; } + /** Bans the type with a custom message */ + | string /** Bans the type with the default message */ | null - /** Bans the type with a custom message */ - | string; + /** Bans the type with the default message */ + | true + /** Un-bans the type (useful when paired with \`extendDefaults\`) */ + | false; type Options = [ { diff --git a/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot b/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot index 1c55c9db7486..a5b0ca54a315 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot @@ -65,11 +65,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: -type Value = 'always-multiline' | 'always' | 'never' | 'only-multiline'; +type Value = 'always' | 'always-multiline' | 'never' | 'only-multiline'; type ValueWithIgnore = - | 'always-multiline' | 'always' + | 'always-multiline' | 'ignore' | 'never' | 'only-multiline'; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot index c1505a43c05c..04acdfde423c 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot @@ -40,7 +40,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ | { assertionStyle: 'angle-bracket' | 'as'; - objectLiteralTypeAssertions?: 'allow-as-parameter' | 'allow' | 'never'; + objectLiteralTypeAssertions?: 'allow' | 'allow-as-parameter' | 'never'; } | { assertionStyle: 'never'; diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot index 7723682bdaae..9239baf5003a 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot @@ -57,8 +57,6 @@ type Options = [ allowConciseArrowFunctionExpressionsStartingWithVoid?: boolean; /** Whether to ignore arrow functions immediately returning a \`as const\` value. */ allowDirectConstAssertionInArrowFunctions?: boolean; - /** An array of function/method names that will not have their arguments or return values checked. */ - allowedNames?: string[]; /** Whether to ignore function expressions (functions which are not part of a declaration). */ allowExpressions?: boolean; /** Whether to ignore functions that don't have generic type parameters. */ @@ -69,6 +67,8 @@ type Options = [ allowIIFEs?: boolean; /** Whether to ignore type annotations on the variable of function expressions. */ allowTypedFunctionExpressions?: boolean; + /** An array of function/method names that will not have their arguments or return values checked. */ + allowedNames?: string[]; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot index 1c204208d747..f0a2dc9a4fba 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot @@ -67,10 +67,10 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type AccessibilityLevel = /** Always require an accessor. */ | 'explicit' - /** Require an accessor except when public. */ - | 'no-public' /** Never check whether there is an accessor. */ - | 'off'; + | 'off' + /** Require an accessor except when public. */ + | 'no-public'; type Options = [ { diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot index e2d88dc8061a..cd004e5a22bf 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot @@ -48,8 +48,6 @@ type Options = [ * You must still type the parameters of the function. */ allowDirectConstAssertionInArrowFunctions?: boolean; - /** An array of function/method names that will not have their arguments or return values checked. */ - allowedNames?: string[]; /** * Whether to ignore return type annotations on functions immediately returning another function expression. * You must still type the parameters of the function. @@ -57,6 +55,8 @@ type Options = [ allowHigherOrderFunctions?: boolean; /** Whether to ignore type annotations on the variable of a function expresion. */ allowTypedFunctionExpressions?: boolean; + /** An array of function/method names that will not have their arguments or return values checked. */ + allowedNames?: string[]; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot index 31e44789587e..3c9d0f7ed235 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot @@ -44,12 +44,12 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = | [] | ['always'] + | ['never'] | [ 'always', { allowNewlines?: boolean; }, - ] - | ['never']; + ]; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot index 1295849a4b67..d476304884a3 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot @@ -173,7 +173,8 @@ type Options = [ | { afterColon?: boolean; align?: - | ('colon' | 'value') + | 'colon' + | 'value' | { afterColon?: boolean; beforeColon?: boolean; @@ -205,7 +206,8 @@ type Options = [ multiLine?: { afterColon?: boolean; align?: - | ('colon' | 'value') + | 'colon' + | 'value' | { afterColon?: boolean; beforeColon?: boolean; diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot index c6e04d7150c3..d7e2517bb911 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot @@ -315,11 +315,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type OrderOptions = - | 'alphabetically-case-insensitive' | 'alphabetically' + | 'alphabetically-case-insensitive' | 'as-written' - | 'natural-case-insensitive' - | 'natural'; + | 'natural' + | 'natural-case-insensitive'; type OptionalityOrderOptions = 'optional-first' | 'required-first'; @@ -466,26 +466,26 @@ type TypeItems = type BaseConfig = | 'never' - | (AllItems[] | AllItems)[] + | (AllItems | AllItems[])[] | { - memberTypes?: 'never' | (AllItems[] | AllItems)[]; + memberTypes?: 'never' | (AllItems | AllItems[])[]; optionalityOrder?: OptionalityOrderOptions; order?: OrderOptions; }; type TypesConfig = | 'never' - | (TypeItems[] | TypeItems)[] + | (TypeItems | TypeItems[])[] | { - memberTypes?: 'never' | (TypeItems[] | TypeItems)[]; + memberTypes?: 'never' | (TypeItems | TypeItems[])[]; optionalityOrder?: OptionalityOrderOptions; order?: OrderOptions; }; type Options = [ { - classes?: BaseConfig; classExpressions?: BaseConfig; + classes?: BaseConfig; default?: BaseConfig; interfaces?: TypesConfig; typeLiterals?: TypesConfig; diff --git a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot index b3599e95ebb7..c97b0eefc220 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot @@ -1525,12 +1525,12 @@ type UnderscoreOptions = | 'requireDouble'; type PredefinedFormats = - | 'camelCase' | 'PascalCase' - | 'snake_case' - | 'strictCamelCase' | 'StrictPascalCase' - | 'UPPER_CASE'; + | 'UPPER_CASE' + | 'camelCase' + | 'snake_case' + | 'strictCamelCase'; type TypeModifiers = 'array' | 'boolean' | 'function' | 'number' | 'string'; @@ -1543,36 +1543,8 @@ type MatchRegexConfig = { type FormatOptionsConfig = PredefinedFormats[] | null; -type Options = ( - | { - custom?: MatchRegexConfig; - failureMessage?: string; - filter?: MatchRegexConfig | string; - format: FormatOptionsConfig; - leadingUnderscore?: UnderscoreOptions; - modifiers?: ( - | '#private' - | 'abstract' - | 'async' - | 'const' - | 'destructured' - | 'exported' - | 'global' - | 'override' - | 'private' - | 'protected' - | 'public' - | 'readonly' - | 'requiresQuotes' - | 'static' - | 'unused' - )[]; - prefix?: PrefixSuffixConfig; - selector: 'default'; - suffix?: PrefixSuffixConfig; - trailingUnderscore?: UnderscoreOptions; - } - | { +type Options = /** Multiple selectors in one config */ +(| { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; @@ -1625,6 +1597,7 @@ type Options = ( trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } + /** Selector 'accessor' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1632,46 +1605,34 @@ type Options = ( format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; modifiers?: ( - | '#private' | 'abstract' - | 'async' | 'override' | 'private' | 'protected' | 'public' - | 'readonly' | 'requiresQuotes' | 'static' )[]; prefix?: PrefixSuffixConfig; - selector: 'memberLike'; + selector: 'accessor'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'class' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ( - | '#private' - | 'abstract' - | 'async' - | 'override' - | 'private' - | 'protected' - | 'public' - | 'readonly' - | 'requiresQuotes' - | 'static' - )[]; + modifiers?: ('abstract' | 'exported' | 'unused')[]; prefix?: PrefixSuffixConfig; - selector: 'property'; + selector: 'class'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; - types?: TypeModifiers[]; } + /** Selector 'classMethod' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1694,6 +1655,7 @@ type Options = ( suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } + /** Selector 'classProperty' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1703,19 +1665,21 @@ type Options = ( modifiers?: ( | '#private' | 'abstract' - | 'async' | 'override' | 'private' | 'protected' | 'public' + | 'readonly' | 'requiresQuotes' | 'static' )[]; prefix?: PrefixSuffixConfig; - selector: 'method'; + selector: 'classProperty'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'default' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1725,6 +1689,11 @@ type Options = ( modifiers?: ( | '#private' | 'abstract' + | 'async' + | 'const' + | 'destructured' + | 'exported' + | 'global' | 'override' | 'private' | 'protected' @@ -1732,58 +1701,66 @@ type Options = ( | 'readonly' | 'requiresQuotes' | 'static' + | 'unused' )[]; prefix?: PrefixSuffixConfig; - selector: 'classProperty'; + selector: 'default'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; - types?: TypeModifiers[]; } + /** Selector 'enum' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('abstract' | 'exported' | 'unused')[]; + modifiers?: ('exported' | 'unused')[]; prefix?: PrefixSuffixConfig; - selector: 'class'; + selector: 'enum'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } + /** Selector 'enumMember' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('abstract' | 'exported' | 'unused')[]; + modifiers?: ('requiresQuotes')[]; prefix?: PrefixSuffixConfig; - selector: 'typeLike'; + selector: 'enumMember'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } + /** Selector 'function' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ( - | 'abstract' - | 'override' - | 'private' - | 'protected' - | 'public' - | 'requiresQuotes' - | 'static' - )[]; + modifiers?: ('async' | 'exported' | 'global' | 'unused')[]; prefix?: PrefixSuffixConfig; - selector: 'accessor'; + selector: 'function'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; - types?: TypeModifiers[]; } + /** Selector 'interface' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('exported' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'interface'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'memberLike' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1791,31 +1768,46 @@ type Options = ( format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; modifiers?: ( + | '#private' + | 'abstract' | 'async' - | 'const' - | 'destructured' - | 'exported' - | 'global' - | 'unused' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'readonly' + | 'requiresQuotes' + | 'static' )[]; prefix?: PrefixSuffixConfig; - selector: 'variable'; + selector: 'memberLike'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; - types?: TypeModifiers[]; } + /** Selector 'method' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('async' | 'exported' | 'global' | 'unused')[]; + modifiers?: ( + | '#private' + | 'abstract' + | 'async' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'requiresQuotes' + | 'static' + )[]; prefix?: PrefixSuffixConfig; - selector: 'function'; + selector: 'method'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } + /** Selector 'objectLiteralMethod' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1828,18 +1820,21 @@ type Options = ( suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } + /** Selector 'objectLiteralProperty' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('async' | 'unused')[]; + modifiers?: ('public' | 'requiresQuotes')[]; prefix?: PrefixSuffixConfig; - selector: 'variableLike'; + selector: 'objectLiteralProperty'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'parameter' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1853,30 +1848,46 @@ type Options = ( trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } + /** Selector 'parameterProperty' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('exported' | 'unused')[]; + modifiers?: ('private' | 'protected' | 'public' | 'readonly')[]; prefix?: PrefixSuffixConfig; - selector: 'enum'; + selector: 'parameterProperty'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'property' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('exported' | 'unused')[]; + modifiers?: ( + | '#private' + | 'abstract' + | 'async' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'readonly' + | 'requiresQuotes' + | 'static' + )[]; prefix?: PrefixSuffixConfig; - selector: 'interface'; + selector: 'property'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'typeAlias' */ | { custom?: MatchRegexConfig; failureMessage?: string; @@ -1889,78 +1900,90 @@ type Options = ( suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } + /** Selector 'typeLike' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('private' | 'protected' | 'public' | 'readonly')[]; + modifiers?: ('abstract' | 'exported' | 'unused')[]; prefix?: PrefixSuffixConfig; - selector: 'parameterProperty'; + selector: 'typeLike'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; - types?: TypeModifiers[]; } + /** Selector 'typeMethod' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('public' | 'readonly' | 'requiresQuotes')[]; + modifiers?: ('public' | 'requiresQuotes')[]; prefix?: PrefixSuffixConfig; - selector: 'typeProperty'; + selector: 'typeMethod'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; - types?: TypeModifiers[]; } + /** Selector 'typeParameter' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('public' | 'requiresQuotes')[]; + modifiers?: ('unused')[]; prefix?: PrefixSuffixConfig; - selector: 'objectLiteralProperty'; + selector: 'typeParameter'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; - types?: TypeModifiers[]; } + /** Selector 'typeProperty' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('public' | 'requiresQuotes')[]; + modifiers?: ('public' | 'readonly' | 'requiresQuotes')[]; prefix?: PrefixSuffixConfig; - selector: 'typeMethod'; + selector: 'typeProperty'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'variable' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: 'requiresQuotes'[]; + modifiers?: ( + | 'async' + | 'const' + | 'destructured' + | 'exported' + | 'global' + | 'unused' + )[]; prefix?: PrefixSuffixConfig; - selector: 'enumMember'; + selector: 'variable'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; } + /** Selector 'variableLike' */ | { custom?: MatchRegexConfig; failureMessage?: string; filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: 'unused'[]; + modifiers?: ('async' | 'unused')[]; prefix?: PrefixSuffixConfig; - selector: 'typeParameter'; + selector: 'variableLike'; suffix?: PrefixSuffixConfig; trailingUnderscore?: UnderscoreOptions; } diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot index 2260ace8be4b..b260e62f17b6 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot @@ -68,6 +68,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = | [] | ['all'] + | ['functions'] | [ 'all', { @@ -81,7 +82,6 @@ type Options = nestedBinaryExpressions?: boolean; returnAssign?: boolean; }, - ] - | ['functions']; + ]; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot index 0a10715c476c..61f32fe43a8e 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot @@ -36,7 +36,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { allowAsThisParameter?: boolean; - allowInGenericTypeArguments?: string[] | boolean; + allowInGenericTypeArguments?: boolean | string[]; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot index 19937e101d9f..e41e144b41c9 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot @@ -145,7 +145,6 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = | ( - | string | { /** Disallow value imports, but allow type-only imports. */ allowTypeImports?: boolean; @@ -153,6 +152,7 @@ type Options = message?: string; name: string; } + | string )[] | [] | [ diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot index 045b85293fda..16653ab25654 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot @@ -65,8 +65,8 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type ExpandedOptions = | 'always' | 'in-intersections' - | 'in-unions-and-intersections' | 'in-unions' + | 'in-unions-and-intersections' | 'never'; type SimpleOptions = 'always' | 'never'; diff --git a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot index 0ab454b90c05..7e87a4e68563 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot @@ -134,53 +134,51 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type PaddingType = 'always' | 'any' | 'never'; type StatementType = - | ( - | '*' - | 'block-like' - | 'block' - | 'break' - | 'case' - | 'class' - | 'const' - | 'continue' - | 'debugger' - | 'default' - | 'directive' - | 'do' - | 'empty' - | 'export' - | 'exports' - | 'expression' - | 'for' - | 'function' - | 'if' - | 'iife' - | 'import' - | 'interface' - | 'let' - | 'multiline-block-like' - | 'multiline-const' - | 'multiline-expression' - | 'multiline-let' - | 'multiline-var' - | 'require' - | 'return' - | 'singleline-const' - | 'singleline-let' - | 'singleline-var' - | 'switch' - | 'throw' - | 'try' - | 'type' - | 'var' - | 'while' - | 'with' - ) + | '*' + | 'block' + | 'block-like' + | 'break' + | 'case' + | 'class' + | 'const' + | 'continue' + | 'debugger' + | 'default' + | 'directive' + | 'do' + | 'empty' + | 'export' + | 'exports' + | 'expression' + | 'for' + | 'function' + | 'if' + | 'iife' + | 'import' + | 'interface' + | 'let' + | 'multiline-block-like' + | 'multiline-const' + | 'multiline-expression' + | 'multiline-let' + | 'multiline-var' + | 'require' + | 'return' + | 'singleline-const' + | 'singleline-let' + | 'singleline-var' + | 'switch' + | 'throw' + | 'try' + | 'type' + | 'var' + | 'while' + | 'with' | [ ( | '*' - | 'block-like' | 'block' + | 'block-like' | 'break' | 'case' | 'class' @@ -221,8 +219,8 @@ type StatementType = ), ...( | '*' - | 'block-like' | 'block' + | 'block-like' | 'break' | 'case' | 'class' diff --git a/packages/eslint-plugin/tests/schema-snapshots/semi.shot b/packages/eslint-plugin/tests/schema-snapshots/semi.shot index 4af2c9f108ce..cd452fe0cf86 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/semi.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/semi.shot @@ -53,13 +53,13 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = | [] | ['always'] + | ['never'] | [ 'always', { omitLastInOneLineBlock?: boolean; }, ] - | ['never'] | [ 'never', { diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json index ce067d04f5b1..877a3749b9d4 100644 --- a/packages/rule-schema-to-typescript-types/package.json +++ b/packages/rule-schema-to-typescript-types/package.json @@ -35,9 +35,8 @@ "dependencies": { "@types/prettier": "*", "@typescript-eslint/type-utils": "5.59.0", - "@typescript/vfs": "^1.4.0", - "prettier": "*", - "typescript": "*" + "natural-compare-lite": "^1.4.0", + "prettier": "*" }, "funding": { "type": "opencollective", diff --git a/packages/rule-schema-to-typescript-types/src/errors.ts b/packages/rule-schema-to-typescript-types/src/errors.ts new file mode 100644 index 000000000000..aa3168af5f94 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/errors.ts @@ -0,0 +1,17 @@ +export class NotSupportedError extends Error { + constructor(thing: string, target: unknown) { + super( + `Generating a type for ${thing} is not currently supported:\n${JSON.stringify( + target, + null, + 2, + )}`, + ); + } +} + +export class UnexpectedError extends Error { + constructor(error: string, target: unknown) { + super(`Unexpected Error: ${error}:\n${JSON.stringify(target, null, 2)}`); + } +} diff --git a/packages/rule-schema-to-typescript-types/src/generateArrayType.ts b/packages/rule-schema-to-typescript-types/src/generateArrayType.ts new file mode 100644 index 000000000000..cece1fa40255 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/generateArrayType.ts @@ -0,0 +1,153 @@ +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; + +import { NotSupportedError, UnexpectedError } from './errors'; +import { generateType } from './generateType'; +import { getCommentLines } from './getCommentLines'; +import { isArray } from './isArray'; +import type { ArrayAST, AST, RefMap, TupleAST, UnionAST } from './types'; + +/** + * If there are more than 20 tuple items then we will not make it a tuple type + * and instead will just make it an array type for brevity + */ +const MAX_ITEMS_TO_TUPLIZE = 20; + +export function generateArrayType( + schema: JSONSchema4, + refMap: RefMap, +): ArrayAST | TupleAST | UnionAST { + if (!schema.items) { + // it's technically valid to declare things like {type: 'array'} -> any[] + // but that's obviously dumb and loose so let's not even bother with it + throw new UnexpectedError('Unexpected missing items', schema); + } + if (schema.items && !isArray(schema.items) && schema.additionalItems) { + throw new NotSupportedError( + 'singlely-typed array with additionalItems', + schema, + ); + } + + const commentLines = getCommentLines(schema); + + const minItems = schema.minItems ?? 0; + const maxItems = + schema.maxItems != null && schema.maxItems < MAX_ITEMS_TO_TUPLIZE + ? schema.maxItems + : -1; + const hasMinItems = minItems > 0; + const hasMaxItems = maxItems >= 0; + + let items: JSONSchema4[]; + let spreadItemSchema: JSONSchema4 | null = null; + + if (!isArray(schema.items)) { + if (hasMinItems || hasMaxItems) { + // treat as a tuple + items = Array( + (hasMaxItems && maxItems) || minItems || 0, + ).fill(schema.items); + if (!hasMaxItems) { + spreadItemSchema = + typeof schema.additionalItems === 'object' + ? schema.additionalItems + : schema.items; + } + } else { + // treat as an array type + return { + type: 'array', + elementType: generateType(schema.items, refMap), + commentLines, + }; + } + } else { + // treat as a tuple + items = schema.items; + if (hasMaxItems && items.length < maxItems) { + spreadItemSchema = + typeof schema.additionalItems === 'object' + ? schema.additionalItems + : { type: 'any' }; + } + } + + // quick validation so we generate sensible types + if (hasMaxItems && maxItems < items.length) { + throw new UnexpectedError( + `maxItems (${maxItems}) is smaller than the number of items schemas provided (${items.length})`, + schema, + ); + } + if (maxItems > items.length && spreadItemSchema == null) { + throw new UnexpectedError( + 'maxItems is larger than the number of items schemas, but there was not an additionalItems schema provided', + schema, + ); + } + + const itemTypes = items.map(i => generateType(i, refMap)); + const spreadItem = + spreadItemSchema == null ? null : generateType(spreadItemSchema, refMap); + + if (itemTypes.length > minItems) { + /* + if there are more items than the min, we return a union of tuples instead of + using the optional element operator. This is done because it is more type-safe. + + // optional element operator + type A = [string, string?, string?] + const a: A = ['a', undefined, 'c'] // no error + + // union of tuples + type B = [string] | [string, string] | [string, string, string] + const b: B = ['a', undefined, 'c'] // TS error + */ + const cumulativeTypesList = itemTypes.slice(0, minItems); + const typesToUnion: AST[] = []; + if (cumulativeTypesList.length > 0) { + // actually has minItems, so add the initial state + typesToUnion.push(createTupleType(cumulativeTypesList)); + } else { + // no minItems means it's acceptable to have an empty tuple type + typesToUnion.push(createTupleType([])); + } + + for (let i = minItems; i < itemTypes.length; i += 1) { + cumulativeTypesList.push(itemTypes[i]); + + if (i === itemTypes.length - 1) { + // only the last item in the union should have the spread parameter + typesToUnion.push(createTupleType(cumulativeTypesList, spreadItem)); + } else { + typesToUnion.push(createTupleType(cumulativeTypesList)); + } + } + + return { + type: 'union', + elements: typesToUnion, + commentLines, + }; + } + + return { + type: 'tuple', + elements: itemTypes, + spreadType: spreadItem, + commentLines, + }; +} + +function createTupleType( + elements: AST[], + spreadType: AST | null = null, +): TupleAST { + return { + type: 'tuple', + // clone the array because we know we'll keep mutating it + elements: [...elements], + spreadType, + commentLines: [], + }; +} diff --git a/packages/rule-schema-to-typescript-types/src/generateObjectType.ts b/packages/rule-schema-to-typescript-types/src/generateObjectType.ts new file mode 100644 index 000000000000..9ff4b928dcd7 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/generateObjectType.ts @@ -0,0 +1,50 @@ +import { requiresQuoting } from '@typescript-eslint/type-utils'; +import type { JSONSchema4 } from 'json-schema'; + +import { generateType } from './generateType'; +import { getCommentLines } from './getCommentLines'; +import { isArray } from './isArray'; +import type { AST, ObjectAST, RefMap } from './types'; + +export function generateObjectType( + schema: JSONSchema4, + refMap: RefMap, +): ObjectAST { + const commentLines = getCommentLines(schema); + + let indexSignature: AST | null = null; + if (schema.additionalProperties === true) { + indexSignature = { + type: 'type-reference', + typeName: 'unknown', + commentLines: [], + }; + } else if (schema.additionalProperties) { + const indexSigType = generateType(schema.additionalProperties, refMap); + indexSignature = indexSigType; + } + + const properties: ObjectAST['properties'] = []; + const required = new Set(isArray(schema.required) ? schema.required : []); + if (schema.properties) { + const propertyDefs = Object.entries(schema.properties); + for (const [propName, propSchema] of propertyDefs) { + const propType = generateType(propSchema, refMap); + const sanitisedPropName = requiresQuoting(propName) + ? `'${propName}'` + : propName; + properties.push({ + name: sanitisedPropName, + optional: !required.has(propName), + type: propType, + }); + } + } + + return { + type: 'object', + properties, + indexSignature, + commentLines, + }; +} diff --git a/packages/rule-schema-to-typescript-types/src/generateType.ts b/packages/rule-schema-to-typescript-types/src/generateType.ts new file mode 100644 index 000000000000..d6c0efa2890f --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/generateType.ts @@ -0,0 +1,124 @@ +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; + +import { NotSupportedError, UnexpectedError } from './errors'; +import { generateArrayType } from './generateArrayType'; +import { generateObjectType } from './generateObjectType'; +import { generateUnionType } from './generateUnionType'; +import { getCommentLines } from './getCommentLines'; +import { isArray } from './isArray'; +import type { AST, RefMap } from './types'; + +// keywords we probably should support but currently do not support +const UNSUPPORTED_KEYWORDS = new Set([ + 'allOf', + 'dependencies', + 'extends', + 'maxProperties', + 'minProperties', + 'multipleOf', + 'not', + 'patternProperties', +] satisfies (keyof JSONSchema4)[]); + +export function generateType(schema: JSONSchema4, refMap: RefMap): AST { + const unsupportedProps = Object.keys(schema).filter(key => + UNSUPPORTED_KEYWORDS.has(key), + ); + if (unsupportedProps.length > 0) { + throw new NotSupportedError(unsupportedProps.join(','), schema); + } + + const commentLines = getCommentLines(schema); + + if (schema.$ref) { + const refName = refMap.get(schema.$ref); + if (refName == null) { + throw new UnexpectedError( + `Could not find definition for $ref ${ + schema.$ref + }.\nAvailable refs:\n${Array.from(refMap.keys()).join('\n')})`, + schema, + ); + } + return { + type: 'type-reference', + typeName: refName, + commentLines, + }; + } + if (schema.enum) { + return { + ...generateUnionType(schema.enum, refMap), + commentLines, + }; + } + if (schema.anyOf) { + return { + // a union isn't *TECHNICALLY* correct - technically anyOf is actually + // anyOf: [T, U, V] -> T | U | V | T & U | T & V | U & V + // in practice though it is most used to emulate a oneOf + ...generateUnionType(schema.anyOf, refMap), + commentLines, + }; + } + if (schema.oneOf) { + return { + ...generateUnionType(schema.oneOf, refMap), + commentLines, + }; + } + + if (isArray(schema.type)) { + throw new NotSupportedError('schemas with multiple types', schema); + } + if (schema.type == null) { + throw new NotSupportedError( + 'untyped schemas without one of [$ref, enum, oneOf]', + schema, + ); + } + + switch (schema.type) { + case 'any': + return { + type: 'type-reference', + typeName: 'unknown', + commentLines, + }; + + case 'null': + return { + type: 'type-reference', + typeName: 'null', + commentLines, + }; + + case 'number': + case 'string': + return { + type: 'literal', + code: schema.type, + commentLines, + }; + + case 'array': + return generateArrayType(schema, refMap); + + case 'boolean': + return { + type: 'type-reference', + typeName: 'boolean', + commentLines, + }; + + case 'integer': + return { + type: 'type-reference', + typeName: 'number', + commentLines, + }; + + case 'object': + return generateObjectType(schema, refMap); + } +} diff --git a/packages/rule-schema-to-typescript-types/src/generateUnionType.ts b/packages/rule-schema-to-typescript-types/src/generateUnionType.ts new file mode 100644 index 000000000000..9ec9dc3b7bdd --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/generateUnionType.ts @@ -0,0 +1,53 @@ +import type { + JSONSchema4, + JSONSchema4Type, +} from '@typescript-eslint/utils/json-schema'; + +import { NotSupportedError } from './errors'; +import { generateType } from './generateType'; +import type { AST, RefMap, UnionAST } from './types'; + +export function generateUnionType( + members: (JSONSchema4 | JSONSchema4Type)[], + refMap: RefMap, +): UnionAST { + const elements: AST[] = []; + + for (const memberSchema of members) { + elements.push( + ((): AST => { + switch (typeof memberSchema) { + case 'string': + return { + type: 'literal', + code: `'${memberSchema.replace(/'/g, "\\'")}'`, + commentLines: [], + }; + + case 'number': + case 'boolean': + return { + type: 'literal', + code: `${memberSchema}`, + commentLines: [], + }; + + case 'object': + if (memberSchema == null) { + throw new NotSupportedError('null in an enum', memberSchema); + } + if (Array.isArray(memberSchema)) { + throw new NotSupportedError('array in an enum', memberSchema); + } + return generateType(memberSchema, refMap); + } + })(), + ); + } + + return { + type: 'union', + elements, + commentLines: [], + }; +} diff --git a/packages/rule-schema-to-typescript-types/src/getCommentLines.ts b/packages/rule-schema-to-typescript-types/src/getCommentLines.ts new file mode 100644 index 000000000000..675bf374c220 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/getCommentLines.ts @@ -0,0 +1,9 @@ +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; + +export function getCommentLines(schema: JSONSchema4): string[] { + const lines: string[] = []; + if (schema.description) { + lines.push(schema.description); + } + return lines; +} diff --git a/packages/rule-schema-to-typescript-types/src/index.ts b/packages/rule-schema-to-typescript-types/src/index.ts index 0f3e407819ef..3100f122f2dd 100644 --- a/packages/rule-schema-to-typescript-types/src/index.ts +++ b/packages/rule-schema-to-typescript-types/src/index.ts @@ -1,57 +1,18 @@ -import { - createFSBackedSystem, - createVirtualTypeScriptEnvironment, -} from '@typescript/vfs'; -import { requiresQuoting } from '@typescript-eslint/type-utils'; -import type { JSONSchema4, JSONSchema4Type } from 'json-schema'; +import type { JSONSchema4 } from 'json-schema'; import path from 'path'; import { format as prettierFormat, resolveConfig } from 'prettier'; -import * as ts from 'typescript'; -type RefMap = ReadonlyMap< - // ref path - string, - // type name - string ->; -interface GeneratedResult { - readonly code: string; - readonly commentLines?: string[]; -} - -class NotSupportedError extends Error { - constructor(thing: string, target: unknown) { - super( - `Generating a type for ${thing} is not currently supported:\n${JSON.stringify( - target, - null, - 2, - )}`, - ); - } -} -class UnexpectedError extends Error { - constructor(error: string, target: unknown) { - super(`Unexpected Error: ${error}:\n${JSON.stringify(target, null, 2)}`); - } -} +import { generateType } from './generateType'; +import { isArray } from './isArray'; +import { optimizeAST } from './optimizeAST'; +import { printTypeAlias } from './printAST'; +import type { AST } from './types'; const prettierConfig = { ...(resolveConfig.sync(__filename) ?? {}), filepath: path.join(__dirname, 'schema.ts'), }; -/** - * If there are more than 20 tuple items then we will not make it a tuple type - * and instead will just make it an array type for brevity - */ -const MAX_ITEMS_TO_TUPLIZE = 20; - -// https://github.com/microsoft/TypeScript/issues/17002 -function isArray(arg: unknown): arg is readonly unknown[] { - return Array.isArray(arg); -} - export function compile( schemaIn: JSONSchema4 | readonly JSONSchema4[], ): string { @@ -73,32 +34,37 @@ export function compile( } const refTypes: string[] = []; - const types: GeneratedResult[] = []; + const types: AST[] = []; for (let i = 0; i < schema.length; i += 1) { const result = compileSchema(schema[i], i); refTypes.push(...result.refTypes); types.push(result.type); } - const typeStrings = types.map(t => `${printComment(t)}${t.code}`); const optionsType = isArraySchema - ? `type Options = [${typeStrings.join(',')}]` - : `type Options = ${typeStrings[0]}`; - - const codeWithUnsimplifiedOptions = [...refTypes, optionsType].join('\n\n'); - const simplifiedOptionsType = useTsToSimplifyOptionsType( - codeWithUnsimplifiedOptions, - ); - const codeWithSimplifiedOptions = [...refTypes, simplifiedOptionsType].join( - '\n\n', - ); - - return prettierFormat(codeWithSimplifiedOptions, prettierConfig); + ? printTypeAlias('Options', { + type: 'tuple', + elements: types, + spreadType: null, + commentLines: [], + }) + : printTypeAlias('Options', types[0]); + + const unformattedCode = [...refTypes, optionsType].join('\n\n'); + try { + return prettierFormat(unformattedCode, prettierConfig); + } catch (e) { + if (e instanceof Error) { + e.message = e.message + `\n\nUnformatted Code:\n${unformattedCode}`; + } + throw e; + } } + function compileSchema( schema: JSONSchema4, index: number, -): { type: GeneratedResult; refTypes: string[] } { +): { type: AST; refTypes: string[] } { const refTypes: string[] = []; const refMap = new Map(); @@ -113,12 +79,16 @@ function compileSchema( refMap.set(`#/items/${index}/$defs/${defKey}`, typeName); const type = generateType(defSchema, refMap); - refTypes.push(`${printComment(type)}type ${typeName} = ${type.code}`); + optimizeAST(type); + refTypes.push(printTypeAlias(typeName, type)); } } + const type = generateType(schema, refMap); + optimizeAST(type); + return { - type: generateType(schema, refMap), + type, refTypes, }; } @@ -126,457 +96,3 @@ function compileSchema( function toPascalCase(key: string): string { return key[0].toUpperCase() + key.substring(1); } - -// keywords we probably should support but currently do not support -const UNSUPPORTED_KEYWORDS = new Set([ - 'allOf', - 'dependencies', - 'extends', - 'maxProperties', - 'minProperties', - 'multipleOf', - 'not', - 'patternProperties', -] satisfies (keyof JSONSchema4)[]); - -function generateType(schema: JSONSchema4, refMap: RefMap): GeneratedResult { - const unsupportedProps = Object.keys(schema).filter(key => - UNSUPPORTED_KEYWORDS.has(key), - ); - if (unsupportedProps.length > 0) { - throw new NotSupportedError(unsupportedProps.join(','), schema); - } - - const commentLines = getCommentLines(schema); - - if (schema.$ref) { - const refName = refMap.get(schema.$ref); - if (refName == null) { - throw new UnexpectedError( - `Could not find definition for $ref ${ - schema.$ref - }.\nAvailable refs:\n${Array.from(refMap.keys()).join('\n')})`, - schema, - ); - } - return { - code: refName, - commentLines, - }; - } - if (schema.enum) { - return { - code: generateUnionType(schema.enum, refMap), - commentLines, - }; - } - if (schema.anyOf) { - return { - // a union isn't *TECHNICALLY* correct - technically anyOf is actually - // anyOf: [T, U, V] -> T | U | V | T & U | T & V | U & V - // in practice though it is most used to emulate a oneOf - code: generateUnionType(schema.anyOf, refMap), - commentLines, - }; - } - if (schema.oneOf) { - return { - code: generateUnionType(schema.oneOf, refMap), - commentLines, - }; - } - - if (isArray(schema.type)) { - throw new NotSupportedError('schemas with multiple types', schema); - } - if (schema.type == null) { - throw new NotSupportedError( - 'untyped schemas without one of [$ref, enum, oneOf]', - schema, - ); - } - - switch (schema.type) { - case 'any': - return { - code: 'unknown', - commentLines, - }; - - case 'null': - return { - code: 'null', - commentLines, - }; - - case 'number': - case 'string': - return { - code: schema.type, - commentLines, - }; - - case 'array': - return generateArrayType(schema, refMap); - - case 'boolean': - return { - code: 'boolean', - commentLines, - }; - - case 'integer': - return { - code: 'number', - commentLines, - }; - - case 'object': - return generateObjectType(schema, refMap); - } -} - -function printUnionType(members: (string | GeneratedResult)[]): string { - return members - .map(member => { - if (typeof member === 'string') { - return `| ${member}`; - } - return `${printComment(member)} | (${member.code})`; - }) - .join('\n'); -} -function generateUnionType( - members: (JSONSchema4 | JSONSchema4Type)[], - refMap: RefMap, -): string { - const memberStrings: GeneratedResult[] = []; - - for (const memberSchema of members) { - memberStrings.push( - ((): GeneratedResult => { - switch (typeof memberSchema) { - case 'string': - return { - code: `'${memberSchema.replace(/'/g, "\\'")}'`, - }; - - case 'number': - case 'boolean': - return { - code: `${memberSchema}`, - }; - - case 'object': - if (memberSchema == null) { - throw new NotSupportedError('null in an enum', memberSchema); - } - if (Array.isArray(memberSchema)) { - throw new NotSupportedError('array in an enum', memberSchema); - } - return generateType(memberSchema, refMap); - } - })(), - ); - } - - return printUnionType( - memberStrings - // sort the union members so that we get consistent output regardless - // of import declaration order - .sort((a, b) => a.code.localeCompare(b.code)), - ); -} - -function generateArrayType( - schema: JSONSchema4, - refMap: RefMap, -): GeneratedResult { - if (!schema.items) { - // it's technically valid to declare things like {type: 'array'} -> any[] - // but that's obviously dumb and loose so let's not even bother with it - throw new UnexpectedError('Unexpected missing items', schema); - } - if (schema.items && !isArray(schema.items) && schema.additionalItems) { - throw new NotSupportedError( - 'singlely-typed array with additionalItems', - schema, - ); - } - - const commentLines = getCommentLines(schema); - - const minItems = schema.minItems ?? 0; - const maxItems = - schema.maxItems != null && schema.maxItems < MAX_ITEMS_TO_TUPLIZE - ? schema.maxItems - : -1; - const hasMinItems = minItems > 0; - const hasMaxItems = maxItems >= 0; - - let items: JSONSchema4[]; - let spreadItemSchema: JSONSchema4 | null = null; - - if (!isArray(schema.items)) { - if (hasMinItems || hasMaxItems) { - // treat as a tuple - items = Array( - (hasMaxItems && maxItems) || minItems || 0, - ).fill(schema.items); - if (!hasMaxItems) { - spreadItemSchema = - typeof schema.additionalItems === 'object' - ? schema.additionalItems - : schema.items; - } - } else { - // treat as an array type - return { - code: `(${generateType(schema.items, refMap).code})[]`, - commentLines, - }; - } - } else { - // treat as a tuple - items = schema.items; - if (hasMaxItems && items.length < maxItems) { - spreadItemSchema = - typeof schema.additionalItems === 'object' - ? schema.additionalItems - : { type: 'any' }; - } - } - - // quick validation so we generate sensible types - if (hasMaxItems && maxItems < items.length) { - throw new UnexpectedError( - `maxItems (${maxItems}) is smaller than the number of items schemas provided (${items.length})`, - schema, - ); - } - if (maxItems > items.length && spreadItemSchema == null) { - throw new UnexpectedError( - 'maxItems is larger than the number of items schemas, but there was not an additionalItems schema provided', - schema, - ); - } - - const itemTypes = items.map(i => generateType(i, refMap)); - const spreadItem = (() => { - if (spreadItemSchema == null) { - return null; - } - const type = generateType(spreadItemSchema, refMap); - return `${printComment(type)}...(${type.code})[]`; - })(); - - const typesToString = (types: (string | GeneratedResult)[]): string => { - return `[\n${types - .map(t => { - if (typeof t === 'string') { - return t; - } - return `${printComment(t)}${t.code}`; - }) - .join(',\n')}\n]`; - }; - const addSpreadParam = ( - params: (string | GeneratedResult)[], - ): (string | GeneratedResult)[] => { - if (spreadItem) { - params.push(spreadItem); - } - return params; - }; - - if (itemTypes.length > minItems) { - /* - if there are more items than the min, we return a union of tuples instead of - using the optional element operator. This is done because it is more type-safe. - - // optional element operator - type A = [string, string?, string?] - const a: A = ['a', undefined, 'c'] // no error - - // union of tuples - type B = [string] | [string, string] | [string, string, string] - const b: B = ['a', undefined, 'c'] // TS error - */ - const cumulativeTypesList: (string | GeneratedResult)[] = itemTypes.slice( - 0, - minItems, - ); - const typesToUnion: string[] = []; - if (cumulativeTypesList.length > 0) { - // actually has minItems, so add the initial state - typesToUnion.push(typesToString(cumulativeTypesList)); - } else { - // no minItems means it's acceptable to have an empty tuple type - typesToUnion.push(typesToString([])); - } - - for (let i = minItems; i < itemTypes.length; i += 1) { - cumulativeTypesList.push(itemTypes[i]); - - if (i === itemTypes.length - 1) { - // only the last item in the union should have the spread parameter - addSpreadParam(cumulativeTypesList); - } - - typesToUnion.push(typesToString(cumulativeTypesList)); - } - - return { - code: printUnionType(typesToUnion), - commentLines, - }; - } - - return { - code: typesToString(addSpreadParam(itemTypes)), - commentLines, - }; -} - -function generateObjectType( - schema: JSONSchema4, - refMap: RefMap, -): GeneratedResult { - const commentLines = getCommentLines(schema); - - let indexSignature = ''; - if (schema.additionalProperties === true) { - indexSignature = '[k: string]: unknown'; - } else if (schema.additionalProperties) { - const indexSigType = generateType(schema.additionalProperties, refMap); - indexSignature = `${printComment(indexSigType)}[k: string]: ${ - indexSigType.code - }`; - } - - const properties: string[] = []; - const required = new Set(isArray(schema.required) ? schema.required : []); - if (schema.properties) { - const propertyDefs = Object.entries(schema.properties) - // sort the properties so that we get consistent output regardless - // of import declaration order - .sort(([a], [b]) => a.localeCompare(b)); - for (const [propName, propSchema] of propertyDefs) { - const propType = generateType(propSchema, refMap); - const sanitisedPropName = requiresQuoting(propName) - ? `'${propName}'` - : propName; - properties.push( - `${printComment(propType)}${sanitisedPropName}${ - required.has(propName) ? '' : '?' - }: ${propType.code}`, - ); - } - } - - return { - code: ['{', properties.join(';\n'), indexSignature, '}'].join('\n'), - commentLines, - }; -} - -function getCommentLines(schema: JSONSchema4): string[] { - const lines: string[] = []; - if (schema.description) { - lines.push(schema.description); - } - return lines; -} -function printComment({ - commentLines: commentLinesIn, -}: GeneratedResult): string { - if (commentLinesIn == null || commentLinesIn.length === 0) { - return ''; - } - - const commentLines: string[] = []; - for (const line of commentLinesIn) { - commentLines.push(...line.split('\n')); - } - - if (commentLines.length === 1) { - return `/** ${commentLines[0]} */\n`; - } - - return ['/**', ...commentLines.map(l => ` * ${l}`), ' */', ''].join('\n'); -} - -const COMPILER_OPTIONS: ts.CompilerOptions = { - isolatedModules: true, - noEmit: true, - // don't print `| undefined` for optional props - exactOptionalPropertyTypes: true, - target: ts.ScriptTarget.ESNext, -}; -const PROJECT_ROOT = path.resolve(__dirname, '..', '..', '..'); -const FAKE_SCHEMA_FILENAME = 'schema.ts'; -const PRINTER = ts.createPrinter({ - removeComments: false, -}); - -/** - * This function uses TS to analyze and simplify the options type. - * This is a workaround to simplify union types from - * - * type Options = ([] | [T]) | ([] | [U]); - * - * to - * - * type Options = [] | [T] | [U]; - * - * Which happens when schemas nest `oneOf` with array types - */ -function useTsToSimplifyOptionsType(code: string): string { - const system = createFSBackedSystem( - new Map([[FAKE_SCHEMA_FILENAME, code]]), - PROJECT_ROOT, - ts, - ); - const env = createVirtualTypeScriptEnvironment( - system, - [FAKE_SCHEMA_FILENAME], - ts, - COMPILER_OPTIONS, - ); - const program = env.languageService.getProgram(); - if (program == null) { - throw new Error('Unable to get program'); - } - - const sourceFile = program.getSourceFile(FAKE_SCHEMA_FILENAME); - if (sourceFile == null) { - throw new Error('Unable to find source file'); - } - - const checker = program.getTypeChecker(); - for (const node of sourceFile.statements) { - if (ts.isTypeAliasDeclaration(node) && node.name.text === 'Options') { - const type = checker.getTypeAtLocation(node); - const typeNode = checker.typeToTypeNode( - type, - sourceFile, - // force print the type, not the type alias name - ts.NodeBuilderFlags.InTypeAlias | - // we are okay with [] - ts.NodeBuilderFlags.AllowEmptyTuple | - // don't truncate the result at all - ts.NodeBuilderFlags.NoTruncation | - // force multiline objects so prettier will consistently print multiline objects - // rather than only multi-lining if it's too long - ts.NodeBuilderFlags.MultilineObjectLiterals, - ); - return `type Options = ${PRINTER.printNode( - ts.EmitHint.Unspecified, - typeNode!, - sourceFile, - )}`; - } - } - - throw new Error('Unable to find type alias node'); -} diff --git a/packages/rule-schema-to-typescript-types/src/isArray.ts b/packages/rule-schema-to-typescript-types/src/isArray.ts new file mode 100644 index 000000000000..dfd77652a266 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/isArray.ts @@ -0,0 +1,4 @@ +// https://github.com/microsoft/TypeScript/issues/17002 +export function isArray(arg: unknown): arg is readonly unknown[] { + return Array.isArray(arg); +} diff --git a/packages/rule-schema-to-typescript-types/src/optimizeAST.ts b/packages/rule-schema-to-typescript-types/src/optimizeAST.ts new file mode 100644 index 000000000000..ba39aae909a3 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/optimizeAST.ts @@ -0,0 +1,72 @@ +import type { AST, UnionAST } from './types'; + +export function optimizeAST(ast: AST | null): void { + if (ast == null) { + return; + } + + switch (ast.type) { + case 'array': { + optimizeAST(ast.elementType); + return; + } + + case 'literal': + return; + + case 'object': { + for (const property of ast.properties) { + optimizeAST(property.type); + } + optimizeAST(ast.indexSignature); + return; + } + + case 'tuple': { + for (const element of ast.elements) { + optimizeAST(element); + } + optimizeAST(ast.spreadType); + return; + } + + case 'type-reference': + return; + + case 'union': { + const elements = unwrapUnions(ast); + for (const element of elements) { + optimizeAST(element); + } + + // hacky way to deduplicate union members + const uniqueElementsMap = new Map(); + for (const element of elements) { + uniqueElementsMap.set(JSON.stringify(element), element); + } + const uniqueElements = Array.from(uniqueElementsMap.values()); + + // @ts-expect-error -- purposely overwriting the property with a flattened list + ast.elements = uniqueElements; + return; + } + } +} + +function unwrapUnions(union: UnionAST): AST[] { + const elements: AST[] = []; + for (const element of union.elements) { + if (element.type === 'union') { + elements.push(...unwrapUnions(element)); + } else { + elements.push(element); + } + } + + if (elements.length > 0) { + // preserve the union's comment lines by prepending them to the first element's lines + elements[0].commentLines.unshift(...union.commentLines); + } + + return elements; +} diff --git a/packages/rule-schema-to-typescript-types/src/printAST.ts b/packages/rule-schema-to-typescript-types/src/printAST.ts new file mode 100644 index 000000000000..b0a1d57117cc --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/printAST.ts @@ -0,0 +1,168 @@ +import naturalCompare from 'natural-compare-lite'; + +import type { AST, TupleAST } from './types'; + +export function printTypeAlias(aliasName: string, ast: AST): string { + return `${printComment(ast)}type ${aliasName} = ${printAST(ast).code}`; +} + +export function printASTWithComment(ast: AST): string { + const result = printAST(ast); + return `${printComment(result)}${result.code}`; +} + +function printComment({ + commentLines: commentLinesIn, +}: { + readonly commentLines?: string[] | undefined | null; +}): string { + if (commentLinesIn == null || commentLinesIn.length === 0) { + return ''; + } + + const commentLines: string[] = []; + for (const line of commentLinesIn) { + commentLines.push(...line.split('\n')); + } + + if (commentLines.length === 1) { + return `/** ${commentLines[0]} */\n`; + } + + return ['/**', ...commentLines.map(l => ` * ${l}`), ' */', ''].join('\n'); +} + +interface CodeWithComments { + code: string; + commentLines: string[]; +} +function printAST(ast: AST): CodeWithComments { + switch (ast.type) { + case 'array': { + const code = printAndMaybeParenthesise(ast.elementType); + return { + code: `${code.code}[]`, + commentLines: ast.commentLines.concat(code.commentLines), + }; + } + + case 'literal': + return { + code: ast.code, + commentLines: ast.commentLines, + }; + + case 'object': { + const properties = []; + // sort the properties so that we get consistent output regardless + // of import declaration order + const sortedPropertyDefs = ast.properties.sort((a, b) => + naturalCompare(a.name, b.name), + ); + for (const property of sortedPropertyDefs) { + const result = printAST(property.type); + properties.push( + `${printComment(result)}${property.name}${ + property.optional ? '?:' : ':' + } ${result.code}`, + ); + } + + if (ast.indexSignature) { + const result = printAST(ast.indexSignature); + properties.push(`${printComment(result)}[k: string]: ${result.code}`); + } + return { + // force insert a newline so prettier consistently prints all objects as multiline + code: `{\n${properties.join(';\n')}}`, + commentLines: ast.commentLines, + }; + } + + case 'tuple': { + const elements = []; + for (const element of ast.elements) { + elements.push(printASTWithComment(element)); + } + if (ast.spreadType) { + const result = printAndMaybeParenthesise(ast.spreadType); + elements.push(`${printComment(result)}...${result.code}[]`); + } + + return { + code: `[${elements.join(',')}]`, + commentLines: ast.commentLines, + }; + } + + case 'type-reference': + return { + code: ast.typeName, + commentLines: ast.commentLines, + }; + + case 'union': + return { + code: ast.elements + .map(element => { + const result = printAST(element); + const code = `${printComment(result)} | ${result.code}`; + return { + code, + element, + }; + }) + // sort the union members so that we get consistent output regardless + // of declaration order + .sort((a, b) => compareElements(a, b)) + .map(el => el.code) + .join('\n'), + commentLines: ast.commentLines, + }; + } +} + +interface Element { + code: string; + element: AST; +} +function compareElements(a: Element, b: Element): number { + if (a.element.type !== b.element.type) { + return naturalCompare(a.code, b.code); + } + + switch (a.element.type) { + case 'array': + case 'literal': + case 'type-reference': + case 'object': + case 'union': + return naturalCompare(a.code, b.code); + + case 'tuple': { + // natural compare will sort longer tuples before shorter ones + // which is the opposite of what we want, so we sort first by length THEN + // by code to ensure shorter tuples come first + const aElement = a.element; + const bElement = b.element as TupleAST; + if (aElement.elements.length !== bElement.elements.length) { + return aElement.elements.length - bElement.elements.length; + } + return naturalCompare(a.code, b.code); + } + } +} + +function printAndMaybeParenthesise(ast: AST): CodeWithComments { + const printed = printAST(ast); + if (ast.type === 'union') { + return { + code: `(${printed.code})`, + commentLines: printed.commentLines, + }; + } + return { + code: `${printed.code}`, + commentLines: printed.commentLines, + }; +} diff --git a/packages/rule-schema-to-typescript-types/src/types.ts b/packages/rule-schema-to-typescript-types/src/types.ts new file mode 100644 index 000000000000..78d0bfa994d6 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/types.ts @@ -0,0 +1,49 @@ +export type RefMap = ReadonlyMap< + // ref path + string, + // type name + string +>; + +export type AST = + | ArrayAST + | LiteralAST + | ObjectAST + | TupleAST + | TypeReferenceAST + | UnionAST; + +interface BaseASTNode { + readonly commentLines: string[]; +} + +export interface ArrayAST extends BaseASTNode { + readonly type: 'array'; + readonly elementType: AST; +} +export interface LiteralAST extends BaseASTNode { + readonly type: 'literal'; + readonly code: string; +} +export interface ObjectAST extends BaseASTNode { + readonly type: 'object'; + readonly properties: { + readonly name: string; + readonly optional: boolean; + readonly type: AST; + }[]; + readonly indexSignature: AST | null; +} +export interface TupleAST extends BaseASTNode { + readonly type: 'tuple'; + readonly elements: AST[]; + readonly spreadType: AST | null; +} +export interface TypeReferenceAST extends BaseASTNode { + readonly type: 'type-reference'; + readonly typeName: string; +} +export interface UnionAST extends BaseASTNode { + readonly type: 'union'; + readonly elements: AST[]; +} diff --git a/packages/website/src/components/lib/jsonSchema.ts b/packages/website/src/components/lib/jsonSchema.ts index e9e54efee110..6b5c3af421ae 100644 --- a/packages/website/src/components/lib/jsonSchema.ts +++ b/packages/website/src/components/lib/jsonSchema.ts @@ -10,7 +10,7 @@ const defaultRuleSchema: JSONSchema4 = { // https://github.com/microsoft/TypeScript/issues/17002 function isArray(arg: unknown): arg is readonly unknown[] { - return isArray(arg); + return Array.isArray(arg); } /** diff --git a/yarn.lock b/yarn.lock index f70027c9cb63..1c5fd5fcd35d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4064,13 +4064,6 @@ dependencies: "@types/yargs-parser" "*" -"@typescript/vfs@^1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@typescript/vfs/-/vfs-1.4.0.tgz#2d22985c7666c9d4ce26eb025405e6f156aa32b0" - integrity sha512-Pood7yv5YWMIX+yCHo176OnF8WUlKGImFG7XlsuH14Zb1YN5+dYD3uUtS7lqZtsH7tAveNUi2NzdpQCN0yRbaw== - dependencies: - debug "^4.1.1" - "@webassemblyjs/ast@1.11.1": version "1.11.1" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7" From 6ffbee802210e0b17217876c5f4fcb4b1258139e Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Wed, 19 Apr 2023 15:06:15 +0930 Subject: [PATCH 13/16] types --- package.json | 1 + packages/eslint-plugin/package.json | 2 +- packages/rule-schema-to-typescript-types/package.json | 3 +++ yarn.lock | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 670cc227cd68..8f945206acc0 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "@types/jest-specific-snapshot": "^0.5.5", "@types/lodash": "^4.14.182", "@types/marked": "^4.0.3", + "@types/natural-compare-lite": "^1.4.0", "@types/node": "^18.11.9", "@types/prettier": "^2.6.0", "@types/rimraf": "^3.0.2", diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 8988ed7a67b2..a1e7a78e30f5 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -69,7 +69,7 @@ "@types/debug": "*", "@types/json-schema": "*", "@types/marked": "*", - "@types/natural-compare-lite": "^1.4.0", + "@types/natural-compare-lite": "*", "@types/prettier": "*", "@typescript-eslint/rule-schema-to-typescript-types": "5.59.0", "cross-fetch": "*", diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json index 877a3749b9d4..1feef288de9a 100644 --- a/packages/rule-schema-to-typescript-types/package.json +++ b/packages/rule-schema-to-typescript-types/package.json @@ -38,6 +38,9 @@ "natural-compare-lite": "^1.4.0", "prettier": "*" }, + "devDependencies": { + "@types/natural-compare-lite": "*" + }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" diff --git a/yarn.lock b/yarn.lock index 1c5fd5fcd35d..0a7a5b080e21 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3865,7 +3865,7 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== -"@types/natural-compare-lite@^1.4.0": +"@types/natural-compare-lite@*", "@types/natural-compare-lite@^1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@types/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#90724682da3c304dd8d643b4e9ba00f53f29d454" integrity sha512-ZDcj/yWsRPacqKPpCExWWFq9X1JQwEOfHsu8deN1Qfa6M02z6tN4DK6AMf2IkM7709gp3QW6Bo7m2NFDhA485w== From d3389f7f8ac55baf79800b2d7138017c6e104abf Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Wed, 19 Apr 2023 15:20:29 +0930 Subject: [PATCH 14/16] fix ci --- packages/eslint-plugin/docs/rules/member-ordering.md | 4 ++-- packages/rule-schema-to-typescript-types/src/printAST.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/member-ordering.md b/packages/eslint-plugin/docs/rules/member-ordering.md index b4d1e217b2c9..9749f4857704 100644 --- a/packages/eslint-plugin/docs/rules/member-ordering.md +++ b/packages/eslint-plugin/docs/rules/member-ordering.md @@ -71,8 +71,8 @@ Other allowed values are: - `alphabetically`: Sorted in a-z alphabetical order, directly using string `<` comparison (so `B` comes before `a`) - `alphabetically-case-insensitive`: Sorted in a-z alphabetical order, ignoring case (so `a` comes before `B`) -- `natural`: Same as `alphabetically`, but using [`natural-compare-lite`](https://github.com/litejs/natural-compare-lite) for more friendly sorting of numbers -- `natural-case-insensitive`: Same as `alphabetically-case-insensitive`, but using [`natural-compare-lite`](https://github.com/litejs/natural-compare-lite) for more friendly sorting of numbers +- `natural`: Same as `alphabetically`, but using [`natural-compare`](https://github.com/litejs/natural-compare) for more friendly sorting of numbers +- `natural-case-insensitive`: Same as `alphabetically-case-insensitive`, but using [`natural-compare`](https://github.com/litejs/natural-compare) for more friendly sorting of numbers ### Default configuration diff --git a/packages/rule-schema-to-typescript-types/src/printAST.ts b/packages/rule-schema-to-typescript-types/src/printAST.ts index b0a1d57117cc..f05829535504 100644 --- a/packages/rule-schema-to-typescript-types/src/printAST.ts +++ b/packages/rule-schema-to-typescript-types/src/printAST.ts @@ -1,4 +1,4 @@ -import naturalCompare from 'natural-compare-lite'; +import naturalCompare from 'natural-compare'; import type { AST, TupleAST } from './types'; From f02d4856697daeaa5b517e7e9acdbe88f810a128 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Wed, 19 Apr 2023 15:22:40 +0930 Subject: [PATCH 15/16] revert small change --- packages/eslint-plugin/docs/rules/member-ordering.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/member-ordering.md b/packages/eslint-plugin/docs/rules/member-ordering.md index 9749f4857704..b4d1e217b2c9 100644 --- a/packages/eslint-plugin/docs/rules/member-ordering.md +++ b/packages/eslint-plugin/docs/rules/member-ordering.md @@ -71,8 +71,8 @@ Other allowed values are: - `alphabetically`: Sorted in a-z alphabetical order, directly using string `<` comparison (so `B` comes before `a`) - `alphabetically-case-insensitive`: Sorted in a-z alphabetical order, ignoring case (so `a` comes before `B`) -- `natural`: Same as `alphabetically`, but using [`natural-compare`](https://github.com/litejs/natural-compare) for more friendly sorting of numbers -- `natural-case-insensitive`: Same as `alphabetically-case-insensitive`, but using [`natural-compare`](https://github.com/litejs/natural-compare) for more friendly sorting of numbers +- `natural`: Same as `alphabetically`, but using [`natural-compare-lite`](https://github.com/litejs/natural-compare-lite) for more friendly sorting of numbers +- `natural-case-insensitive`: Same as `alphabetically-case-insensitive`, but using [`natural-compare-lite`](https://github.com/litejs/natural-compare-lite) for more friendly sorting of numbers ### Default configuration From f113341f389a84bf38908f26343f2306fba29358 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Thu, 20 Apr 2023 10:55:45 +0930 Subject: [PATCH 16/16] fix incorrect dep --- package.json | 2 +- yarn.lock | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 25c00f3e2c0c..9ae7ddbd1e9f 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@types/jest": "^29.0.2", "@types/jest-specific-snapshot": "^0.5.5", "@types/marked": "^4.0.3", - "@types/natural-compare-lite": "^1.4.0", + "@types/natural-compare": "^1.4.0", "@types/node": "^18.11.9", "@types/prettier": "^2.6.0", "@types/rimraf": "^3.0.2", diff --git a/yarn.lock b/yarn.lock index 9c9da295d259..03195b912794 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3865,12 +3865,7 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== -"@types/natural-compare-lite@^1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@types/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#90724682da3c304dd8d643b4e9ba00f53f29d454" - integrity sha512-ZDcj/yWsRPacqKPpCExWWFq9X1JQwEOfHsu8deN1Qfa6M02z6tN4DK6AMf2IkM7709gp3QW6Bo7m2NFDhA485w== - -"@types/natural-compare@*": +"@types/natural-compare@*", "@types/natural-compare@^1.4.0": version "1.4.1" resolved "https://registry.yarnpkg.com/@types/natural-compare/-/natural-compare-1.4.1.tgz#fc2b11ea100d380b0de7af15768bef209157bfb9" integrity sha512-9dr4UakpvN0QUvwNefk9+o14Sr1pPPIDWkgCxPkHcg3kyjtc9eKK1ng6dZ23vRwByloCqXYtZ1T5nJxkk3Ib3A==