ng-attr-hint
v0.3.5
Published
A static linting tool for angular ng directives.
Downloads
51
Maintainers
Readme
ng-attr-hint
A static linting tool for angular ng directives.
Usage
Install from npm
npm install ng-attr-hint
var ngAttrHint = require('ng-attr-hint');
// callback
ngAttrHint({
files: ['./*.html']
}, function(err, res) {
if(err) console.error(err);
else {
ngAttrHint.format(data).forEach(function(o) {
console.log(o)
});
}
});
// promise
ngAttrHint({
files: ['./*.html']
}).then(function(data) {
ngAttrHint.format(data).forEach(function(o) {
console.log(o)
});
}, function(err) {
console.error(err)
});
Output of Gulp task
API
function(options, callback)
Constructor which takes options and an optional callback. if callback is not provided, function will return a promise instance.
Parameters:
options
{
files: "glob filename-pattern" || [glob filename-pattern],
data: "content"
}
callback
Optional function which will be used to return the array of hint object.
function format(hints, formatPattern)
format the hint object to array of strings
Parameters:
hints
Output of ngAttrHint (An array of hint objects)
formatPattern
Optional Paramater. formatPattern, if provided, will be used for formatting.
Use '{field}' to interpolate hint object.
Default pattern : '[{file}:{line}] [{type}] ({attrs}) {message}'
ngAttrHint
object format:
{
file: string,
line: number,
type: string,
attrs: [string],
message: string
}
Plugins
TODOs
- Unit tests
- demo page
License
This plugin is licensed under the MIT license.
Copyright (c) 2015 Prince John Wesley