lint-plus

xg-htmlhint+csslint+eslint

Showing:

Popularity

Downloads/wk

2

GitHub Stars

8

Maintenance

Last Commit

3yrs ago

Contributors

1

Package

Dependencies

12

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Deprecated!
Deprecated.Use @xgfe/lint-plus instead

Readme

lint-plus

lint-plus = xg-htmlhint+xg-csslint+eslint

Install

From NPM for use as a command line app:

$ [sudo] npm install lint-plus -g

From NPM for programmatic use:

$ npm install lint-plus

Usage

Use in command line

$ linter [check] dir/               # lint entire directory
$ linter test.html src/ index.js    # lint files 
$ linter -c configfile test.html    # custom config file
$ linter path/to/file --fix/-f      # fix error code in js file

Use in your application

var linter = require('linter-plus');

API Reference

async func
function done (success,json,errors,warnings,errorFile,totalFile){
  console.log('isSuccess: %s',success);
  var messages;
  for(var i in json){
    messages = json[i];
    console.log('file %s has problem.',i);
    messages.forEach(function (message) {
      console.log('lint type: %s',message.type);
      console.log('problem severity: %s',message.severity);//2-error,1-warn,0-info
      console.log('line: %s',message.line);
      console.log('col: %s',message.col);
      console.log('error message: %s',message.message);
      console.log('rule: %s',message.rule);
    });
  }
  console.log('Found %s error%s,%s warning%s in %s of %s file%s.',
    errors,
    errors > 1 ? 's' : '',
    warnings,
    warnings > 1 ? 's' : '',
    errorFile,
    totalFile, totalFile > 1 ? 's' : ''
  );
}
var options = {
  _:["test.html","test.js"],
  config:'path/to/my/config_file'
};
var stream = linter.check(options,done);
stream.on('lint',function(filepath,messages){
  console.log('file path is %s',filepath);
  console.log('messages in this files are as below:');
  console.log(messages);
});
sync func
var messages = linter.checkSync(["test.html","test.js"]);

Config File Template

default to read .lintrc file.

{
  "html":false,     // set false means disallow js checker
  "css":{  // csshint config 
    "extends":["../path/to/other/css/config"]
    "suffix": "css",
    "ignore":["hehe.js","test/*.js"],   // files to be ignored,array or glob string
    "rules":{
      "a-line-of-decl": {"level": 1},
      "disallow-use-expression": {"level": 1},
      "vendor-prefixes-sort": {"level": 1}
    }
  },
  "js":{
    "extends":"eslint:recommended"   // extends config
  }
}

Note:config file can be js or json file.js files must be a node module,contents are as follows.

module.exports = {
  html:false,
  "css":{},
  js:{
    extends:"eslint:recommended"
  }
};

Develop Guide

开发文档

Config File

配置文件说明

License

MIT

Thanks

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial