Skip to content

Commit

Permalink
Change options schema to strictly. (#1430)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Feb 4, 2021
1 parent 7965d12 commit 47e3f89
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 26 deletions.
35 changes: 25 additions & 10 deletions lib/rules/attributes-order.js
Expand Up @@ -367,18 +367,33 @@ module.exports = {
url: 'https://eslint.vuejs.org/rules/attributes-order.html'
},
fixable: 'code',
schema: {
type: 'array',
properties: {
order: {
items: {
type: 'string'
schema: [
{
type: 'object',
properties: {
order: {
type: 'array',
items: {
anyOf: [
{ enum: Object.values(ATTRS) },
{
type: 'array',
items: {
enum: Object.values(ATTRS),
uniqueItems: true,
additionalItems: false
}
}
]
},
uniqueItems: true,
additionalItems: false
},
maxItems: 10,
minItems: 10
}
alphabetical: { type: 'boolean' }
},
additionalProperties: false
}
}
]
},
create
}
3 changes: 2 additions & 1 deletion lib/rules/component-tags-order.js
Expand Up @@ -40,7 +40,8 @@ module.exports = {
uniqueItems: true,
additionalItems: false
}
}
},
additionalProperties: false
}
],
messages: {
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/max-attributes-per-line.js
Expand Up @@ -61,7 +61,8 @@ module.exports = {
}
]
}
}
},
additionalProperties: false
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/new-line-between-multi-line-property.js
Expand Up @@ -68,7 +68,8 @@ module.exports = {
type: 'number',
minimum: 2
}
}
},
additionalProperties: false
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-bare-strings-in-template.js
Expand Up @@ -149,7 +149,8 @@ module.exports = {
items: { type: 'string', pattern: '^v-' },
uniqueItems: true
}
}
},
additionalProperties: false
}
],
messages: {
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-duplicate-attributes.js
Expand Up @@ -59,7 +59,8 @@ module.exports = {
allowCoexistStyle: {
type: 'boolean'
}
}
},
additionalProperties: false
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-potential-component-option-typo.js
Expand Up @@ -44,7 +44,8 @@ module.exports = {
type: 'number',
minimum: 1
}
}
},
additionalProperties: false
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-reserved-component-names.js
Expand Up @@ -84,7 +84,8 @@ module.exports = {
disallowVue3BuiltInComponents: {
type: 'boolean'
}
}
},
additionalProperties: false
}
],
messages: {
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-use-v-if-with-v-for.js
Expand Up @@ -62,7 +62,8 @@ module.exports = {
allowUsingIterationVar: {
type: 'boolean'
}
}
},
additionalProperties: false
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-useless-mustaches.js
Expand Up @@ -50,7 +50,8 @@ module.exports = {
ignoreStringEscape: {
type: 'boolean'
}
}
},
additionalProperties: false
}
],
type: 'suggestion'
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-useless-v-bind.js
Expand Up @@ -30,7 +30,8 @@ module.exports = {
ignoreStringEscape: {
type: 'boolean'
}
}
},
additionalProperties: false
}
],
type: 'suggestion'
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/valid-v-slot.js
Expand Up @@ -287,7 +287,8 @@ module.exports = {
allowModifiers: {
type: 'boolean'
}
}
},
additionalProperties: false
}
],
messages: {
Expand Down
10 changes: 5 additions & 5 deletions tests/lib/rules/attributes-order.js
Expand Up @@ -259,7 +259,7 @@ tester.run('attributes-order', rule, {
<div
v-if="!visible"
class="content"
:class="className"
v-model="foo"
v-text="textContent"
>
</div>
Expand All @@ -273,7 +273,7 @@ tester.run('attributes-order', rule, {
'DEFINITION',
'EVENTS',
'UNIQUE',
['BINDING', 'OTHER_ATTR'],
['TWO_WAY_BINDING', 'OTHER_ATTR'],
'CONTENT',
'GLOBAL'
]
Expand Down Expand Up @@ -719,7 +719,7 @@ tester.run('attributes-order', rule, {
<div
class="content"
v-if="!visible"
:class="className"
v-model="foo"
v-text="textContent"
>
</div>
Expand All @@ -733,7 +733,7 @@ tester.run('attributes-order', rule, {
'DEFINITION',
'EVENTS',
'UNIQUE',
['BINDING', 'OTHER_ATTR'],
['TWO_WAY_BINDING', 'OTHER_ATTR'],
'CONTENT',
'GLOBAL'
]
Expand All @@ -743,7 +743,7 @@ tester.run('attributes-order', rule, {
<div
v-if="!visible"
class="content"
:class="className"
v-model="foo"
v-text="textContent"
>
</div>
Expand Down

0 comments on commit 47e3f89

Please sign in to comment.