rizowski / eslint-watch

ESLint with simple watching capabilities
https://www.npmjs.com/package/eslint-watch
MIT License
196 stars 29 forks source link

Specifying formatters other than simple-detail returns null #97

Closed rizowski closed 7 years ago

rizowski commented 7 years ago
➜  eslint-watch git:(master) ✗ DEBUG=esw:* esw —no-ignore -f simple --color
  esw:eslint-cli Loaded +0ms
  esw:eslint-cli EsLint path: node_modules/.bin/eslint +3ms
  esw:eslint-help Loaded +20ms
  esw:options Loaded +0ms
  esw:success-formatter loaded +173ms
  esw:simple-detail loaded +1ms
  esw:watcher Loaded +0ms
  esw:arg-parser Loaded +0ms
  esw:esw-cli Loaded +0ms
  esw:esw-cli Eslint-Watch: 2.1.14 +0ms
  esw:eslint-help Executing help +0ms
  esw:eslint-cli eslint: [ '--help' ] +0ms
  esw:executor Running: node_modules/.bin/eslint +4ms
  esw:executor args: [ '--help' ] +0ms
  esw:executor Expected data: eslint [options] file.js [file.js] [dir]

Basic configuration:
  -c, --config path::String    Use configuration from this file or shareable config
  --no-eslintrc                Disable use of configuration from .eslintrc
  --env [String]               Specify environments
  --ext [String]               Specify JavaScript file extensions - default: .js
  --global [String]            Define global variables
  --parser String              Specify the parser to be used
  --parser-options Object      Specify parser options

Caching:
  --cache                      Only check changed files - default: false
  --cache-file path::String    Path to the cache file. Deprecated: use --cache-location - default: .eslintcache
  --cache-location path::String  Path to the cache file or directory

Specifying rules and plugins:
  --rulesdir [path::String]    Use additional rules from this directory
  --plugin [String]            Specify plugins
  --rule Object                Specify rules

Ignoring files:
  --ignore-path path::String   Specify path of ignore file
  --no-ignore                  Disable use of ignore files and patterns
  --ignore-pattern [String]    Pattern of files to ignore (in addition to those in .eslintignore)

Using stdin:
  --stdin                      Lint code provided on <STDIN> - default: false
  --stdin-filename String      Specify filename to process STDIN as

Handling warnings:
  --quiet                      Report errors only - default: false
  --max-warnings Int           Number of warnings to trigger nonzero exit code - default: -1

Output:
  -o, --output-file path::String  Specify file to write report to
  -f, --format String          Use a specific output format - default: stylish
  --color, --no-color          Force enabling/disabling of color

