From 228cf9e546251e29252fa5ff615bbad7ac0fa34d Mon Sep 17 00:00:00 2001 From: Rob Colbert Date: Tue, 6 Jul 2021 04:00:03 -0400 Subject: [PATCH] project created --- .gitignore | 1 + .jshintrc | 25 +++++++++++++++++++++++++ LICENSE | 2 ++ README.md | 34 ++++++++++++++++++++++++++++++++++ dtp-jshint-reporter.js | 31 +++++++++++++++++++++++++++++++ package.json | 12 ++++++++++++ yarn.lock | 42 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 147 insertions(+) create mode 100644 .gitignore create mode 100644 .jshintrc create mode 100644 LICENSE create mode 100644 README.md create mode 100644 dtp-jshint-reporter.js create mode 100644 package.json create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..6dd1a7e --- /dev/null +++ b/.jshintrc @@ -0,0 +1,25 @@ +{ + "bitwise": true, + "browser": true, + "curly": true, + "eqeqeq": true, + "latedef": true, + "noarg": true, + "node": true, + "strict": "global", + "undef": true, + "unused": true, + "futurehostile": true, + "esversion": 9, + "mocha": true, + "globals": { + "markdown": true, + "moment": true, + "numeral": true, + "io": true, + "Chart": true, + "CodeMirror": true, + "UIkit": true, + "twttr": true + } +} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bd64759 --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +dtp-jshint-reporter Copyright (C) 2021 Digital Telepresence, LLC +All Rights Reserved \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7b86bcc --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# Digital Telepresence jshint reporter + +A jshint error/warning reporter using an output format that is friendly to VS Code and other editors to use when navigating to the error in your source code. + +## Getting started + +First, make sure Yarn has linked the module in your workspace as follows: + +```sh +cd ~/projects/dtp/dtp-jshint-reporter +yarn link +``` + +This will expose the project in that directory to Yarn for linking elsewhere on your system. + +Next, add `dtp-jshint-reporter` to your project as follows: + +```sh +cd ~/projects/dtp/[your-project] +yarn link dtp-jshint-reporter +``` + +In your gulpfile, do something like: + +```js +function dtp_jshint_services ( ) { + var jsrc = 'app/services/**/*.js'; + return gulp + .src(jsrc) + .pipe(jshint()) + .pipe(jshint.reporter('dtp-jshint-reporter')) + ; +} +``` \ No newline at end of file diff --git a/dtp-jshint-reporter.js b/dtp-jshint-reporter.js new file mode 100644 index 0000000..2e52d7e --- /dev/null +++ b/dtp-jshint-reporter.js @@ -0,0 +1,31 @@ +// dtp-jshint-reporter.js +// Copyright (C) 2021 Digital Telepresence, LLC +// All Rights Reserved + +// Generates gulp output that is useful within a terminal in VS Code. + +'use strict'; + +const chalk = require('chalk'); +const separator = chalk.gray(':'); + +module.exports = { + + toString: function ( ) { + return __filename; + }, + + reporter: function (errors) { + console.log(''); + errors.forEach((error) => { + let file = chalk.white(error.file); + let line = chalk.blue(error.error.line); + let character = chalk.blue(error.error.character); + let id = error.error.id === '(error)' ? chalk.red(error.error.id) : chalk.yellow(error.error.id); + let reason = error.error.reason; + console.log(`${id} ${file}${separator}${line}${separator}${character}${separator} ${reason}`); + }); + console.log(''); + }, + +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..05e2807 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "dtp-jshint-reporter", + "version": "0.1.0", + "description": "Digital Telepresence jshint reporter", + "main": "dtp-jshint-reporter.js", + "author": "Digital Telepresence, LLC", + "license": "LicenseRef-LICENSE", + "private": true, + "dependencies": { + "chalk": "^4.1.1" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..36d382b --- /dev/null +++ b/yarn.lock @@ -0,0 +1,42 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +chalk@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.1.tgz#c80b3fab28bf6371e6863325eee67e618b77e6ad" + integrity sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0"