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..6f01884 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - "node" + - "6" + - "5" + - "4" + - "0.12" + - "0.11" + - "0.10" diff --git a/Gruntfile.coffee b/Gruntfile.coffee new file mode 100644 index 0000000..476f72a --- /dev/null +++ b/Gruntfile.coffee @@ -0,0 +1,75 @@ +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', [ + 'eslint', + 'jsonlint', + 'coffeelint' + 'travis-lint' + ] + + grunt.registerTask 'lint', [ + 'eslint', + 'jsonlint', + 'coffeelint' + 'mdlint' + 'travis-lint' + ] + + # Alias + grunt.registerTask 'default', 'lint' diff --git a/README.md b/README.md index e203cc3..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) - -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 +[![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 +``` 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(''); + } +}; 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