You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/src/validate/js/propValidators/setup.ts

13 lines
408 B

import { Validator } from '../../';
import { Node } from '../../../interfaces';
const disallowed = new Set(['Literal', 'ObjectExpression', 'ArrayExpression']);
export default function setup(validator: Validator, prop: Node) {
while (prop.type === 'ParenthesizedExpression') prop = prop.expression;
if (disallowed.has(prop.value.type)) {
validator.error(`'setup' must be a function`, prop.value);
}
}