How to use the leasot.parse function in leasot

To help you get started, we’ve selected a few leasot examples, based on popular ways it is used in public projects.

github mikeerickson / todo-webpack-plugin / index.js View on Github external
testFiles.forEach(file => {
    // skip source files from node_modules
    // https://github.com/mikeerickson/todo-webpack-plugin/issues/21
    if (file.match(/node_modules/g)) {
      return;
    }

    if (options.skipUnsupported) {
      if (!leasot.isExtSupported(path.extname(file))) {
        return;
      }
    }

    const todo = leasot.parse({
      ext: path.extname(file),
      content: fs.readFileSync(file, 'utf8'),
      fileName: file,
      customTags: options.tags,
      reporter: options.reporter,
      withInlineFiles: options.withInlineFiles
    });
    todos = todos.concat(todo);
  });
github pgilad / gulp-todo / index.js View on Github external
//check if parser for filetype exists
            if (!leasot.isExtensionSupported(ext)) {
                if (!skipUnsupported) {
                    const msg = `File: ${file.path} with extension ${colors.red(ext)} is not supported`;
                    return cb(new PluginError(pluginName, msg));
                }
                if (verbose) {
                    const msg = `Skipping file ${file.path} with extension ${colors.red(ext)} as it is unsupported`;
                    fancyLog(msg);
                }
                return cb();
            }
            const filePath = absolute ? file.path : (file.path && file.relative) || file.path;

            const parsedComments = leasot.parse(file.contents.toString(), {
                associateParser: parseOptions.associateParser,
                customParsers: parseOptions.customParsers,
                customTags: parseOptions.customTags,
                extension: ext,
                filename: filePath,
                withInlineFiles: parseOptions.withInlineFiles,
            });
            if (verbose) {
                logCommentsToConsole(parsedComments);
            }
            comments.push(...parsedComments);
            cb();
        },
        function reportTodos(cb) {
github sivakumar-kailasam / broccoli-leasot / src / index.js View on Github external
processString(content, relativePath) {
		if (this.enabled) {
			const fileExtension = path.extname(relativePath);
			if (leasot.isExtSupported(fileExtension)) {
				this._markers.push(leasot.parse({
					ext: fileExtension, 
					content: content, 
					fileName: relativePath, 
					customTags: this.kinds
				}));
			} else {
				this._exceptions.push(fileExtension);
			}
		}
		return content;
	}

leasot

Parse and output TODOs and FIXMEs from comments in your files

MIT
Latest version published 2 months ago

Package Health Score

78 / 100
Full package analysis

Similar packages