Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--clear --color -w causes duplicated output #163

Closed
robchristian opened this issue Jul 30, 2019 · 4 comments · Fixed by #164
Closed

--clear --color -w causes duplicated output #163

robchristian opened this issue Jul 30, 2019 · 4 comments · Fixed by #164
Labels

Comments

@robchristian
Copy link

robchristian commented Jul 30, 2019

Environment

  • node version: 10.15.1
  • Eslint-Watch Version: ^6.0.0
  • Eslint Version: ^5.15.1

Basic Description of the problem

My team runs eslint with color output. Upon switching to eslint-watch, color was gone (we have an .eslintrc.json, I would expect esw to not change the behavior of eslint output). Upon adding --color and --clear (because obviously we want the terminal to clear, reviewing errors should not require extra focus), the terminal clears but it now logs errors in duplicate or triplicate, maybe even more.

How to reproduce it

from our package.json:

"lint-watch": "esw --color -c .eslintrc.json --cache --ext .ts,.tsx,.jsx,.js src -w --clear",

--color and --clear seem to be the main factors. Changing their order hasn't had much effect.

Our eslintrc.json:

{
  "parser": "@typescript-eslint/parser",
  "extends": ["eslint-config-airbnb"],
  "plugins": [ "jasmine", "@typescript-eslint" ],
  "rules": {
    "strict": 0,
    "indent": [ 2, 2, {"SwitchCase": 1}],
    "linebreak-style": [ 2, "unix" ],
    "max-len": [0],
    "import/no-unresolved": [0],
    "new-cap": [0],
    "arrow-parens": ["error", "always"],
    "camelcase": ["error"],
    "react/no-did-update-set-state": 0,
    "object-curly-newline": ["error", { "consistent": true }],
    "import/prefer-default-export": 0,
    "react/require-default-props": 0,
    "react/forbid-prop-types": 0,
    "jsx-a11y/label-has-for": 0,
    "jsx-a11y/label-has-associated-control": 0,
    "react/destructuring-assignment": 0,
    "jsx-a11y/anchor-is-valid": 0,
    "jsx-a11y/click-events-have-key-events": 0,
    "jsx-a11y/no-static-element-interactions": 0,
    "jsx-a11y/no-noninteractive-element-interactions": 0,
    "import/no-extraneous-dependencies": 0,
    "import/no-cycle": 0,
    "import/order": 0,
    "import/no-self-import": 0,
    "react/jsx-filename-extension": [1, { "extensions": [".tsx", ".jsx"] }],
    "consistent-return": [1, { "treatUndefinedAsUnspecified": false }]
  },
  "parserOptions": {
    "sourceType": "module",
    "allowImportExportEverywhere": false
  },
  "env": {
    "es6": true,
    "commonjs": true,
    "browser": true,
    "jest": true
  },
  "overrides": [
    {
     "files": ["*.ts", "*.tsx"],
        "rules": {
          "no-undef": 0,
          "no-unused-vars": 0,
          "react/prop-types": 0,
          "no-void": 0
        }
    }
  ]
}

Debug output:

I probably can't include this for you, since the output contains a lot of filepaths from a private, for-profit, project.

@rizowski
Copy link
Owner

🤔 Huh I'll have to look into that when I get a chance. I agree with you, it shouldn't remove color when running through esw. It also shouldn't be duplicating errors.

@robchristian
Copy link
Author

Thanks.

Also,

  • iTerm2 Build 3.2.9
  • macOS Mojave 10.14.5

@rumanHuq
Copy link

rumanHuq commented Aug 19, 2019

for me simply using --color -w reproduces the issue

@tdeo
Copy link

tdeo commented Aug 28, 2019

I've been running into a similar issue and I figured our by running esw with DEBUG=esw:* that this was in fact caused by using simultaneously --cache and -w:

  esw:events:watch Detected change: .eslintcache +826ms
  esw:eslint Executing [ '--cache', '--ext', [ '.json', '.js', '.html' ], '--eslintrc', '--ignore', '--inline-config', '.' ] +0ms
  esw:events:watch Detected change: .eslintcache +708ms
  esw:eslint Executing [ '--cache', '--ext', [ '.json', '.js', '.html' ], '--eslintrc', '--ignore', '--inline-config', '.' ] +0ms

I fixed it by changing my eslint-watch command to esw --cache -w --color src/ instead of esw --cache -w --color .

EDIT: actually, using --watch-ignore '/.git|node_modules|.eslintcache/' does the same job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants