Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rizowski/eslint-watch
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.1.2
Choose a base ref
...
head repository: rizowski/eslint-watch
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.1.3
Choose a head ref
  • 4 commits
  • 28 files changed
  • 3 contributors

Commits on Jun 27, 2017

  1. Fix various lint inconsistencies (#123)

    * Fix various lint inconsistencies
    
    * Update test for more agressive lint errors
    
    * One more inconsistency
    brokentone authored and rizowski committed Jun 27, 2017
    Copy the full SHA
    ceeef55 View commit details

Commits on Oct 13, 2017

  1. Fix: #130 (#131)

    legraphista authored and rizowski committed Oct 13, 2017
    Copy the full SHA
    ee25d3e View commit details
  2. Copy the full SHA
    9907279 View commit details
  3. 3.1.3

    rizowski committed Oct 13, 2017
    Copy the full SHA
    c2afaf3 View commit details
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -6,5 +6,14 @@
},
"parserOptions": {
"sourceType": "module"
},
"rules": {
"brace-style": "error",
"comma-dangle": "error",
"keyword-spacing": "error",
"quotes": ["error", "single"],
"space-before-blocks": "error",
"space-before-function-paren": ["error", {"anonymous": "always", "named": "never"}],
"space-infix-ops": "error"
}
}
66 changes: 55 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,64 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
node_modules
typings
*.orig
typings

# VIM files
*.swm
*.swn
*.swo
*.swp
# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

