1.0.0-alpha.2 • Published 5 years ago

source-line-processor v1.0.0-alpha.2

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

source-line-processor script.js --dir $PWD/test --dry-run --pattern "*.js"

script.js

module.exports = ({ handlers }) => async (file) => {
  await handlers.todos(file, async (todo) => {
    if (!todo.issueId) {
      const issueId = await createIssue(todo.content, todo.owner, todo.lineNumber, todo.path);
      todo.issueId = issueId;
    } else {
      const issue = await getIssueState(todo.issueId);
      if (issue.state === 'fixed') {
        todo.remove();
      } else if (issue.owner !== todo.owner) {
        todo.owner = issue.owner;
      }
    }
  }
});