rizowski / eslint-watch

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

Doesn't track file changes with --ext js,jsx #138

Closed Tenemo closed 6 years ago

Tenemo commented 6 years ago

Environment

Basic description of the problem

esw -w doesn't react to file changes when run with --ext js,jsx parameter. Initial linting works OK, it's just that changes don't trigger another lint. Without the --ext option it watches files correctly - without tracking .jsx files, though. It only affects the watcher, all linting on both .js and .jsx files otherwise is done correctly, both in console and in VS Code.

How to reproduce it

  1. esw src --ext js,jsx -w
  2. Save any file, no linting upon changes, no further console warnings.

Notes

⚠ 10 warnings (16:50:04)

C:_dev\hadrondesign\src\index.js (0/10) ⚠ 3:57 'C:_dev\hadrondesign\node_modules\react-router-dom\index.js' imported multiple times import/no-duplicates ⚠ 11:29 'C:_dev\hadrondesign\node_modules\react-router-dom\index.js' imported multiple times import/no-duplicates ⚠ 17:1 Unexpected console statement no-console ⚠ 18:1 Unexpected console statement no-console ⚠ 19:1 Unexpected console statement no-console ⚠ 20:1 Unexpected console statement no-console ⚠ 21:1 Unexpected console statement no-console ⚠ 22:1 Unexpected console statement no-console ⚠ 23:1 Unexpected console statement no-console ⚠ 24:1 Unexpected console statement no-console

⚠ 10 warnings (16:50:04)


### Debug output:
`set DEBUG=esw:*&& esw src -w --ext js,jsx`:

PS C:_dev\hadrondesign> npm run debug esw:internal-settings Eslint installed locally node_modules.bin\eslint.cmd +0ms esw:internal-settings { eswVersion: '3.1.4', esw:internal-settings eslintPath: 'node_modules\.bin\eslint.cmd', esw:internal-settings platform: 'win32', esw:internal-settings isWindows: true } +3ms esw:eslint-cli Loaded +0ms esw:eslint-help Loaded +0ms esw:options Loaded +0ms esw:eslint-help Executing help +3ms esw:eslint-cli eslint: '--help' +28ms esw:executor node_modules.bin\eslint.cmd [ '--help' ] +0ms esw:eslint-cli { exitCode: 0, esw:eslint-cli message: 'eslint [options] file.js [file.js] [dir]\n\nBasic configuration:\n --no-eslintrc Disable use of configuration from .eslintrc.\n -c, --config path::String Use this configuration, overriding .eslintrc. config options if present\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\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\nFixing problems:\n --fix Automatically fix problems\n --fix-dry-run Automatically fix problems without saving the changes to the file system\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 - 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\nInline configuration comments:\n --no-inline-config Prevent comments from changing config or rules\n --report-unused-disable-directives Adds reported errors for unused eslint-disable directives\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\nMiscellaneous:\n --init Run config initialization wizard - default: false\n --debug Output debugging information\n -h, --help Show help\n -v, --version Output the version number\n --print-config path::String Print the configuration for the given file\n' } +314ms esw:eslint-help Parsing --no-eslintrc +321ms esw:eslint-help Parsing no option --no-eslintrc +1ms esw:eslint-help Alias found: -c +0ms esw:eslint-help Parsing --config +0ms esw:eslint-help Parsing --env +0ms esw:eslint-help Parsing --ext +1ms esw:eslint-help Parsing --global +0ms esw:eslint-help Parsing --parser +0ms esw:eslint-help Parsing --parser-options +0ms esw:eslint-help Parsing --rulesdir +0ms esw:eslint-help Parsing --plugin +0ms esw:eslint-help Parsing --rule +0ms esw:eslint-help Parsing --fix +0ms esw:eslint-help Parsing --fix-dry-run +0ms esw:eslint-help Parsing --ignore-path +1ms 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 +1ms esw:eslint-help Alias found: -f +0ms esw:eslint-help Parsing --format +0ms esw:eslint-help Parsing --no-inline-config +0ms esw:eslint-help Parsing no option --no-inline-config +0ms esw:eslint-help Parsing --report-unused-disable-directives +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 --init +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 --print-config +0ms esw:watcher Loaded +0ms esw:arg-parser Loaded +0ms esw:esw-cli Loaded +0ms esw:esw-cli Eslint-Watch: 3.1.4 +0ms esw:esw-cli Arguments passed: [ 'C:\Program Files\nodejs\node.exe', 'C:\_dev\hadrondesign\node_modules\eslint-watch\bin\esw', 'src', '-w', '--ext', 'js,jsx' ] +1ms esw:esw-cli Parsing args +1ms esw:arg-parser Directories to check: [ 'src' ] +3ms esw:arg-parser Args [ 'src', '-w', '--ext', 'js,jsx' ] +0ms esw:arg-parser Pushing item: src +0ms esw:arg-parser Pushing item: --ext +0ms esw:arg-parser Pushing item: js,jsx +1ms esw:arg-parser setting custom formatter +0ms esw:arg-parser GetPath: simple-detail +0ms esw:arg-parser C:_dev\hadrondesign\node_modules\eslint-watch\build\formatters\simple-detail +0ms esw:esw-cli Running initial lint +2ms esw:esw-cli [ 'src', esw:esw-cli '--ext', esw:esw-cli 'js,jsx', esw:esw-cli '-f', esw:esw-cli 'C:\_dev\hadrondesign\node_modules\eslint-watch\build\formatters\simple-detail' ] +0ms esw:eslint-cli eslint: 'src --ext js,jsx -f C:\_dev\hadrondesign\node_modules\eslint-watch\build\formatters\simple-detail' +379ms esw:executor node_modules.bin\eslint.cmd [ 'src', '--ext', 'js,jsx', '-f', 'C:\_dev\hadrondesign\node_modules\eslint-watch\build\formatters\simple-detail' ] +692ms esw:simple-detail loaded +0ms esw:simple-detail [ { filePath: 'C:\_dev\hadrondesign\src\components\about\AboutPage.jsx', esw:simple-detail messages: [], esw:simple-detail errorCount: 0, esw:simple-detail warningCount: 0, esw:simple-detail fixableErrorCount: 0, esw:simple-detail fixableWarningCount: 0 }, esw:simple-detail { filePath: 'C:\_dev\hadrondesign\src\components\App.jsx', esw:simple-detail messages: [ [Object], [Object] ], esw:simple-detail errorCount: 0, esw:simple-detail warningCount: 2, esw:simple-detail fixableErrorCount: 0, esw:simple-detail fixableWarningCount: 0, esw:simple-detail source: 'import PropTypes from \'prop-types\';\r\nimport { hot } from \'react-hot-loader\';\r\n\r\nconsole.log(\'App.jsx represent\');\r\nconsole.log(\'App.jsx represent\');\r\n\r\nclass App extends React.Component {\r\n render() {\r\n return (\r\n

\r\n

Header here...

\r\n {this.props.children}\r\n
\r\n );\r\n }\r\n}\r\n\r\nApp.propTypes = {\r\n children: PropTypes.element\r\n};\r\n\r\nexport default hot(module)(App);' }, esw:simple-detail { filePath: 'C:\_dev\hadrondesign\src\components\home\HomePage.jsx', esw:simple-detail messages: [], esw:simple-detail errorCount: 0, esw:simple-detail warningCount: 0, esw:simple-detail fixableErrorCount: 0, esw:simple-detail fixableWarningCount: 0 }, esw:simple-detail { filePath: 'C:\_dev\hadrondesign\src\index.js', esw:simple-detail messages: [ [Object], [Object], [Object], [Object] ], esw:simple-detail errorCount: 0, esw:simple-detail warningCount: 4, esw:simple-detail fixableErrorCount: 0, esw:simple-detail fixableWarningCount: 0, esw:simple-detail source: 'import \'babel-polyfill\';\r\nimport { render } from \'react-dom\';\r\nimport { BrowserRouter as Router, browserHistory } from \'react-router-dom\';\r\n//import routes from \'./routes\';\r\n//import \'popper.js\';\r\nimport \'./../node_modules/bootstrap-material-design/dist/js/bootstrap-material-design.min.js\';\r\nimport \'./../node_modules/bootstrap-material-design/scss/_core.scss\';\r\nimport \'./styles/styles.scss\';\r\n\r\nimport App from \'./components/App\'; //bugfixing\r\nimport { Route, Link } from \'react-router-dom\';\r\nimport HomePage from \'./components/home/HomePage\';\r\nimport AboutPage from \'./components/about/AboutPage\';\r\n\r\n// import \'./../node_modules/bootstrap-material-design/dist/css/bootstrap-material-design.min.css\';\r\n\r\nconsole.log(\'NODE_ENV = \' + process.env.NODE_ENV);\r\nconsole.log(\'index.js represent\');\r\n\r\n// render(\r\n// ,\r\n// document.getElementById(\'app\')\r\n// );\r\n\r\nrender(\r\n \r\n
\r\n
    \r\n
  • \r\n App\r\n
  • \r\n
  • \r\n About\r\n
  • \r\n
  • \r\n Home\r\n
  • \r\n