*.DS_Store
build
# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# build
build/**

# diff tool
*.orig
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Eslint Watch
[![](https://nodei.co/npm/eslint-watch.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/eslint-watch) [![](https://nodei.co/npm-dl/eslint-watch.png?months=6&height=3)](https://www.npmjs.com/package/eslint-watch)

[![](https://img.shields.io/badge/release-notes-blue.svg)](https://github.com/rizowski/eslint-watch/releases/latest)
[![Build Status](https://travis-ci.org/rizowski/eslint-watch.svg?branch=master)](https://travis-ci.org/rizowski/eslint-watch)
[![Coverage Status](https://coveralls.io/repos/github/rizowski/eslint-watch/badge.svg?branch=master)](https://coveralls.io/github/rizowski/eslint-watch?branch=master)
[![Code Climate](https://codeclimate.com/github/rizowski/eslint-watch/badges/gpa.svg)](https://codeclimate.com/github/rizowski/eslint-watch)
[![Test Coverage](https://codeclimate.com/github/rizowski/eslint-watch/badges/coverage.svg)](https://codeclimate.com/github/rizowski/eslint-watch/coverage)
[![Reference Status](https://www.versioneye.com/nodejs/eslint-watch/reference_badge.svg?style=flat-square)](https://www.versioneye.com/nodejs/eslint-watch/references)

Donate:
28 changes: 16 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"name": "eslint-watch",
"version": "3.1.2",
"version": "3.1.3",
"description": "Run eslint with watch mode",
"main": "./src/cli.js",
"scripts": {
"eslint": "node ./bin/esw --no-ignore --color",
"clean": "rm -rf build node_modules",
"lint": "node ./bin/esw",
"lw": "node ./bin/esw -w",
"test": "mocha tests --timeout 10000 --recursive --retries 3 -r tests/globals --compilers js:babel-core/register",
"mocha": "mocha tests --timeout 10000 --recursive --retries 3 -r babel-core/register -r tests/globals ",
"test": "npm run mocha -- --timeout 5000 --retries 1",
"tdd": "mocha -w tests --recursive -R spec",
"ci": "npm run lint && npm run coverage",
"ci-win": "npm run lint && npm test",
"coverage": "istanbul cover _mocha -- --recursive tests --timeout 10000 --retries 3 -r tests/globals --compilers js:babel-core/register",
"coverage": "nyc npm run mocha && nyc report --reporter=text-lcov | coveralls",
"build": "babel src -d build -s inline",
"prepublish": "npm run build",
"deploy": "./scripts/deploy.sh"
@@ -49,31 +50,34 @@
},
"dependencies": {
"babel-polyfill": "^6.20.0",
"bluebird": "^3.4.7",
"chalk": "^1.1.3",
"bluebird": "^3.5.1",
"chalk": "^2.1.0",
"chokidar": "^1.4.3",
"debug": "^2.6.3",
"debug": "^3.0.1",
"keypress": "^0.2.1",
"lodash": "^4.17.4",
"optionator": "^0.8.2",
"source-map-support": "^0.4.14",
"source-map-support": "^0.5.0",
"strip-ansi": "^4.0.0",
"text-table": "^0.2.0",
"unicons": "0.0.3"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-eslint": "^7.2.2",
"babel-eslint": "^8.0.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-env": "^1.3.3",
"chai": "^4.0.2",
"coveralls": "^3.0.0",
"eslint": "latest",
"eslint-config-rizowski": "^1.0.2",
"istanbul": "^0.4.5",
"mocha": "^3.2.0",
"mocha": "^4.0.1",
"mocha-lcov-reporter": "^1.3.0",
"mocha-sinon": "^2.0.0",
"nyc": "^11.2.1",
"proxyquire": "^1.7.10",
"sinon": "^1.17.7",
"sinon-chai": "^2.9.0"
"sinon": "^4.0.1",
"sinon-chai": "^2.14.0"
}
}
4 changes: 2 additions & 2 deletions src/arg-parser.js
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ const formats = {
'simple-detail': true
};

const getPath = function getPath(options){
function getPath(options) {
logger.debug('GetPath: %s', options.format);
const formatPath = path.join(__dirname, formatterPath, options.format);
logger.debug(formatPath);
@@ -39,7 +39,7 @@ export default {
let args = _.slice(cliArgs, 2, cliArgs.length);
logger.debug('Directories to check: %o', dirs);
logger.debug('Args %o', args);
_.each(args, function(item){
_.each(args, function (item) {
if (!keys[item] && !formats[item]) {
logger.debug('Pushing item: %s', item);
arr.push(item);
2 changes: 1 addition & 1 deletion src/eslint/cli.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import settings from '../settings';
const logger = Logger('eslint-cli');
logger.debug('Loaded');

export default function eslintCli(args, options){
export default function eslintCli(args, options) {
logger.debug('eslint: %o', args.join(' '));
const result = spawnSync(settings.eslintPath, args, _.merge({ stdio: 'inherit' }, options));
logger.debug(result);
38 changes: 19 additions & 19 deletions src/eslint/help.js
Original file line number Diff line number Diff line change
@@ -8,11 +8,11 @@ logger.debug('Loaded');

const namedOption = /^--/;

function parseNo(option, str){
if(!str) return;
function parseNo(option, str) {
if (!str) return;

let cmd = str.replace('--', '');
if(/no-/.test(cmd)){
if (/no-/.test(cmd)) {
logger.debug('Parsing no option', str);
cmd = cmd.replace('no-', '');
option.default = 'true';
@@ -21,7 +21,7 @@ function parseNo(option, str){
return option;
}

function parseDouble(arr){
function parseDouble(arr) {
let description = _.without(arr.slice(2),'').join(' ');
return {
option: arr[0].replace('--', ''),
@@ -31,9 +31,9 @@ function parseDouble(arr){
};
}

function parseRegular(arr){
function parseRegular(arr) {
logger.debug('Parsing %s', arr[0]);
if(!arr[0]){
if (!arr[0]) {
return;
}
let optionText = arr[0];
@@ -46,29 +46,29 @@ function parseRegular(arr){
let helpText = _.without(arr, optionText, type, '');

let description = helpText.join(' ');
if(description){
if (description) {
option.description = description;
}
return option;
}

function parseAlias(arr){
function parseAlias(arr) {
let alias = arr[0];
logger.debug('Alias found: %s', alias);
let option = parseRegular(_.without(arr, alias));

if(alias){
if (alias) {
option.alias = alias.replace('-','');
}
return option;
}

function createOption(arr){
function createOption(arr) {
let option;

if(namedOption.test(arr[0]) && namedOption.test(arr[1])){ // no alias defaulted boolean
if (namedOption.test(arr[0]) && namedOption.test(arr[1])) { // no alias defaulted boolean
option = parseDouble(arr);
} else if(namedOption.test(arr[0]) && !namedOption.test(arr[1])){ // just a no alias
} else if (namedOption.test(arr[0]) && !namedOption.test(arr[1])) { // just a no alias
option = parseRegular(arr);
} else {// aliased or other
option = parseAlias(arr);
@@ -77,19 +77,19 @@ function createOption(arr){
return isEmpty ? undefined : option;
}

function parseHelp(helpText){
function parseHelp(helpText) {
let helpArr = helpText.split('\n');
let newArr = [];
let previousLine = [];
_.each(helpArr, function(row, index){
if(index <= 2){
_.each(helpArr, function (row, index) {
if (index <= 2) {
return;
}
let str = row.replace(',', '');
let arr = str.trim().split(' ');
if(str.indexOf('-') >= 0 && previousLine[0] !== ''){
if (str.indexOf('-') >= 0 && previousLine[0] !== '') {
let option = createOption(arr);
if(option && option.option !== 'format' && option.option !== 'help'){
if (option && option.option !== 'format' && option.option !== 'help') {
newArr.push(option);
}
}
@@ -99,10 +99,10 @@ function parseHelp(helpText){
return newArr;
}

export default function eslintHelp(){
export default function eslintHelp() {
logger.debug('Executing help');
const result = eslint(['--help'], { stdio: [ process.stdin, null, process.stderr] });
if(!result.message){
if (!result.message) {
throw new Error('Help text not received from Eslint.');
}
const eslintOptions = parseHelp(result.message);
2 changes: 1 addition & 1 deletion src/executor.js
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ export default {
spawnSync: (cmd, args, childOptions) => {
logger.debug(cmd, args);
const child = spawnSync(cmd, args, childOptions);
if(child.error){
if (child.error) {
logger.debug('Critical error occurred.');
throw new Error(child.stderr.toString());
}
2 changes: 1 addition & 1 deletion src/formatters/helpers/error-warning.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { red, yellow, white } from 'chalk';

export default function errorWarning(result){
export default function errorWarning(result) {
return result.errorCount || result.warningCount ?
`${red(result.errorCount)}/${yellow(result.warningCount)} ${white(result.filePath)}` :
`${red(result.messages.length)} ${white(result.filePath)}`;
2 changes: 1 addition & 1 deletion src/formatters/helpers/success.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import Logger from '../../logger';
const logger = Logger('success-formatter');
logger.debug('loaded');

export default function successHelper(result){
export default function successHelper(result) {
logger.debug(result);
return `${chalk.green(c.check)} ${chalk.white(result.filePath)}`;
};
7 changes: 4 additions & 3 deletions src/formatters/simple-detail.js
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
// https://github.com/sindresorhus/eslint-stylish
import chalk from 'chalk';
import table from 'text-table';
import strip from 'strip-ansi';

import c from './helpers/characters';
import Logger from '../logger';
@@ -12,7 +13,7 @@ logger.debug('loaded');

let tableSettings = {
align: ['', '', 'r'],
stringLength: (str) => chalk.stripColor(str).length
stringLength: (str) => strip(str).length
};

function pluralize(word, count) {
@@ -62,14 +63,14 @@ function simpleDetail(results) {
}).join(c.endLine) + c.endLine + c.endLine;
});

if(totalErrors) {
if (totalErrors) {
output += chalk.red(`${c.x} ${totalErrors} ${pluralize('error', totalErrors)} `);
}
if (totalWarnings) {
output += chalk.yellow(`${c.ex} ${totalWarnings} ${pluralize('warning', totalWarnings)} `);
}

if(results.length > 0 || !results.length) {
if (results.length > 0 || !results.length) {
cleanMsg = chalk.green(`${c.check} Clean`) + ` ${messageTime}`;
}

Loading