Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(eslint-plugin): refactor schemas that use$ref#6896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
bradzacher wants to merge1 commit intomainfromfix-schemas-20230413
Closed
Show file tree
Hide file tree
Changes fromall 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 deletionspackages/eslint-plugin/src/rules/array-type.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionspackages/eslint-plugin/src/rules/ban-ts-comment.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionspackages/eslint-plugin/src/rules/comma-dangle.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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
MemberAuthor

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'},
},

JoshuaKGoldberg reacted with thumbs up emoji
additionalProperties: false,
},
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionspackages/eslint-plugin/src/rules/func-call-spacing.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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

[8]ページ先頭

©2009-2025 Movatter.jp