Skip to content

Instantly share code, notes, and snippets.

@aerinkim
Last active February 18, 2022 06:53
Show Gist options
  • Save aerinkim/82ac14edb0417caa01f61dce56802770 to your computer and use it in GitHub Desktop.
Save aerinkim/82ac14edb0417caa01f61dce56802770 to your computer and use it in GitHub Desktop.
const lineItemLabels = ['Item Amount', 'Description', 'Unit Price', 'Unit Quantity'];
const lintIssues = []
export function lint(response) {
let all_record_annotations = [];
if (response.annotations && response.records) {
for (const record of response.records) {
if(record.annotations) {
for (const ann in record.annotations) {
all_record_annotations.push(ann.ref);
}
}
}
for (const annotation of response.annotations) {
if (lineItemLabels.includes(annotation.label){
if(!all_record_annotations.includes(annotation.uuid)){
lintIssues.push({
id: annotation.uuid,
label: annotation.label,
frame: annotation.page,
display:
'The label needs to be grouped as part of a line item. Press the G key to group tasks.',
});
}
}
}
return {
lintIssues,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment