From d1d8cc4d31a68a7dd3a0ece2c6a2e6585ce5ba63 Mon Sep 17 00:00:00 2001 From: Guillaume Kulakowski Date: Thu, 23 Jun 2016 10:42:51 +0200 Subject: [PATCH 1/6] Rename reporter --- less-xml.js => lint-xml.js | 86 +++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 43 deletions(-) rename less-xml.js => lint-xml.js (95%) diff --git a/less-xml.js b/lint-xml.js similarity index 95% rename from less-xml.js rename to lint-xml.js index fc8c76e..c7a3296 100644 --- a/less-xml.js +++ b/lint-xml.js @@ -1,43 +1,43 @@ -/* global module */ - -'use strict'; -module.exports = { - name: 'less-xml', - report: function report (results) { - var resultsByfiles = {}; - var output = ''; - - console.log(''); - console.log(''); - - results.forEach(function (result) { - output = '\t\n'; - }); - - Object.keys(resultsByfiles).forEach(function (file) { - console.log(''); - console.log(resultsByfiles[file]); - console.log(''); - }); - - console.log(''); - } -}; +/* global module */ + +'use strict'; +module.exports = { + name: 'lint-xml', + report: function report (results) { + var resultsByfiles = {}; + var output = ''; + + console.log(''); + console.log(''); + + results.forEach(function (result) { + output = '\t\n'; + }); + + Object.keys(resultsByfiles).forEach(function (file) { + console.log(''); + console.log(resultsByfiles[file]); + console.log(''); + }); + + console.log(''); + } +}; From eef64e987797d7f41d1bd4879979076aec6d84aa Mon Sep 17 00:00:00 2001 From: Guillaume Kulakowski Date: Thu, 23 Jun 2016 10:58:24 +0200 Subject: [PATCH 2/6] Add Travis task --- .codeclimate.yml | 24 +++++------ .coffeelintrc | 5 +++ .editorconfig | 44 ++++++++++---------- .eslintrc.json | 102 +++++++++++++++++++++++------------------------ .gitignore | 40 +++++++++++++++++++ .travis.yml | 9 +++++ Gruntfile.coffee | 72 +++++++++++++++++++++++++++++++++ README.md | 8 ++-- package.json | 69 ++++++++++++++++++-------------- 9 files changed, 255 insertions(+), 118 deletions(-) create mode 100644 .coffeelintrc create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 Gruntfile.coffee diff --git a/.codeclimate.yml b/.codeclimate.yml index d1925e1..7edf8e9 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,13 +1,13 @@ -engines: - duplication: - enabled: true - config: - languages: - - javascript - eslint: - enabled: true - fixme: - enabled: true -ratings: - paths: +engines: + duplication: + enabled: true + config: + languages: + - javascript + eslint: + enabled: true + fixme: + enabled: true +ratings: + paths: - "**.js" \ No newline at end of file diff --git a/.coffeelintrc b/.coffeelintrc new file mode 100644 index 0000000..4d3f2d7 --- /dev/null +++ b/.coffeelintrc @@ -0,0 +1,5 @@ +{ + "max_line_length": { + "level": "ignore" + } +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig index d4df260..a2ab39e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,20 +1,24 @@ -; EditorConfig is awesome: http://EditorConfig.org -; top-most EditorConfig file -root = true - -; Unix-style -[*] -end_of_line = lf -charset = utf-8 - -[*.js] -indent_style = space -indent_size = 4 - -[*.json] -indent_style = space -indent_size = 2 - -[*.md] -indent_style = space -indent_size = 2 \ No newline at end of file +; EditorConfig is awesome: http://EditorConfig.org +; top-most EditorConfig file +root = true + +; Unix-style +[*] +end_of_line = lf +charset = utf-8 + +[*.coffee] +indent_style = space +indent_size = 2 + +[*.js] +indent_style = space +indent_size = 4 + +[*.json] +indent_style = space +indent_size = 2 + +[*.md] +indent_style = space +indent_size = 2 diff --git a/.eslintrc.json b/.eslintrc.json index 201a060..d0c8cf7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,52 +1,52 @@ -{ - // From upstream https://github.com/lesshint/lesshint/blob/master/.eslintrc.json - "extends": "eslint:recommended", - "env": { - "es6": true, - "mocha": true, - "node": true - }, - "rules": { - "array-bracket-spacing": 2, - "brace-style": 2, - "camelcase": 2, - "comma-dangle": 0, - "comma-spacing": 2, - "comma-style": 2, - "computed-property-spacing": 2, - "curly": 2, - "dot-location": [2, "property"], - "dot-notation": 2, - "eol-last": 2, - "eqeqeq": 2, - "guard-for-in": 2, - "indent": [2, 4, { - "SwitchCase": 1, - "VariableDeclarator": 0 - }], - "key-spacing": 2, - "newline-after-var": 2, - "no-caller": 2, - "no-console": 0, - "no-else-return": 2, - "no-eval": 2, - "no-extend-native": 2, - "no-lonely-if": 2, - "no-loop-func": 2, - "no-multi-spaces": 2, - "no-trailing-spaces": 2, - "one-var": [2, "never"], - "quotes": [2, "single", "avoid-escape"], - "semi": 2, - "space-before-blocks": 2, - "space-before-function-paren": 2, - "space-in-parens": 2, - "space-unary-ops": [2, { - "nonwords": false, - "words": true - }], - "strict": [2, "global"], - "vars-on-top": 2, - "yoda": 2 - } +{ + // From upstream https://github.com/lesshint/lesshint/blob/master/.eslintrc.json + "extends": "eslint:recommended", + "env": { + "es6": true, + "mocha": true, + "node": true + }, + "rules": { + "array-bracket-spacing": 2, + "brace-style": 2, + "camelcase": 2, + "comma-dangle": 0, + "comma-spacing": 2, + "comma-style": 2, + "computed-property-spacing": 2, + "curly": 2, + "dot-location": [2, "property"], + "dot-notation": 2, + "eol-last": 2, + "eqeqeq": 2, + "guard-for-in": 2, + "indent": [2, 4, { + "SwitchCase": 1, + "VariableDeclarator": 0 + }], + "key-spacing": 2, + "newline-after-var": 2, + "no-caller": 2, + "no-console": 0, + "no-else-return": 2, + "no-eval": 2, + "no-extend-native": 2, + "no-lonely-if": 2, + "no-loop-func": 2, + "no-multi-spaces": 2, + "no-trailing-spaces": 2, + "one-var": [2, "never"], + "quotes": [2, "single", "avoid-escape"], + "semi": 2, + "space-before-blocks": 2, + "space-before-function-paren": 2, + "space-in-parens": 2, + "space-unary-ops": [2, { + "nonwords": false, + "words": true + }], + "strict": [2, "global"], + "vars-on-top": 2, + "yoda": 2 + } } \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f507122 --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +# Created by https://www.gitignore.io/api/node + +### Node ### +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..39d9c11 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - "node" + - "6.x" + - "5.x" + - "4.x" + - "0.12.x" + - "0.11.x" + - "0.10.x" \ No newline at end of file diff --git a/Gruntfile.coffee b/Gruntfile.coffee new file mode 100644 index 0000000..31d4cf6 --- /dev/null +++ b/Gruntfile.coffee @@ -0,0 +1,72 @@ +module.exports = (grunt) -> + +# =============================== Load plugins =============================== # + grunt.loadNpmTasks 'grunt-eslint' + grunt.loadNpmTasks 'grunt-travis-lint' + grunt.loadNpmTasks 'grunt-jsonlint' + grunt.loadNpmTasks 'grunt-coffeelint' + grunt.loadNpmTasks 'grunt-mdlint' + + +# ================================= Settings ================================= # + # Force use of Unix newlines + grunt.util.linefeed = '\n' + + # Project configuration + # ===================== + grunt.initConfig + + # Load external configurations + pkg: grunt.file.readJSON 'package.json' + + +# =================================== Task =================================== # + + # Linters + # ------ + + # JS + eslint: + options: + configFile: '.eslintrc.json' + target: ['*.js'] + + # JSON + jsonlint: + default: + src: [ + "*.json" + ".coffeelintrc" + ".jshintrc" + ] + + # Coffee + coffeelint: + default: [ + '*.coffee' + ] + options: + configFile: '.coffeelintrc' + + # MarkDown + mdlint: + default: [ + '*.md' + ] + + +# ============================== Callable tasks ============================== # + grunt.registerTask 'travis', [ + 'lint' + ] + + grunt.registerTask 'lint', [ + 'eslint', + 'jsonlint', + 'travis-lint' + 'coffeelint' + 'mdlint' + ] + + # Alias + grunt.registerTask 'default', 'travis' diff --git a/README.md b/README.md index e203cc3..6e1c6f9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lesshint-lint-xml-reporter -[![Code Climate](https://codeclimate.com/github/llaumgui/lesshint-lint-xml-reporter/badges/gpa.svg)](https://codeclimate.com/github/llaumgui/lesshint-lint-xml-reporter) - -A [lesshint](https://github.com/lesshint/lesshint)'s [reporter](https://github.com/lesshint/lesshint/blob/master/lib/lesshint.js#reporters) using the same lint-xml format that [CSSLint](https://github.com/CSSLint/csslint). +# lesshint-lint-xml-reporter +[![Code Climate](https://codeclimate.com/github/llaumgui/lesshint-lint-xml-reporter/badges/gpa.svg)](https://codeclimate.com/github/llaumgui/lesshint-lint-xml-reporter) [![devDependency Status](https://david-dm.org/llaumgui/lesshint-lint-xml-reporter/dev-status.svg)](https://david-dm.org/llaumgui/lesshint-lint-xml-reporter#info=devDependencies) + +A [lesshint](https://github.com/lesshint/lesshint)'s [reporter](https://github.com/lesshint/lesshint/blob/master/lib/lesshint.js#reporters) using the same lint-xml format that [CSSLint](https://github.com/CSSLint/csslint). diff --git a/package.json b/package.json index 40b7d5d..f5d0255 100644 --- a/package.json +++ b/package.json @@ -1,32 +1,39 @@ -{ - "name": "lesshint-lint-xml-reporter", - "description": "A lesshint reporter compatible with csslint's xml-lint format. Can be used by Jenkins.", - "version": "0.9.0", - "main": "./less-xml.js", - "homepage": "https://github.com/llaumgui/lesshint-lint-xml-reporter", - "author": { - "name": "Guillaume Kulakowski", - "url": "http://blog.kulakowski.fr/" - }, - "repository": { - "type": "git", - "url": "https://github.com/llaumgui/lesshint-lint-xml-reporter.git" - }, - "keywords": [ - "less", - "lint", - "hint", - "lesshint", - "reporter" - ], - "dependencies": { - }, - "devDependencies": { - }, - "scripts": { - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/llaumgui/lesshint-lint-xml-reporter/issues" - } +{ + "name": "lesshint-lint-xml-reporter", + "description": "A lesshint reporter compatible with csslint's xml-lint format. Can be used by Jenkins.", + "version": "0.9.0", + "main": "./less-xml.js", + "homepage": "https://github.com/llaumgui/lesshint-lint-xml-reporter", + "author": { + "name": "Guillaume Kulakowski", + "url": "http://blog.kulakowski.fr/" + }, + "repository": { + "type": "git", + "url": "https://github.com/llaumgui/lesshint-lint-xml-reporter.git" + }, + "keywords": [ + "less", + "lint", + "hint", + "lesshint", + "reporter" + ], + "dependencies": { + }, + "devDependencies": { + "grunt": "latest", + "grunt-eslint": "latest", + "grunt-travis-lint": "latest", + "grunt-jsonlint": "latest", + "grunt-coffeelint": "latest", + "grunt-mdlint": "latest" + }, + "scripts": { + "test": "grunt travis --verbose" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/llaumgui/lesshint-lint-xml-reporter/issues" + } } \ No newline at end of file From e535875a56804e388fbdab785a58ff383526eff1 Mon Sep 17 00:00:00 2001 From: Guillaume Kulakowski Date: Thu, 23 Jun 2016 11:17:34 +0200 Subject: [PATCH 3/6] Warning: value 6.x is not a valid version --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 39d9c11..89172ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: node_js node_js: - "node" - - "6.x" - - "5.x" - - "4.x" + - "6" + - "5" + - "4" - "0.12.x" - "0.11.x" - - "0.10.x" \ No newline at end of file + - "0.10.x" From 874e4e25a2e689b7963943083dcd89dcbc768aff Mon Sep 17 00:00:00 2001 From: Guillaume Kulakowski Date: Thu, 23 Jun 2016 16:23:55 +0200 Subject: [PATCH 4/6] Warning: value 0.12.x is not a valid version --- .travis.yml | 6 +++--- Gruntfile.coffee | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 89172ed..6f01884 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,6 @@ node_js: - "6" - "5" - "4" - - "0.12.x" - - "0.11.x" - - "0.10.x" + - "0.12" + - "0.11" + - "0.10" diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 31d4cf6..19bca45 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -63,9 +63,9 @@ module.exports = (grunt) -> grunt.registerTask 'lint', [ 'eslint', 'jsonlint', - 'travis-lint' 'coffeelint' 'mdlint' + 'travis-lint' ] # Alias From ccb482745a3a40779ce865b0e77664c3351acfdf Mon Sep 17 00:00:00 2001 From: Guillaume Kulakowski Date: Thu, 23 Jun 2016 16:47:18 +0200 Subject: [PATCH 5/6] Fix mdlint VS NodeJS >= 5 for Travis --- Gruntfile.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 19bca45..476f72a 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -57,7 +57,10 @@ module.exports = (grunt) -> # ============================== Callable tasks ============================== # grunt.registerTask 'travis', [ - 'lint' + 'eslint', + 'jsonlint', + 'coffeelint' + 'travis-lint' ] grunt.registerTask 'lint', [ @@ -69,4 +72,4 @@ module.exports = (grunt) -> ] # Alias - grunt.registerTask 'default', 'travis' + grunt.registerTask 'default', 'lint' From b6208045f84359602783c355e41766d4c872b013 Mon Sep 17 00:00:00 2001 From: Guillaume Kulakowski Date: Thu, 23 Jun 2016 17:02:00 +0200 Subject: [PATCH 6/6] Update Readme --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e1c6f9..179994e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,19 @@ # lesshint-lint-xml-reporter -[![Code Climate](https://codeclimate.com/github/llaumgui/lesshint-lint-xml-reporter/badges/gpa.svg)](https://codeclimate.com/github/llaumgui/lesshint-lint-xml-reporter) [![devDependency Status](https://david-dm.org/llaumgui/lesshint-lint-xml-reporter/dev-status.svg)](https://david-dm.org/llaumgui/lesshint-lint-xml-reporter#info=devDependencies) +[![Build Status](https://travis-ci.org/llaumgui/lesshint-lint-xml-reporter.svg?branch=master)](https://travis-ci.org/llaumgui/lesshint-lint-xml-reporter) [![Code Climate](https://codeclimate.com/github/llaumgui/lesshint-lint-xml-reporter/badges/gpa.svg)](https://codeclimate.com/github/llaumgui/lesshint-lint-xml-reporter) [![devDependency Status](https://david-dm.org/llaumgui/lesshint-lint-xml-reporter/dev-status.svg)](https://david-dm.org/llaumgui/lesshint-lint-xml-reporter#info=devDependencies) A [lesshint](https://github.com/lesshint/lesshint)'s [reporter](https://github.com/lesshint/lesshint/blob/master/lib/lesshint.js#reporters) using the same lint-xml format that [CSSLint](https://github.com/CSSLint/csslint). + +## Installation +Run the following command from the command line (add -g to install globally): + +``` +npm install -V git+https://github.com/llaumgui/lesshint-lint-xml-reporter.git +``` + +## Usage +Use [lesshint](https://github.com/lesshint/lesshint) with `-r` or `--reporter` option: + +```bash +lesshint --reporter lint-xml file.less +lesshint --reporter /path/to/lesshint-lint-xml-reporter/lint-xml .js file.less +```