Trying to set a schema for my eslint rule. The intended configuration is as follows:
'my-rule': ['error', [
{'any-key': ['array', 'of', 'strings']},
{'some-other-key': ['array', 'of', 'strings']},
...etc
]]
I found out that it is possible to allow any non-enum property names, but I'm not sure how to specify their value types:
schema: [
{
type: 'array',
items: {
type: 'object',
propertyNames: {
type: 'string',
// ??? - how do I specify array of strings here?
},
}
}
],
Is this possible at all?
I don't think you can use propertyNames
to specify the value types.
Wouldn't patternProperties
work better for your purpose?
schema: [
{
type: 'array',
items: {
type: 'object',
patternProperties: {
".": {
type: "array",
items: {type: "string"}
}
},
}
}
]