observing/pre-commit

multi tasks output different from one single task for the same task.

Opened this issue · 0 comments

Here is my single task config.

  "scripts": {
    "eslint": "eslint $(git diff-index --cached HEAD --name-only --diff-filter ACMR | egrep '.js$')"
  },
  "pre-commit": ["eslint"],
  "precommit.silent": true

It works well even if I did not change any javascript file.

And below is my multi tasks config.

  "scripts": {
    "eslint": "eslint $(git diff-index --cached HEAD --name-only --diff-filter ACMR | egrep '.js$')",
    "scss-lint": "scss-lint $(git diff-index --cached HEAD --name-only --diff-filter ACMR | egrep '.s(a|c)ss$')"
  },
  "pre-commit": ["eslint", "scss-lint"],
  "precommit.silent": true

Let's say I just modified a sass file and commit it .

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 - default: espree
  --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 .eslintignore
  --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
  --no-color                  Disable color in piped output

Miscellaneous:
  --init                      Run config initialization wizard - default: false
  --fix                       Automatically fix problems
  --debug                     Output debugging information
  -h, --help                  Show help
  -v, --version               Outputs the version number
  --no-inline-config          Allow comments to change eslint config/rules
  --print-config              Print the configuration to be used
client/styles/food/food-box.sass:11 [E] Syntax Error: Invalid CSS after "    border: none": expected "{", was ";"

This's what I got. It contains eslint output. I mean if you run eslint without any arguments, You will get those.

For the single task config, if I do not modify any javascript file, eslint will run with empty arguments, but it won't output those stuff, So I guess pre-commit handle that for me .
What about multi task config ? is it a bug or what ?