Miscellaneous:
  --init                       Run config initialization wizard - default: false
  --fix                        Automatically fix problems
  --debug                      Output debugging information
  -h, --help                   Show help
  -v, --version                Output the version number
  --no-inline-config           Prevent comments from changing config or rules
  --print-config path::String  Print the configuration for the given file
 +218ms
  esw:executor External process exited: 0 +5ms
{ exitCode: 0,
  fatal: false,
  cmd: 'node_modules/.bin/eslint',
  args: [ '--help' ],
  output: 'eslint [options] file.js [file.js] [dir]\n\nBasic configuration:\n  -c, --config path::String    Use configuration from this file or shareable config\n  --no-eslintrc                Disable use of configuration from .eslintrc\n  --env [String]               Specify environments\n  --ext [String]               Specify JavaScript file extensions - default: .js\n  --global [String]            Define global variables\n  --parser String              Specify the parser to be used\n  --parser-options Object      Specify parser options\n\nCaching:\n  --cache                      Only check changed files - default: false\n  --cache-file path::String    Path to the cache file. Deprecated: use --cache-location - default: .eslintcache\n  --cache-location path::String  Path to the cache file or directory\n\nSpecifying rules and plugins:\n  --rulesdir [path::String]    Use additional rules from this directory\n  --plugin [String]            Specify plugins\n  --rule Object                Specify rules\n\nIgnoring files:\n  --ignore-path path::String   Specify path of ignore file\n  --no-ignore                  Disable use of ignore files and patterns\n  --ignore-pattern [String]    Pattern of files to ignore (in addition to those in .eslintignore)\n\nUsing stdin:\n  --stdin                      Lint code provided on <STDIN> - default: false\n  --stdin-filename String      Specify filename to process STDIN as\n\nHandling warnings:\n  --quiet                      Report errors only - default: false\n  --max-warnings Int           Number of warnings to trigger nonzero exit code - default: -1\n\nOutput:\n  -o, --output-file path::String  Specify file to write report to\n  -f, --format String          Use a specific output format - default: stylish\n  --color, --no-color          Force enabling/disabling of color\n\nMiscellaneous:\n  --init                       Run config initialization wizard - default: false\n  --fix                        Automatically fix problems\n  --debug                      Output debugging information\n  -h, --help                   Show help\n  -v, --version                Output the version number\n  --no-inline-config           Prevent comments from changing config or rules\n  --print-config path::String  Print the configuration for the given file' }
  esw:eslint-help Help text received +9ms
  esw:eslint-help Alias found: -c +0ms
  esw:eslint-help Parsing --config +1ms
  esw:eslint-help Parsing --no-eslintrc +0ms
  esw:eslint-help Parsing no option --no-eslintrc +0ms
  esw:eslint-help Parsing --env +0ms
  esw:eslint-help Parsing --ext +0ms
  esw:eslint-help Parsing --global +0ms
  esw:eslint-help Parsing --parser +0ms
  esw:eslint-help Parsing --parser-options +0ms
  esw:eslint-help Parsing --cache +0ms
  esw:eslint-help Parsing --cache-file +0ms
  esw:eslint-help Parsing --cache-location +1ms
  esw:eslint-help Parsing --rulesdir +0ms
  esw:eslint-help Parsing --plugin +0ms
  esw:eslint-help Parsing --rule +0ms
  esw:eslint-help Parsing --ignore-path +0ms
  esw:eslint-help Parsing --no-ignore +0ms
  esw:eslint-help Parsing no option --no-ignore +0ms
  esw:eslint-help Parsing --ignore-pattern +0ms
  esw:eslint-help Parsing --stdin +0ms
  esw:eslint-help Parsing --stdin-filename +0ms
  esw:eslint-help Parsing --quiet +0ms
  esw:eslint-help Parsing --max-warnings +0ms
  esw:eslint-help Alias found: -o +0ms
  esw:eslint-help Parsing --output-file +0ms
  esw:eslint-help Alias found: -f +1ms
  esw:eslint-help Parsing --format +0ms
  esw:eslint-help Parsing --init +0ms
  esw:eslint-help Parsing --fix +0ms
  esw:eslint-help Parsing --debug +0ms
  esw:eslint-help Alias found: -h +0ms
  esw:eslint-help Parsing --help +0ms
  esw:eslint-help Alias found: -v +0ms
  esw:eslint-help Parsing --version +0ms
  esw:eslint-help Parsing --no-inline-config +0ms
  esw:eslint-help Parsing no option --no-inline-config +0ms
  esw:eslint-help Parsing --print-config +0ms
  esw:esw-cli Arguments passed: [ '/Users/colrous/.nvm/versions/node/v5.12.0/bin/node', '/Users/colrous/.nvm/versions/node/v5.12.0/bin/esw', '—no-ignore', '-f', 'simple', '--color' ] +5ms
  esw:esw-cli Parsing args +2ms
  esw:arg-parser Directories to check: [ '—no-ignore' ] +0ms
  esw:arg-parser Args [ '—no-ignore', '-f', 'simple', '--color' ] +0ms
  esw:arg-parser Pushing item: —no-ignore +1ms
  esw:arg-parser Pushing item: -f +0ms
  esw:arg-parser Format specified +0ms
  esw:arg-parser _dirname /Users/colrous/git/eslint-watch/src +0ms
  esw:arg-parser GetPath: simple +0ms
  esw:arg-parser Pushing item: --color +0ms
  esw:esw-cli Running initial lint +0ms
  esw:esw-cli [ '—no-ignore',
  esw:esw-cli   '-f',
  esw:esw-cli   '/Users/colrous/git/eslint-watch/src/formatters/simple',
  esw:esw-cli   '--color' ] +0ms
  esw:eslint-cli eslint: [ '—no-ignore', '-f', '/Users/colrous/git/eslint-watch/src/formatters/simple', '--color' ] +0ms
  esw:executor Running: node_modules/.bin/eslint +0ms
  esw:executor args: [ '—no-ignore', '-f', '/Users/colrous/git/eslint-watch/src/formatters/simple', '--color' ] +0ms
  esw:executor External process exited: 0 +255ms
{ exitCode: 0,
  fatal: false,
  cmd: 'node_modules/.bin/eslint',
  args:
   [ '—no-ignore',
     '-f',
     '/Users/colrous/git/eslint-watch/src/formatters/simple',
     '--color' ],
  output: null }
  esw:esw-cli lint completed. Exit Code: 0 +1ms
null
rizowski commented 7 years ago

Running eslint with the same arguements does not produce the same result:

➜  eslint-watch git:(master) ✗ eslint —no-ignore -f /Users/colrous/git/eslint-watch/src/formatters/simple --color ./
1/0 /Users/colrous/git/eslint-watch/src/eslint/cli.js
rizowski commented 7 years ago

There might have been a change in the way formatter contracts are defined. I'll need to check the source code/api documentation to verify as eslint-watch is passing the correct path to eslint so it should be picking up the formatter functions

rizowski commented 7 years ago

It seems like the formatting hasn't changed. There is another underlying problem. http://eslint.org/docs/developer-guide/working-with-custom-formatters

rizowski commented 7 years ago

This doesn't seem to be an issue anymore... The paths are being passed correctly and the results are being displayed properly. I no longer find null being returned when running the formatter command.