![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Parse and output TODOs and FIXMEs from comments in your files
Easily extract, collect and report TODOs and FIXMEs in your code. This project uses regex in order to extract your todos from comments.
TODO: add some info
some code(); //TOOD: do something
is not supported)TODO
and FIXME
- case insensitiveFiletype | Extension | Notes |
---|---|---|
Coffeescript | .coffee | using regex. Supports # comments. |
Coffee-React | .cjsx | using regex. Supports # comments. |
Handlebars | .hbs | using regex. Supports {{! }} and {{!-- --}} |
Twig | .twig | using regex. Supports {# #} and <!-- --> |
Jade | .jade | using regex. |
Javascript | .js | using regex. Supports // and /* */ comments |
Sass | .sass .scss | using regex. Supports // and /* */ comments. |
Stylus | .styl | using regex. Supports // and /* */ comments. |
Typescript | .ts | using regex. Supports // and /* */ comments. |
Less | .less | using regex. Supports // and /* */ comments. |
Jsx | .jsx | using regex. Supports // and /* */ comments. |
Javascript is the default parser.
PRs for additional filetypes is most welcomed!!
$ npm install --global leasot
❯ leasot --help
Usage: leasot [options] <file ...>
Parse and output TODOs and FIXMEs from comments in your files
Options:
-h, --help output usage information
-V, --version output the version number
-t, --filetype [filetype] Force the filetype to parse. Useful for streams (Default: .js)
-r, --reporter [reporter] Use reporter (table|json|xml|markdown|raw) (Default: table)
Examples:
$ leasot index.js
$ leasot **/*.js
$ leasot index.js lib/*.js
$ leasot --reporter json index.js
$ cat index.js | leasot
$ cat index.cjsx | leasot --filetype .coffee
$ npm install --save-dev leasot
var fs = require('fs');
var leasot = require('leasot');
var contents = fs.readFileSync('./contents.js', 'utf8');
// get the filetype of the file, or force a special parser
var filetype = path.extname('./contents.js');
// add file for better reporting
var file = 'contents.js';
var todos = leasot.parse(filetype, contents, file);
// -> todos now contains the array of todos/fixme parsed
var output = leasot.reporter(todos, {
reporter: 'json',
spacing: 2
});
console.log(output);
// -> json output of the todos
var leasot = require('leasot');
leasot
exposes the following API:
Check whether extension is supported by parser.
Specify an extension including the prefixing dot, for example:
leasot.isExtSupported('.js'); //-> true
Returns: Boolean
Parse the contents, using the provided extension
. filename
will be attached
to the return object, so it is recommended to use it if you know it.
extension
is the extension to parse as, including a prefixing dot.
contents
is a string containing the contents to parse.
filename
is an optional string.
Returns: Array
of comments.
[{
file: 'parsedFile.js',
text: 'comment text',
kind: 'TODO',
line: 8
}]
Use the specified reporter to report the comments.
comments
is the array of comments received from leasot.parse()
.
config
is an object that will also be passed to the reporter itself (allowing custom options for each reporter).
It may also contain the specified reporter:
Can be a string indicating the built-in reporter to use, or an external library used as a reporter.
Could also be a custom function (comments, config)
Type: String|Function
Required: false
Default: raw
Each reporter might contain config params that are useful only for that reporter:
Returns a markdown version of the todos.
How to separate lines in the output file. Defaults to your OS's default line separator.
Type: String
Default: Your system default line feed
How many newLine
s should separate between comment type blocks.
Type: Number
Default: 2
Minimum: 0
Control the output of a header for each comment kind (i.e todo, fixme).
Type: Function
Default:
transformHeader: function (kind) {
return ['### ' + kind + 's',
'| Filename | line # | ' + kind,
'|:------|:------:|:------'
];
}
kind: will be be passed as the comment kind (todo/fixme).
Returns: String[]|String
You are expected to return either an Array of strings
or just a string
. If you return an array - each item will be separated by a newline in the output.
Control the output for each comment.
Type: Function
Default:
transformComment: function (file, line, text, kind) {
return ['| ' + file + ' | ' + line + ' | ' + text];
},
file: filename the comment was in.
line: line of comment.
text: comment text
kind: will be be passed as the comment kind (todo/fixme).
Returns: String[]|String
You are expected to return either an Array of strings
or just a string
. If you return an array - each item will be separated by a newline in the output.
Returns a pretty formatted table of the todos.
Just returns the raw javascript todos
Return a JSON valid representation of the todos.
Type: Number
Default: 2
Return an unformatted XML valid representation of the todos.
Parsed using json2xml
Whether to include xml header
Type: Boolean
Default: true
See https://github.com/estheban/node-json2xml#options--behaviour
Type: Boolean
Default: undefined
MIT ©Gilad Peleg
FAQs
Parse and output TODOs and FIXMEs from comments in your files
The npm package leasot receives a total of 10,072 weekly downloads. As such, leasot popularity was classified as popular.
We found that leasot demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.