Skip to content
A static linting tool for angular ng directives
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
hint.js
package.json

README.md

ng-attr-hint

npm version license npm

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

ng-attr-hint

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

Gulp task

Grunt Plugin

Atom Package

atom-ng-attr-hint

TODOs

  • Unit tests
  • demo page

License

This plugin is licensed under the MIT license.

Copyright (c) 2015 Prince John Wesley

You can’t perform that action at this time.