UNPKG

eslint-plugin-ft-flow

Version:
34 lines (30 loc) 692 B
const schema = [ { enum: ['always', 'never'], type: 'string', }, ]; const create = (context) => ({ ObjectTypeAnnotation(node) { const { properties } = node; for (const property of properties) { const { type } = property; if (type === 'ObjectTypeSpreadProperty') { const { argument: { type: argumentType, id: argumentId } } = property; if ( argumentType !== 'GenericTypeAnnotation' || argumentId.name !== '$Exact') { context.report({ message: 'Use $Exact to make type spreading safe.', node, }); } } } }, }); export default { create, meta: { schema, }, };