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 efda12e commit bae5bf6
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 4 deletions.
26 changes: 23 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
{
"extends": "google",
"extends": [
"eslint:recommended",
"google"
],
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": 6
},
"env": {
"es6": true,
"node": true
},
"rules": {
"max-len": [2, 140, 2]
"max-len": [2, 140, 2],
"no-console": [2, {
"allow": ["warn", "error"]
}],
"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 @@ -26,6 +26,7 @@ const path = require('path');
const gulp = require('gulp');
const eslint = require('gulp-eslint');
const config = require('../config');
const log = require('../log');

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

log.debug('Linting files: ');

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

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
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 bae5bf6

Please sign in to comment.