Skip to content

Instantly share code, notes, and snippets.

@ssgonchar
Created April 19, 2016 11:15
Show Gist options
  • Save ssgonchar/ebfbc5ca565080b06ebce686200b5107 to your computer and use it in GitHub Desktop.
Save ssgonchar/ebfbc5ca565080b06ebce686200b5107 to your computer and use it in GitHub Desktop.
Install and run: jshint, jslint, jscs, stylehint, htmlhint.
{
"rules": {
"at-rule-empty-line-before": "always"|"never",
"at-rule-name-case": "lower"|"upper",
"at-rule-no-vendor-prefix": true,
"at-rule-semicolon-newline-after": "always",
"block-closing-brace-newline-after": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-closing-brace-newline-before": "always"|"always-multi-line"|"never-multi-line",
"block-closing-brace-space-after": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-closing-brace-space-before": "always"|"never"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-no-empty": true,
"block-no-single-line": true,
"block-opening-brace-newline-after": "always"|"always-multi-line"|"never-multi-line",
"block-opening-brace-newline-before": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-opening-brace-space-after": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-opening-brace-space-before": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"color-hex-case": "lower"|"upper",
"color-hex-length": "short"|"long",
"color-named": "always-where-possible"|"never",
"color-no-hex": true,
"color-no-invalid-hex": true,
"comment-empty-line-before": "always"|"never",
"comment-whitespace-inside": "always"|"never",
"custom-media-pattern": string,
"custom-property-no-outside-root": true,
"custom-property-pattern": string,
"declaration-bang-space-after": "always"|"never",
"declaration-bang-space-before": "always"|"never",
"declaration-block-no-duplicate-properties": true,
"declaration-block-no-ignored-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-properties-order": "alphabetical"|[],
"declaration-block-semicolon-newline-after": "always"|"always-multi-line"|"never-multi-line",
"declaration-block-semicolon-newline-before": "always"|"always-multi-line"|"never-multi-line",
"declaration-block-semicolon-space-after": "always"|"never"|"always-single-line"|"never-single-line",
"declaration-block-semicolon-space-before": "always"|"never"|"always-single-line"|"never-single-line",
"declaration-block-single-line-max-declarations": int,
"declaration-block-trailing-semicolon": "always"|"never",
"declaration-colon-newline-after": "always"|"always-multi-line",
"declaration-colon-space-after": "always"|"never"|"always-single-line",
"declaration-colon-space-before": "always"|"never",
"declaration-no-important": true,
"font-family-name-quotes": "single-where-required"|"single-where-recommended"|"single-unless-keyword"|"double-where-required"|"double-where-recommended"|"double-unless-keyword",
"font-weight-notation": "numeric"|"named",
"function-blacklist": string|[],
"function-calc-no-unspaced-operator": true,
"function-comma-newline-after": "always"|"always-multi-line"|"never-multi-line",
"function-comma-newline-before": "always"|"always-multi-line"|"never-multi-line",
"function-comma-space-after": "always"|"never"|"always-single-line"|"never-single-line",
"function-comma-space-before": "always"|"never"|"always-single-line"|"never-single-line",
"function-linear-gradient-no-nonstandard-direction": true,
"function-name-case": "lower"|"upper",
"function-parentheses-newline-inside": "always"|"always-multi-line"|"never-multi-line",
"function-parentheses-space-inside": "always"|"never"|"always-single-line"|"never-single-line",
"function-url-data-uris": "always"|"never",
"function-url-quotes": "single"|"double"|"none",
"function-whitelist": string|[],
"function-whitespace-after": "always"|"never",
"indentation": int|"tab",
"max-empty-lines": int,
"max-line-length": int,
"max-nesting-depth": int,
"media-feature-colon-space-after": "always"|"never",
"media-feature-colon-space-before": "always"|"never",
"media-feature-name-no-vendor-prefix": true,
"media-feature-no-missing-punctuation": true,
"media-feature-range-operator-space-after": "always"|"never",
"media-feature-range-operator-space-before": "always"|"never",
"media-query-list-comma-newline-after": "always"|"always-multi-line"|"never-multi-line",
"media-query-list-comma-newline-before": "always"|"always-multi-line"|"never-multi-line",
"media-query-list-comma-space-after": "always"|"never"|"always-single-line"|"never-single-line",
"media-query-list-comma-space-before": "always"|"never"|"always-single-line"|"never-single-line",
"media-query-parentheses-space-inside": "always"|"never",
"no-browser-hacks": true,
"no-descending-specificity": true,
"no-duplicate-selectors": true,
"no-eol-whitespace": true,
"no-indistinguishable-colors": true,
"no-invalid-double-slash-comments": true,
"no-missing-eof-newline": true,
"no-unknown-animations": true,
"no-unsupported-browser-features": true,
"number-leading-zero": "always"|"never",
"number-max-precision": int,
"number-no-trailing-zeros": true,
"number-zero-length-no-unit": true,
"property-blacklist": string|[],
"property-case": "lower"|"upper",
"property-no-vendor-prefix": true,
"property-unit-blacklist": {},
"property-unit-whitelist": {},
"property-value-blacklist": {},
"property-whitelist": string|[],
"root-no-standard-properties": true,
"rule-nested-empty-line-before": "always"|"never",
"rule-non-nested-empty-line-before": "always"|"never",
"selector-class-pattern": string,
"selector-combinator-space-after": "always"|"never",
"selector-combinator-space-before": "always"|"never",
"selector-id-pattern": string,
"selector-list-comma-newline-after": "always"|"always-multi-line"|"never-multi-line",
"selector-list-comma-newline-before": "always"|"always-multi-line"|"never-multi-line",
"selector-list-comma-space-after": "always"|"never"|"always-single-line"|"never-single-line",
"selector-list-comma-space-before": "always"|"never"|"always-single-line"|"never-single-line",
"selector-max-specificity": string,
"selector-no-attribute": true,
"selector-no-combinator": true,
"selector-no-id": true,
"selector-no-type": true,
"selector-no-universal": true,
"selector-no-vendor-prefix": true,
"selector-pseudo-class-case": "lower"|"upper",
"selector-pseudo-element-case": "lower"|"upper",
"selector-pseudo-element-colon-notation": "single"|"double",
"selector-root-no-composition": true,
"selector-type-case": "lower"|"upper",
"string-no-newline": true,
"string-quotes": "single"|"double",
"time-no-imperceptible": true,
"unit-blacklist": string|[],
"unit-case": "single"|"double",
"unit-no-unknown": true,
"unit-whitelist": string|[],
"value-keyword-case": "lower"|"upper",
"value-list-comma-newline-after": "always"|"always-multi-line"|"never-multi-line",
"value-list-comma-newline-before": "always"|"always-multi-line"|"never-multi-line",
"value-list-comma-space-after": "always"|"never"|"always-single-line"|"never-single-line",
"value-list-comma-space-before": "always"|"never"|"always-single-line"|"never-single-line",
"value-no-vendor-prefix": true
}
}
var exec = require('child_process').exec,
child;
child = exec('npm install --save-dev -g gulp-jscs gulp-jshint jshint-stylish jscs gulp-jslint-simple gulp-htmllint gulp-csslint stylelint gulp-stylelint stylelint-checkstyle-formatter',
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
var gulp = require('gulp'),
htmllint = require('gulp-htmllint'),
gutil = require('gulp-util'),
jslint = require('gulp-jslint-simple'),
gulpStylelint = require('gulp-stylelint'),
myStylelintFormatter = require('my-stylelint-formatter');
gulp.task('lint:html', function () {
/**
* SET PATH !!!
*/
return gulp.src('src/index.html')
.pipe(htmllint({}, htmllintReporter));
});
gulp.task('hintcs:js', function () {
/**
* SET PATH !!!
*/
return gulp.src([
'gulpfile.js',
dirs.src + '/js/*.js',
dirs.test + '/*.js'
]).pipe(plugins.jscs())
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish'))
.pipe(plugins.jshint.reporter('fail'));
});
gulp.task('lint:js', function () {
/**
* SET PATH !!!
*/
gulp.src('*.js')
.pipe(jslint.run({
// project-wide JSLint options
node: true,
vars: true
}))
.pipe(jslint.report({
// example of using a JSHint reporter
reporter: require('jshint-stylish').reporter
}));
});
function htmllintReporter(filepath, issues) {
if (issues.length > 0) {
issues.forEach(function (issue) {
gutil.log(gutil.colors.cyan('[gulp-htmllint] ') + gutil.colors.white(filepath + ' [' + issue.line + ',' + issue.column + ']: ') + gutil.colors.red('(' + issue.code + ') ' + issue.msg));
});
process.exitCode = 1;
}
}
gulp.task('lint:styles', function lintCssTask() {
return gulp
/**
* SET PATH !!!
*/
.src('src/**/*.css')
.pipe(gulpStylelint({
failAfterError: true,
reportOutputDir: 'reports/lint',
reporters: [
{
formatter: 'verbose',
console: true
},
{
formatter: 'json',
save: 'report.json'
},
{
formatter: myStylelintFormatter,
save: 'my-custom-report.txt'
}
],
debug: true
}));
});
gulp.task('lint:all', function (done) {
runSequence(
['lint:html', 'hintcs:js', 'lint:js, lint:styles'],
'copy',
done);
});
{
"rules": {
"at-rule-empty-line-before": "always"|"never",
"at-rule-name-case": "lower"|"upper",
"at-rule-no-vendor-prefix": true,
"at-rule-semicolon-newline-after": "always",
"block-closing-brace-newline-after": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-closing-brace-newline-before": "always"|"always-multi-line"|"never-multi-line",
"block-closing-brace-space-after": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-closing-brace-space-before": "always"|"never"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-no-empty": true,
"block-no-single-line": true,
"block-opening-brace-newline-after": "always"|"always-multi-line"|"never-multi-line",
"block-opening-brace-newline-before": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-opening-brace-space-after": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-opening-brace-space-before": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"color-hex-case": "lower"|"upper",
"color-hex-length": "short"|"long",
"color-named": "always-where-possible"|"never",
"color-no-hex": true,
"color-no-invalid-hex": true,
"comment-empty-line-before": "always"|"never",
"comment-whitespace-inside": "always"|"never",
"custom-media-pattern": string,
"custom-property-no-outside-root": true,
"custom-property-pattern": string,
"declaration-bang-space-after": "always"|"never",
"declaration-bang-space-before": "always"|"never",
"declaration-block-no-duplicate-properties": true,
"declaration-block-no-ignored-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-properties-order": "alphabetical"|[],
"declaration-block-semicolon-newline-after": "always"|"always-multi-line"|"never-multi-line",
"declaration-block-semicolon-newline-before": "always"|"always-multi-line"|"never-multi-line",
"declaration-block-semicolon-space-after": "always"|"never"|"always-single-line"|"never-single-line",
"declaration-block-semicolon-space-before": "always"|"never"|"always-single-line"|"never-single-line",
"declaration-block-single-line-max-declarations": int,
"declaration-block-trailing-semicolon": "always"|"never",
"declaration-colon-newline-after": "always"|"always-multi-line",
"declaration-colon-space-after": "always"|"never"|"always-single-line",
"declaration-colon-space-before": "always"|"never",
"declaration-no-important": true,
"font-family-name-quotes": "single-where-required"|"single-where-recommended"|"single-unless-keyword"|"double-where-required"|"double-where-recommended"|"double-unless-keyword",
"font-weight-notation": "numeric"|"named",
"function-blacklist": string|[],
"function-calc-no-unspaced-operator": true,
"function-comma-newline-after": "always"|"always-multi-line"|"never-multi-line",
"function-comma-newline-before": "always"|"always-multi-line"|"never-multi-line",
"function-comma-space-after": "always"|"never"|"always-single-line"|"never-single-line",
"function-comma-space-before": "always"|"never"|"always-single-line"|"never-single-line",
"function-linear-gradient-no-nonstandard-direction": true,
"function-name-case": "lower"|"upper",
"function-parentheses-newline-inside": "always"|"always-multi-line"|"never-multi-line",
"function-parentheses-space-inside": "always"|"never"|"always-single-line"|"never-single-line",
"function-url-data-uris": "always"|"never",
"function-url-quotes": "single"|"double"|"none",
"function-whitelist": string|[],
"function-whitespace-after": "always"|"never",
"indentation": int|"tab",
"max-empty-lines": int,
"max-line-length": int,
"max-nesting-depth": int,
"media-feature-colon-space-after": "always"|"never",
"media-feature-colon-space-before": "always"|"never",
"media-feature-name-no-vendor-prefix": true,
"media-feature-no-missing-punctuation": true,
"media-feature-range-operator-space-after": "always"|"never",
"media-feature-range-operator-space-before": "always"|"never",
"media-query-list-comma-newline-after": "always"|"always-multi-line"|"never-multi-line",
"media-query-list-comma-newline-before": "always"|"always-multi-line"|"never-multi-line",
"media-query-list-comma-space-after": "always"|"never"|"always-single-line"|"never-single-line",
"media-query-list-comma-space-before": "always"|"never"|"always-single-line"|"never-single-line",
"media-query-parentheses-space-inside": "always"|"never",
"no-browser-hacks": true,
"no-descending-specificity": true,
"no-duplicate-selectors": true,
"no-eol-whitespace": true,
"no-indistinguishable-colors": true,
"no-invalid-double-slash-comments": true,
"no-missing-eof-newline": true,
"no-unknown-animations": true,
"no-unsupported-browser-features": true,
"number-leading-zero": "always"|"never",
"number-max-precision": int,
"number-no-trailing-zeros": true,
"number-zero-length-no-unit": true,
"property-blacklist": string|[],
"property-case": "lower"|"upper",
"property-no-vendor-prefix": true,
"property-unit-blacklist": {},
"property-unit-whitelist": {},
"property-value-blacklist": {},
"property-whitelist": string|[],
"root-no-standard-properties": true,
"rule-nested-empty-line-before": "always"|"never",
"rule-non-nested-empty-line-before": "always"|"never",
"selector-class-pattern": string,
"selector-combinator-space-after": "always"|"never",
"selector-combinator-space-before": "always"|"never",
"selector-id-pattern": string,
"selector-list-comma-newline-after": "always"|"always-multi-line"|"never-multi-line",
"selector-list-comma-newline-before": "always"|"always-multi-line"|"never-multi-line",
"selector-list-comma-space-after": "always"|"never"|"always-single-line"|"never-single-line",
"selector-list-comma-space-before": "always"|"never"|"always-single-line"|"never-single-line",
"selector-max-specificity": string,
"selector-no-attribute": true,
"selector-no-combinator": true,
"selector-no-id": true,
"selector-no-type": true,
"selector-no-universal": true,
"selector-no-vendor-prefix": true,
"selector-pseudo-class-case": "lower"|"upper",
"selector-pseudo-element-case": "lower"|"upper",
"selector-pseudo-element-colon-notation": "single"|"double",
"selector-root-no-composition": true,
"selector-type-case": "lower"|"upper",
"string-no-newline": true,
"string-quotes": "single"|"double",
"time-no-imperceptible": true,
"unit-blacklist": string|[],
"unit-case": "single"|"double",
"unit-no-unknown": true,
"unit-whitelist": string|[],
"value-keyword-case": "lower"|"upper",
"value-list-comma-newline-after": "always"|"always-multi-line"|"never-multi-line",
"value-list-comma-newline-before": "always"|"always-multi-line"|"never-multi-line",
"value-list-comma-space-after": "always"|"never"|"always-single-line"|"never-single-line",
"value-list-comma-space-before": "always"|"never"|"always-single-line"|"never-single-line",
"value-no-vendor-prefix": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment