Skip to content

Commit

Permalink
chore: update eslint configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mjeanroy committed Jun 1, 2019
1 parent 3a1c68e commit 7e956ac
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 3 deletions.
22 changes: 20 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
{
"extends": "google",
"extends": [
"eslint:recommended",
"google"
],
"parserOptions": {
"ecmaVersion": 6
},
"env": {
"es6": true,
"node": true
},
"rules": {
"max-len": [2, 140, 2]
"max-len": [2, 140, 2],
"no-console": [0],
"valid-jsdoc": [2, {
"requireReturn": true,
"requireParamDescription": true,
"requireReturnDescription": true,
"prefer": {
"return": "return",
"arg": "param",
"argument": "param"
},
"preferType": {
"object": "object"
}
}]
}
}
7 changes: 7 additions & 0 deletions scripts/lint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
const path = require('path');
const gulp = require('gulp');
const eslint = require('gulp-eslint');
const log = require('../log');
const config = require('../config');

module.exports = function lint() {
Expand All @@ -35,6 +36,12 @@ module.exports = function lint() {
path.join(config.scripts, '**', '*.js'),
];

log.debug('Linting files: ');

src.forEach((input) => (
log.debug(` ${input}`)
));

return gulp.src(src)
.pipe(eslint())
.pipe(eslint.format())
Expand Down
53 changes: 53 additions & 0 deletions scripts/log/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2016-2018 Mickael Jeanroy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

'use strict';

const log = require('fancy-log');
const colors = require('ansi-colors');

/**
* Log message to output using `DEBUG` level.
*
* @param {string} msg Message to log.
* @return {void}
*/
function debug(msg) {
log(colors.grey(msg));
}

/**
* Log message to output using `ERROR` level.
*
* @param {string} msg Message to log.
* @return {void}
*/
function error(msg) {
log(colors.red(msg));
}

module.exports = {
debug,
error,
};
2 changes: 1 addition & 1 deletion scripts/release/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const fs = require('fs');
const gulp = require('gulp');
const git = require('gulp-git');
const bump = require('gulp-bump');
const log = require('fancy-log');
const log = require('../log');
const config = require('../config');

/**
Expand Down
1 change: 1 addition & 0 deletions src/license-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ module.exports = class LicensePlugin {
* Log debug message if debug mode is enabled.
*
* @param {string} msg Log message.
* @return {void}
*/
debug(msg) {
if (this._debug) {
Expand Down
6 changes: 6 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"env": {
"jasmine": true
}
}

0 comments on commit 7e956ac

Please sign in to comment.