\r\n \r\n \r\n \r\n
\r\n
,\r\n document.getElementById(\'app\')\r\n);\r\n\r\n\r\nif (module.hot) {\r\n module.hot.accept();\r\n}' }, esw:simple-detail { filePath: 'C:\_dev\hadrondesign\src\routes.jsx', esw:simple-detail messages: [], esw:simple-detail errorCount: 0, esw:simple-detail warningCount: 0, esw:simple-detail fixableErrorCount: 0, esw:simple-detail fixableWarningCount: 0 } ] +6ms C:_dev\hadrondesign\src\components\App.jsx (0/2) ⚠ 4:1 Unexpected console statement no-console ⚠ 5:1 Unexpected console statement no-console

C:_dev\hadrondesign\src\index.js (0/4) ⚠ 3:57 'C:_dev\hadrondesign\node_modules\react-router-dom\index.js' imported multiple times import/no-duplicates ⚠ 11:29 'C:_dev\hadrondesign\node_modules\react-router-dom\index.js' imported multiple times import/no-duplicates ⚠ 17:1 Unexpected console statement no-console ⚠ 18:1 Unexpected console statement no-console

⚠ 6 warnings (16:27:36)

esw:eslint-cli { exitCode: 0, message: '' } +1s esw:esw-cli lint completed. Exit Code: 0 +1s

esw:esw-cli -w seen +1ms esw:watcher cli { useEslintrc: true, extensions: [ 'js', 'jsx' ], ignore: true } +1s esw:watcher options { watch: true, ext: [ 'js', 'jsx' ], format: 'simple-detail', eslintrc: true, ignore: true, inlineConfig: true, _: [ 'src' ] } +0ms esw:watcher Formatter local: simple-detail +1ms esw:simple-detail loaded +0ms esw:watcher Watching: [ 'src' ] +20ms esw:watcher Changed: src\components\App.jsx +4s esw:watcher src\components\App.jsx [ 'js', 'jsx' ] +7ms esw:watcher Changed: src\components\App.jsx +166ms esw:watcher src\components\App.jsx [ 'js', 'jsx' ] +3ms esw:watcher Changed: src\index.js +1s esw:watcher src\index.js [ 'js', 'jsx' ] +3ms esw:watcher Changed: src\index.js +645ms esw:watcher src\index.js [ 'js', 'jsx' ] +3ms esw:watcher Changed: src\components\App.jsx +1s esw:watcher src\components\App.jsx [ 'js', 'jsx' ] +2ms

rizowski commented 6 years ago

Thanks for posting this detailed issue. I am currently moving so it might take me a few days to get to look at this. I am open to reviewing pull requests if you happen to find a solution before I do. 😄

Nfinley commented 6 years ago

Per @Tenemo issue, I am also encountering the same thing. Thanks @rizowski for taking a look. Love this library.

chill5018 commented 6 years ago

Any progress on this @rizowski ?

rizowski commented 6 years ago

This should be fixed in V4.0.1