-
-
Save chrisdickinson/912e891f8dd60d8257e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// your-linter/index.js: | |
var jsl = require('jsl') | |
, linter | |
var comma_first = require('jsl-comma-first-object') | |
, no_semicolons = require('jsl-no-semicolon') | |
, max_line_length = require('jsl-max-line-length') | |
module.exports = linter = jsl() | |
linter | |
.addASTRule('error', comma_first.selector, comma_first) | |
.addASTRule('error', no_semicolons.selector, no_semicolons) | |
linter | |
.addLineRule('error', max_line_length(80)) | |
// OR alternatively: | |
var one_var_per_var_block = require('jsl-one-var-per-decl'); | |
var semicolons = require('jsl-require-semicolon'); | |
linter | |
.addASTRule('error', one_var_per_var_block.selector, one_var_per_var_block) | |
.addASTRule('error', semicolons.selector, semicolons); | |
// now in your your-linter/bin/your-linter: | |
require('../index').cli() | |
// in your-other-module/test.js: | |
var test = require('tape') | |
, lint = require('your-linter') | |
test('passes style guide', lint.test(path.join(__dirname, 'package.json'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment