Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions packages/eslint-plugin/src/rules/array-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,30 +105,27 @@ export default util.createRule<Options, MessageIds>({
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: [
{
Expand Down
67 changes: 32 additions & 35 deletions packages/eslint-plugin/src/rules/ban-ts-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,45 +39,42 @@ 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',
},
additionalProperties: false,
},
],
},
defaultOptions: [
{
Expand Down
19 changes: 10 additions & 9 deletions packages/eslint-plugin/src/rules/comma-dangle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default util.createRule<Options, MessageIds>({
recommended: false,
extendsBaseRule: true,
},
// intentionally a non-array schema to mirror the base rule
schema: {
$defs: {
value: {
Expand All @@ -61,19 +62,19 @@ export default util.createRule<Options, MessageIds>({
{
oneOf: [
{
$ref: '#/$defs/value',
$ref: '#/items/0/$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' },
arrays: { $ref: '#/items/0/$defs/valueWithIgnore' },
objects: { $ref: '#/items/0/$defs/valueWithIgnore' },
imports: { $ref: '#/items/0/$defs/valueWithIgnore' },
exports: { $ref: '#/items/0/$defs/valueWithIgnore' },
functions: { $ref: '#/items/0/$defs/valueWithIgnore' },
enums: { $ref: '#/items/0/$defs/valueWithIgnore' },
generics: { $ref: '#/items/0/$defs/valueWithIgnore' },
tuples: { $ref: '#/items/0/$defs/valueWithIgnore' },
},
Comment on lines +70 to 78
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
arrays: { $ref: '#/items/0/$defs/valueWithIgnore' },
objects: { $ref: '#/items/0/$defs/valueWithIgnore' },
imports: { $ref: '#/items/0/$defs/valueWithIgnore' },
exports: { $ref: '#/items/0/$defs/valueWithIgnore' },
functions: { $ref: '#/items/0/$defs/valueWithIgnore' },
enums: { $ref: '#/items/0/$defs/valueWithIgnore' },
generics: { $ref: '#/items/0/$defs/valueWithIgnore' },
tuples: { $ref: '#/items/0/$defs/valueWithIgnore' },
},
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,
},
Expand Down
76 changes: 29 additions & 47 deletions packages/eslint-plugin/src/rules/explicit-member-accessibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Options, MessageIds>({
name: 'explicit-member-accessibility',
meta: {
Expand All @@ -63,41 +46,40 @@ export default util.createRule<Options, MessageIds>({
'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: {
enum: ['explicit', 'no-public', 'off'],
},
},
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,
},
ignoredMethodNames: {
type: 'array',
items: {
type: 'string',
},
},
additionalProperties: false,
},
],
type: 'array',
},
additionalProperties: false,
},
],
},
defaultOptions: [{ accessibility: 'explicit' }],
create(context, [option]) {
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin/src/rules/func-call-spacing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default util.createRule<Options, MessageIds>({
extendsBaseRule: true,
},
fixable: 'whitespace',
// intentionally a non-array schema to mirror the base rule
schema: {
anyOf: [
{
Expand Down
Loading