rizowski / eslint-watch Goto Github PK
View Code? Open in Web Editor NEWESLint with simple watching capabilities
Home Page: https://www.npmjs.com/package/eslint-watch
License: MIT License
ESLint with simple watching capabilities
Home Page: https://www.npmjs.com/package/eslint-watch
License: MIT License
We always thank for your great work.
I upgraded eslint-watch from 2.1.7 to 2.1.10 under windows to use eslint>2.0.0, then got the error with '-w' option.
Could you check it?
[email protected], [email protected] or [email protected]
Z:\>set DEBUG=esw:* & node_modules\.bin\esw -w test.js
esw:eslint-cli Loaded +0ms
esw:eslint-cli EsLint path: Z:\node_modules\.bin\eslint.cmd +16ms
esw:eslint-help Loaded +47ms
esw:options Loaded +31ms
esw:success-formatter loaded +343ms
esw:simple-detail loaded +0ms
esw:watcher Loaded +0ms
esw:arg-parser Loaded +0ms
esw:esw-cli Loaded +16ms
esw:esw-cli Eslint-Watch: 2.1.10 +0ms
esw:eslint-help Executing help +0ms
esw:eslint-cli eslint: [ '--help' ] +0ms
esw:eslint-help Help text received +436ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -c +0ms
esw:eslint-help Parsing --config +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-eslintrc +0ms
esw:eslint-help Parsing no option +16ms --no-eslintrc
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --env +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --ext +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --global +16ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --parser +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --parser-options +0ms
esw:eslint-help noAlias +15ms true
esw:eslint-help Parsing --cache +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --cache-file +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --cache-location +16ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --rulesdir +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --plugin +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --rule +15ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --ignore-path +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-ignore +0ms
esw:eslint-help Parsing no option +16ms --no-ignore
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --ignore-pattern +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --stdin +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --stdin-filename +16ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --quiet +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --max-warnings +0ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -o +0ms
esw:eslint-help Parsing --output-file +15ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -f +0ms
esw:eslint-help Parsing --format +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-color +0ms
esw:eslint-help Parsing no option +16ms --no-color
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --init +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --fix +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --debug +0ms
esw:eslint-help noAlias +15ms false
esw:eslint-help Alias found: -h +0ms
esw:eslint-help Parsing --help +0ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -v +0ms
esw:eslint-help Parsing --version +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-inline-config +16ms
esw:eslint-help Parsing no option +0ms --no-inline-config
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --print-config +0ms
esw:esw-cli Arguments passed: [ 'C:\\Program Files\\nodejs\\node.exe', 'Z:\\node_modules\\eslint-watch\\bin\\esw', '-w', 'test.js' ] +16ms
esw:esw-cli Parsing args +0ms
esw:arg-parser Directories to check: [ 'test.js' ] +0ms
esw:arg-parser Args [ '-w', 'test.js' ] +0ms
esw:arg-parser Pushing item: test.js +15ms
esw:arg-parser setting custom formatter +0ms
esw:arg-parser GetPath: simple-detail +0ms
esw:esw-cli Running initial lint +0ms
esw:esw-cli [ 'test.js', '-f', 'Z:\\node_modules\\eslint-watch\\src\\formatters\\simple-detail' ] +0ms
esw:eslint-cli eslint: [ 'test.js', '-f', 'Z:\\node_modules\\eslint-watch\\src\\formatters\\simple-detail' ] +0ms
esw:esw-cli -w seen +16ms
esw:watcher { useEslintrc: true, ignore: true } +0ms
esw:watcher { watch: true, format: 'simple-detail', eslintrc: true, ignore: true, color: true, inlineConfig: true, _: [ 'test.js' ] } +15ms
esw:watcher Watching: [ 'test.js' ] +78ms
esw:eslint-cli 0 +16ms
{ [Error: watch test.js EINVAL]
code: 'EINVAL',
errno: 'EINVAL',
syscall: 'watch test.js',
filename: 'test.js' }
esw:simple-detail loaded +0ms
esw:simple-detail [ { filePath: 'Z:\\test.js', messages: [], errorCount: 0, warningCount: 0 } ] +15ms
✓ Clean (09:40:52)
esw:esw-cli exitCode: 0 +530ms
The current single-file mode of eslint-watch only runs on the last file that was saved. This hides errors/warnings on other files that may have been overlooked on previous eslint runs/iterations.
It would be much better to have a mode wherein eslint-watch would parse the results of each run, cache a list of the files with errors/warnings, and include those files in its next run, along with any files that have changed. This mode would cover the known "dirty/broken" files that need to be checked to get back to a known "clean" state.
ESLint watch seems to "forget" which formatter to use. I am trying to set the formatter to Sindre Sorhus's nice https://github.com/sindresorhus/eslint-formatter-pretty. It's a slightly different version of the simple-detail
formatter baked into esw
, based on earlier work by Sindre. However, while the formatter appears correctly for the first pass of the lint, it reverts to simple-detail
thereafter.
node_modules/.bin/esw --ignore-path .gitignore -f node_modules/eslint-formatter-pretty --watch
Running with DEBUG=*
produces thousands of lines. Are you sure you want them?
The extensions option, esw -w --ext .js,.jsx
, is ignored by the watcher. Instead, it uses the ESLint default, which is .js
.
With the discussion of using the ESLint options object, I have decided that the options structure is going to need to change a little. The options can still be passed in the same way but the underlying structure is going to be a little different.
Removing the options that eslint has and adding just the options I want.
Still parsing out my tool's specific args and passing them on to eslint
If the user wants to see ESLint options, they need to specify a slightly different help command. I can then just execute ESLint's help cli command.
I want a debug flag that can be set so that additional logging appears.
Maybe this already exists and I didn't see it, but would it be possible to easily re-run the full lint-suite while you are already watching. Perhaps hitting the enter key could trigger a full suite re-run.
Node 4.0 is causing eslint-watch to lint the node directory. This could be caused by nvm on OSX since it is passing a path.
Current tests for help are causing a problem on CI. For slow environments such as Appveyor, they are failing because it is taking longer than 5 seconds to resolve. I have not been able to replicate this issue on any local environment.
7.10.0
3.1.0
3.19.0
When running the command, the first full run will correctly bring up any errors and start watching for file changes, however once a file is changed, the change is recognised (see debug output attached) but the linter only returns undefined
and never reports new errors.
In this case I deliberately put multiple errors in to test and it only ever returns undefined
after the first run.
Note: All parts of this process/bin/config are installed locally, not globally.
DEBUG=esw:* yarn esw -- -w --color --no-ignore "lib/**"
undefined
.➜ my-project git:(master) ✗ DEBUG=esw:* yarn esw -- -w --color --no-ignore "lib/**"
yarn esw v0.24.6
$ "/Users/jannis/Sites/wdp-ui/my-project/node_modules/.bin/esw" -w --color --no-ignore lib/**
esw:internal-settings Eslint installed locally node_modules/.bin/eslint +0ms
esw:internal-settings { eslintPath: 'node_modules/.bin/eslint',
esw:internal-settings platform: 'darwin',
esw:internal-settings isWindows: false } +2ms
esw:eslint-cli Loaded +219ms
esw:eslint-help Loaded +73ms
esw:options Loaded +0ms
esw:eslint-help Executing help +1ms
esw:eslint-cli eslint: '--help' +7ms
esw:executor node_modules/.bin/eslint [ '--help' ] +11ms
esw:eslint-cli { exitCode: 0,
esw:eslint-cli message: '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\n' } +430ms
esw:eslint-help Alias found: -c +2ms
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 +1ms
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 +0ms
esw:eslint-help Parsing --rulesdir +0ms
esw:eslint-help Parsing --plugin +0ms
esw:eslint-help Parsing --rule +1ms
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 +1ms
esw:eslint-help Alias found: -o +1ms
esw:eslint-help Parsing --output-file +0ms
esw:eslint-help Alias found: -f +0ms
esw:eslint-help Parsing --format +0ms
esw:eslint-help Parsing --init +1ms
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:watcher Loaded +359ms
esw:arg-parser Loaded +1ms
esw:esw-cli Loaded +0ms
esw:esw-cli Eslint-Watch: 3.1.0 +0ms
esw:esw-cli Arguments passed: [ '/usr/local/bin/node', '/Users/jannis/Sites/wdp-ui/my-project/node_modules/.bin/esw', '-w', '--color', '--no-ignore', 'lib/index.jsx' ] +1ms
esw:esw-cli Parsing args +2ms
esw:arg-parser Directories to check: [ 'lib/index.jsx' ] +0ms
esw:arg-parser Args [ '-w', '--color', '--no-ignore', 'lib/index.jsx' ] +0ms
esw:arg-parser Pushing item: --color +1ms
esw:arg-parser Pushing item: --no-ignore +0ms
esw:arg-parser Pushing item: lib/index.jsx +0ms
esw:arg-parser setting custom formatter +0ms
esw:arg-parser GetPath: simple-detail +0ms
esw:arg-parser /Users/jannis/Sites/wdp-ui/my-project/node_modules/eslint-watch/build/formatters/simple-detail +0ms
esw:esw-cli Running initial lint +0ms
esw:esw-cli [ '--color',
esw:esw-cli '--no-ignore',
esw:esw-cli 'lib/index.jsx',
esw:esw-cli '-f',
esw:esw-cli '/Users/jannis/Sites/wdp-ui/my-project/node_modules/eslint-watch/build/formatters/simple-detail' ] +0ms
esw:eslint-cli eslint: '--color --no-ignore lib/index.jsx -f /Users/jannis/Sites/wdp-ui/my-project/node_modules/eslint-watch/build/formatters/simple-detail' +1ms
esw:executor node_modules/.bin/eslint [ '--color',
'--no-ignore',
'lib/index.jsx',
'-f',
'/Users/jannis/Sites/wdp-ui/my-project/node_modules/eslint-watch/build/formatters/simple-detail' ] +0ms
esw:simple-detail loaded +0ms
esw:simple-detail [ { filePath: '/Users/jannis/Sites/wdp-ui/my-project/lib/index.jsx',
esw:simple-detail messages: [ [Object], [Object] ],
esw:simple-detail errorCount: 2,
esw:simple-detail warningCount: 0,
esw:simple-detail source: 'import React from \'react\';\nimport PropTypes from \'prop-types\';\nimport styled from \'styled-components\';\n\nexport function themeColor(props = {}, type = \'\', fallback = \'red\') {\n if (props && props.theme) {\n const { theme } = props.theme;\n\n if (theme && theme.color && theme.color[type]) {\n return theme.color[type];\n }\n }\n\n return fallback;\n}\n\nconst StyledButton = styled.button`\n font-size: 20px;\n line-height: 1;\n border-radius: 2px;\n border: 1px solid ${props => themeColor(props, \'border\', \'#eee\')};\n background: ${props => themeColor(props, \'background\', \'#fff\')};\n color: ${props => themeColor(props, \'main\', \'#000\')};\n padding: .5em .8em;\n`;\n\n// The main export, the react element.\nexport default function Button({ onClick, label }) {\n return (\n <StyledButton type="button" onClick={onClick}>{label}</StyledButton>\n );\n}\n\n// defaults & propType validation\nButton.propTypes = {\n label: PropTypes.string.isRequired,\n onClick: PropTypes.func,\n};\nButton.defaultProps = {\n label: \'Button Label\',\n onClick() { },\n};\n' } ] +5ms
/Users/jannis/Sites/wdp-ui/my-project/lib/index.jsx (2/0)
✖ 30:7 Expected indentation of 4 space characters but found 6 react/jsx-indent
✖ 40:5 Expected indentation of 2 spaces but found 4 indent
✖ 2 errors (10:36:21 AM)
esw:eslint-cli { exitCode: 1, message: '' } +1s
esw:esw-cli lint completed. Exit Code: 1 +0ms
esw:esw-cli -w seen +1ms
esw:watcher { useEslintrc: true, ignore: false, format: 'simple-detail' } +4ms
esw:watcher { watch: true,
esw:watcher color: true,
esw:watcher ignore: false,
esw:watcher format: 'simple-detail',
esw:watcher eslintrc: true,
esw:watcher inlineConfig: true,
esw:watcher _: [ 'lib/index.jsx' ] } +1ms
esw:watcher Trying to load formatter for re-lint from ./formatters/simple-detail +11ms
esw:simple-detail loaded +11ms
esw:watcher Watching: [ 'lib/index.jsx' ] +3ms
esw:watcher Changed: lib/index.jsx +18s
esw:watcher lib/index.jsx undefined +3ms
Note the last 2 lines: The change is registered but returns undefined
.
Hi I am running the command
esw . -w
from the root of the project. it runs the lint but when I make a change in a file and go back to console it exits.
Am I doing something wrong?
R
Hi! Great project - thanks so much for putting this together!
For a few reasons we have a big .eslintignore file. Every time we start eslint-watch we get a long list of warning messages saying File ignored because of your .eslintignore file. Use --no-ignore to override
.
It doesn't quite feel like the type of thing I would want to be warned about (but perhaps some people do).
Any chance for a flag to turn off this warning? I'm really certain I want to ignore those files, but I don't want to be reminded with dozens of warning outputs.
Thanks again!
Idea first presented by: @zack37
While there is a way to trigger a full directory lint while watching ( #11 ); it would be nice to be able to set a flag that overrides the single file lint functionality so you don't have to hit enter
if you don't want to. This feature may not be a desired thing for older projects that are trying to get into the practice of linting. So this feature should be an opt-in flag. It probably doesn't matter if it is an opt-in feature anymore with this going to a 3.0.0 release. By default the --changed
will enable single file linting on --watch
The expected flag could be something along the lines of esw -w --changed
. This flag might need to be a conditional flag, where it can only be used if the watch
flag is enabled.
On Windows, if you try running eslint-watch in a path that contains spaces in the name, it will fail to parse the path properly.
Example: coryhouse/react-slingshot#150
Someone thought it might be a good idea to make eslint-watch more of a plugin to eslint. I have played around with the idea before but never really looked into if it would be possible. Knowing how pluggable eslint is now, I would assume this could be possible.
https://twitter.com/reiterative_dev/status/695021487594430464
Make the settings be accessible via require/import. This will allow them to be imported (required) without needing them to be passed around. Other workflow items such as parsing and executing eslint will still need to pass around input and other such configuration. Eslint-Watch internal settings, however, do not.
It seems like eslint-watch is parsing out no from the command list that is returned from eslint. These are the commands that seem to error
--no-eslintrc Disable use of configuration from .eslintrc
--no-ignore Disable use of .eslintignore
--no-color Disable color in piped output
--no-inline-config Allow comments to change eslint config/rules
[email protected], [email protected], [email protected]
When we use both '-w' and '-c', the initial eslint works fine with config file which is specified in command-line, but the config file looks not be used when the watching file is changed.
Z:\>set DEBUG=esw:* & node_modules\.bin\esw -w -c conf/.eslintrc.json sample/*.js
esw:eslint-cli Loaded +0ms
esw:eslint-cli EsLint path: Z:\node_modules\.bin\eslint.cmd +0ms
esw:eslint-help Loaded +47ms
esw:options Loaded +31ms
esw:watcher Loaded +328ms
esw:arg-parser Loaded +62ms
esw:esw-cli Loaded +16ms
esw:eslint-help Executing help +0ms
esw:eslint-cli Linting: undefined +0ms
esw:eslint-help Help text received +359ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -c +0ms
esw:eslint-help Parsing --config +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-eslintrc +0ms
esw:eslint-help Parsing no option +0ms --no-eslintrc
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --env +15ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --ext +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --global +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --parser +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --cache +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --cache-file +16ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --cache-location +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --rulesdir +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --plugin +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --rule +15ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --ignore-path +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-ignore +0ms
esw:eslint-help Parsing no option +0ms --no-ignore
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --ignore-pattern +16ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --stdin +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --stdin-filename +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --quiet +0ms
esw:eslint-help noAlias +16ms true
esw:eslint-help Parsing --max-warnings +0ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -o +0ms
esw:eslint-help Parsing --output-file +0ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -f +0ms
esw:eslint-help Parsing --format +15ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-color +0ms
esw:eslint-help Parsing no option +0ms --no-color
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --init +0ms
esw:eslint-help noAlias +16ms true
esw:eslint-help Parsing --fix +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --debug +0ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -h +0ms
esw:eslint-help Parsing --help +15ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -v +0ms
esw:eslint-help Parsing --version +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-inline-config +0ms
esw:eslint-help Parsing no option +0ms --no-inline-config
esw:esw-cli Arguments passed: [ 'C:\\Program Files\\nodejs\\node.exe', 'Z:\\node_modules\\eslint-watch\\bin\\esw', '-w', '-c', 'conf/.eslintrc.json', 'sample/*.j
esw:esw-cli Parsing args +16ms
esw:arg-parser Directories to check: [ 'sample/*.js' ] +0ms
esw:arg-parser Args [ '-w', '-c', 'conf/.eslintrc.json', 'sample/*.js' ] +0ms
esw:arg-parser Pushing item: -c +0ms
esw:arg-parser Pushing item: conf/.eslintrc.json +15ms
esw:arg-parser Pushing item: sample/*.js +0ms
esw:arg-parser setting custom formatter +0ms
esw:arg-parser GetPath: simple-detail +0ms
esw:esw-cli Running initial lint +0ms
esw:esw-cli [ '-c', 'conf/.eslintrc.json', 'sample/*.js', '-f', 'Z:\\node_modules\\eslint-watch\\src\\formatters\\simple-detail' ] +0ms
esw:eslint-cli Linting: [ 'sample/*.js' ] +16ms
esw:esw-cli -w seen +0ms
esw:watcher Watching: [ 'sample/*.js' ] +15ms
Z:\sample\test.js (1/0)
✖ 1:22 Unnecessary semicolon no-extra-semi
✖ 1 error (23:17:38)
esw:esw-cli Setting exit code to: 1 +515ms
File saved without changes.
esw:watcher Changed: +5s sample\test.js
esw:watcher lintFile: sample\test.js +31ms
esw:watcher result: { filePath: 'Z:\\sample\\test.js', messages: [ { ruleId: 'no-extra-semi', severity: 1, message: 'Unnecessary semicolon.', line: 1, column: 22
t] } ], errorCount: 0, warningCount: 1 } +94ms
Z:\sample\test.js (0/1)
! 1:22 Unnecessary semicolon no-extra-semi
! 1 warning (23:17:44)
I used the following files.
z:\.eslintrc.json
:
{ "rules": { "no-extra-semi": 1 } }
z:\conf\.eslintrc.json
:
{ "rules": { "no-extra-semi": 2 } }
z:\sample\.eslintrc.json
:
console.log('hello');;
With the 3.0.0 release of eslint-watch I am going to adopt the changes for eslint 2.
package.json:
{
"scripts": {
"lint:watch": "esw -w",
"start": "npm run lint:watch & wait"
},
"devDependencies": {
"eslint": "^1.5.0",
"eslint-watch": "^2.1.1"
}
}
shell:
❯ npm run watch
> @ watch /Users/kenneth/stuff/eslint-test
> npm run lint:watch & wait
> @ lint:watch /Users/kenneth/stuff/eslint-test
> esw -w
Linting: ./
TypeError: undefined is not a function
TypeError: undefined is not a function
at keyListener (/Users/kenneth/stuff/eslint-test/node_modules/eslint-watch/src/cli.js:43:9)
at /Users/kenneth/stuff/eslint-test/node_modules/eslint-watch/src/cli.js:58:7
at /Users/kenneth/stuff/eslint-test/node_modules/eslint-watch/src/options.js:41:7
at Socket.<anonymous> (/Users/kenneth/stuff/eslint-test/node_modules/eslint-watch/src/eslint/help.js:
75:7)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at Pipe.onread (net.js:538:20)
The watching doesn't work when the process is in the background.
> [email protected] lint-watch /Users/jong/Workspace/vacation/vacation-server
> esw -w --cache --cache-location node_modules/.cache/esw .
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
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 Number 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
✓ /Users/jong/Workspace/vacation/vacation-server/client/TopBar/index.js (11:08:46 PM)
removing the cache options does not show the help info
Currently the watch parameter only assumes that *.js
are the files you want to watch. This needs to be able to take in what ever pattern eslint accepts.
Is there an option to clear the Terminal each time eslint is run, to show only the results of the last run?
Using esw version 3.8.1, I am attempting to run quiet mode. This is correctly enforced upon first run of the command. However, when I change a file, and esw refreshes, quiet mode is no longer enforced; warnings are displayed.
Command:
node ./node_modules/eslint-watch/bin/esw -w --color --quiet --ignore-path ./.eslintignore
No output when running esw
.
➜ 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
When running esw I get that eslint-watch cannot find eslint. The command esw will not run at all even with -h, --esw-version.
esw ...
// to grab debug output set DEBUG=esw:*
throw new Error('Eslint needs to be installed globally or locally in node_modules.');
^
Error: Eslint needs to be installed globally or locally in node_modules.
at loadEslintPath (C:\Users\<username>\AppData\Roaming\npm\node_modules\eslint-watch\src\settings.js:24:13)
at Object.<anonymous> (C:\Users\<username>\AppData\Roaming\npm\node_modules\eslint-watch\src\settings.js:10:
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\<username>\AppData\Roaming\npm\node_modules\eslint-watch\src\index.js:4:1)
lib/cli is considered a non public js file. It isn't meant to be public facing. After some discussion with the creator of ESLint I was able to find another way of processing commands. github issue
I have been trying to get my front-end working on docker for the past day and I have narrowed down some irregular behaviour to eslint-watch and docker.
I have recreated a minimal working repo of the bug I am experiencing.
It seems that linting is somehow staggered when using docker-compose (docker-compose up
specifically, docker-compose run
seems to work fine). Rather the last console log statements are staggered. I am not sure what it is, but from my reading the best interpretation I can give is that the log messages that should be printed out for the linting are for some reason not flushed out of the node message queue.
I have narrowed down the message printing to the eslint watcher file. If I add in more console logs at the end of this method it prints out the linting fine, but it staggers my logs (i.e. the last logs in execution).
To replicate, download my repo, run docker-compose up
and edit the test.js file and save. You will see what I mean.
I hope this is descriptive enough, it's a really strange bug.
Any ideas how I can actually figure this out?
Found a problem where eslint-watch is expecting you to have it as a dependency.
Solutions:
Problems:
Eslint V2.8.0
Eslint-Watch: 2.1.10
DEBUG=esw:* npm run lint -- --fix
> booking-service@0.5.0 lint /Users/rizowski/git/ll/imp-booking-service
> esw --quiet "--fix"
esw:eslint-cli Loaded +0ms
esw:eslint-cli EsLint path: /Users/rizowski/git/ll/imp-booking-service/node_modules/.bin/eslint +2ms
esw:eslint-help Loaded +28ms
esw:options Loaded +13ms
esw:success-formatter loaded +179ms
esw:simple-detail loaded +1ms
esw:watcher Loaded +0ms
esw:arg-parser Loaded +1ms
esw:esw-cli Loaded +0ms
esw:esw-cli Eslint-Watch: 2.1.10 +0ms
esw:eslint-help Executing help +0ms
esw:eslint-cli eslint: [ '--help' ] +0ms
esw:eslint-help Help text received +197ms
esw:eslint-help noAlias +1ms false
esw:eslint-help Alias found: -c +0ms
esw:eslint-help Parsing --config +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-eslintrc +1ms
esw:eslint-help Parsing no option +0ms --no-eslintrc
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --env +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --ext +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --global +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --parser +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --parser-options +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --cache +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --cache-file +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --cache-location +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --rulesdir +0ms
esw:eslint-help noAlias +1ms true
esw:eslint-help Parsing --plugin +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --rule +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --ignore-path +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-ignore +0ms
esw:eslint-help Parsing no option +0ms --no-ignore
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --ignore-pattern +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --stdin +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --stdin-filename +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --quiet +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --max-warnings +0ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -o +0ms
esw:eslint-help Parsing --output-file +0ms
esw:eslint-help noAlias +1ms false
esw:eslint-help Alias found: -f +0ms
esw:eslint-help Parsing --format +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --color +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --init +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --fix +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --debug +0ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -h +0ms
esw:eslint-help Parsing --help +0ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -v +0ms
esw:eslint-help Parsing --version +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-inline-config +0ms
esw:eslint-help Parsing no option +0ms --no-inline-config
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --print-config +0ms
[Error: Option 'color': Error parsing type '--no-color': Unexpected character: - - Remaining tokens: ["-","-","no","-","color"] - Initial input: '--no-color']
Either the --quiet flag should also mute the esw "Linting:" output or there should be another flag for that purpose.
As it stands now if you have many separate files to lint you fill up the terminal with a long unreadable block of files.
Specifying a single extension works correctly:
esw -w --ext .js
However, specifying multiple extensions breaks the watcher:
esw -w --ext .js,.jsx
Hi,
In my project, the .eslintrc file is used across projects, and so is in a dependency. It references other custom lint configs and plugins, all peer dependencies.
If I use esw -c node_modules/#DEPENDENCY/.eslintrc --color src --watch
it runs fine. However, as soon as a file changes, I get this:
Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react'
Referenced from: xo-react/space
Referenced from: ##CUSTOM RULE##
Referenced from: ##PROJECT_PATH##/node_modules/##DEPENDENCY##/.eslintrc
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.load (~/.nvm/versions/node/v6.7.0/lib/node_modules/eslint/lib/config/plugins.js:129:26)
at Array.forEach (native)
at Object.loadAll (~/.nvm/versions/node/v6.7.0/lib/node_modules/eslint/lib/config/plugins.js:151:21)
at load (~/.nvm/versions/node/v6.7.0/lib/node_modules/eslint/lib/config/config-file.js:511:21)
at configExtends.reduceRight.e (~/.nvm/versions/node/v6.7.0/lib/node_modules/eslint/lib/config/config-file.js:391:36)
at Array.reduceRight (native)
If I install all the plugins to the global node_modules, it works. It seems to only find relatively referenced plugins on the initial pass, and not on any subsequent watcher passes.
I'm not specifying any options, but I'm getting this error on esw
Node version: v5.10.1
eslint version: v2.9.0
Logs: (ran DEBUG=* esw
)
esw:eslint-cli Loaded +0ms
esw:eslint-cli EsLint path: /Users/ben/frontend/node_modules/.bin/eslint +3ms
esw:eslint-help Loaded +33ms
esw:options Loaded +18ms
esw:success-formatter loaded +226ms
esw:simple-detail loaded +2ms
esw:watcher Loaded +0ms
esw:arg-parser Loaded +0ms
esw:esw-cli Loaded +1ms
esw:esw-cli Eslint-Watch: 2.1.10 +0ms
esw:eslint-help Executing help +0ms
esw:eslint-cli eslint: [ '--help' ] +0ms
esw:eslint-help Help text received +254ms
esw:eslint-help noAlias +1ms false
esw:eslint-help Alias found: -c +0ms
esw:eslint-help Parsing --config +0ms
esw:eslint-help noAlias +1ms true
esw:eslint-help Parsing --no-eslintrc +0ms
esw:eslint-help Parsing no option +0ms --no-eslintrc
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --env +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --ext +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --global +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --parser +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --parser-options +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --cache +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --cache-file +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --cache-location +1ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --rulesdir +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --plugin +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --rule +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --ignore-path +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-ignore +0ms
esw:eslint-help Parsing no option +0ms --no-ignore
esw:eslint-help noAlias +1ms true
esw:eslint-help Parsing --ignore-pattern +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --stdin +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --stdin-filename +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --quiet +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --max-warnings +0ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -o +0ms
esw:eslint-help Parsing --output-file +0ms
esw:eslint-help noAlias +1ms false
esw:eslint-help Alias found: -f +0ms
esw:eslint-help Parsing --format +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --color +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --init +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --fix +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --debug +0ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -h +0ms
esw:eslint-help Parsing --help +0ms
esw:eslint-help noAlias +0ms false
esw:eslint-help Alias found: -v +0ms
esw:eslint-help Parsing --version +0ms
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --no-inline-config +0ms
esw:eslint-help Parsing no option +0ms --no-inline-config
esw:eslint-help noAlias +0ms true
esw:eslint-help Parsing --print-config +0ms
[Error: Option 'color': Error parsing type '--no-color': Unexpected character: - - Remaining tokens: ["-","-","no","-","color"] - Initial input: '--no-color']
I want to get this to be 100% es6. 😄
Version 1.2.4 worked fine, it was reliably linting files on change. But version 2.1.2 doesn't do anything on file change. I'm on Windows 8.1 x64.
This is my npm script (watching 2 folders):
"watch:eslint": "esw -w ./ChatUI.JavaScript/src/app ./ChatUI.JavaScript/src/sdk",
and here is some output with DEBUG=esw:*
:
> [email protected] watch:eslint J:\source\EmbeddedChat\EmbeddedChat
> set DEBUG=esw:*&& esw -w ./ChatUI.JavaScript/src/app ./ChatUI.JavaScript/src/sdk
esw:eslint-cli .cmd +0ms
esw:eslint-cli J:\source\EmbeddedChat\EmbeddedChat\node_modules\.bin\eslint.cmd +3ms
esw:eslint-help Executing help +607ms
esw:eslint-help Help text received +774ms
esw:eslint-help Alias found: -c +2ms
esw:eslint-help Parsing --config +1ms
esw:eslint-help Parsing --no-eslintrc +3ms
esw:eslint-help Parsing --env +4ms
esw:eslint-help Parsing --ext +2ms
esw:eslint-help Parsing --global +4ms
esw:eslint-help Parsing --parser +4ms
esw:eslint-help Parsing --cache +3ms
esw:eslint-help Parsing --cache-file +3ms
esw:eslint-help Parsing --rulesdir +3ms
esw:eslint-help Parsing --plugin +4ms
esw:eslint-help Parsing --rule +3ms
esw:eslint-help Parsing --ignore-path +3ms
esw:eslint-help Parsing --no-ignore +4ms
esw:eslint-help Parsing --ignore-pattern +3ms
esw:eslint-help Parsing --stdin +3ms
esw:eslint-help Parsing --stdin-filename +3ms
esw:eslint-help Parsing --quiet +3ms
esw:eslint-help Parsing --max-warnings +3ms
esw:eslint-help Alias found: -o +4ms
esw:eslint-help Parsing --output-file +3ms
esw:eslint-help Alias found: -f +3ms
esw:eslint-help Parsing --format +3ms
esw:eslint-help Parsing --no-color +4ms
esw:eslint-help Parsing --init +3ms
esw:eslint-help Parsing --fix +3ms
esw:eslint-help Parsing --debug +3ms
esw:eslint-help Alias found: -h +4ms
esw:eslint-help Parsing --help +3ms
esw:eslint-help Alias found: -v +3ms
esw:eslint-help Parsing --version +3ms
esw:esw-cli Arguments passed: node,J:\source\EmbeddedChat\EmbeddedChat\node_modules\eslint-watch\bin\esw,-w,./ChatUI.JavaScript/src/app,./ChatUI.JavaScript/src/sdk +7ms
esw:esw-cli Parsing args +5ms
esw:arg-parser Directories to check: ./ChatUI.JavaScript/src/app,./ChatUI.JavaScript/src/sdk +2ms
esw:arg-parser [ 'esw', 'iojs', 'node' ] +3ms
esw:arg-parser contains J:\source\EmbeddedChat\EmbeddedChat\node_modules\eslint-watch\bin\esw +3ms
esw:arg-parser [ 'esw', 'iojs', 'node' ] +3ms
esw:arg-parser contains ./ChatUI.JavaScript/src/app +3ms
esw:arg-parser Pushing item: ./ChatUI.JavaScript/src/app +3ms
esw:arg-parser [ 'esw', 'iojs', 'node' ] +2ms
esw:arg-parser contains ./ChatUI.JavaScript/src/sdk +3ms
esw:arg-parser Pushing item: ./ChatUI.JavaScript/src/sdk +3ms
esw:arg-parser getPath: simple-detail +3ms
esw:esw-cli Running initial lint +2ms
Linting: ./ChatUI.JavaScript/src/app,./ChatUI.JavaScript/src/sdk
esw:esw-cli -w seen +10ms
Watching ./ChatUI.JavaScript/src/app,./ChatUI.JavaScript/src/sdk
✓ Clean (16:52:46)
esw:esw-cli Exiting setting exit code to: 0 +1s
Let me know if you need additional information, thanks!
Using v2.1.12 the color is missing from executing eslint-watch.
The color can be added back in manually specifying the flag --color
.
Refer to #86 for more information.
I just tried installing the eslint-watch plugin not sure what to make of this. I did notice the devdependencies are out of date.
$ sudo npm install -g eslint-watch
Password:
/usr/local/bin/esw -> /usr/local/lib/node_modules/eslint-watch/bin/esw
> [email protected] install /usr/local/lib/node_modules/eslint-watch/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/usr/local/lib/node_modules/eslint-watch/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" is installed via remote
> [email protected] install /usr/local/lib/node_modules/eslint-watch/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/usr/local/lib/node_modules/eslint-watch/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
/usr/local/lib
├── UNMET PEER DEPENDENCY eslint@>=0.19.0 <2.0.0
... snip dependency tree ...
npm WARN EPEERINVALID [email protected] requires a peer of eslint@>=0.19.0 <2.0.0 but none was installed.
$ npm list -g eslint
/usr/local/lib
└── [email protected]
$ npm -v
3.3.6
$ node -v
v4.2.0
Love this! There's one quirk I'd love to figure out. I'm sending two tasks to the same command line using npm-run-all. When I do, eslint-watch fails to be killed by the first Ctrl+C. I have to hit it twice. This only occurs on Mac. I created a simple repo to convey the issue.
It appears the first Ctrl+C kills eslint-watch, but it appears to swallow the kill signal and not pass it on to other running tasks. I can use many other tasks in parallel with npm-run-all and they all get killed when I hit Ctrl+C, so this quirk is unique to eslint-watch.
Using Node 4.2.1.
I have a directory with
index.js
({
a: 'arg1',
b: 'arg2'
})
package.json
{
"devDependencies": {
"eslint": "^1.9.0",
"eslint-watch": "^2.1.3"
}
}
.eslintrc
---
rules:
comma-dangle: [2, always]
After initiating this directory with git and committing the first commit, if I start watching and I run these commands in another terminal:
❯ echo "adsf" >> index.js
eslint-test git/master*
❯ echo "adsf" >> index.js
eslint-test git/master*
❯ git checkout -- .
I see
❯ $(npm bin)/esw -w
/Users/kenneth/stuff/eslint-test/index.js (1/0)
✖ 3:14 Missing trailing comma comma-dangle
✖ 1 error (10:12:38 AM)
/Users/kenneth/stuff/eslint-test/index.js (1/0)
✖ 3:14 Missing trailing comma comma-dangle
✖ 1 error (10:12:49 AM)
/Users/kenneth/stuff/eslint-test/index.js (1/0)
✖ 3:14 Missing trailing comma comma-dangle
✖ 1 error (10:12:55 AM)
/Users/kenneth/stuff/eslint-test/.git/index (1/0)
✖ 1:6 Parsing error: Unexpected token ILLEGAL
✖ 1 error (10:12:55 AM)
Your package is great! I'm just running into one issue: when I run my npm run dev
script, which uses npm-run-all
I get a TypeError: undefined is not a function
error, which is preventing my lint:watch
script from running. I have done some debugging, and everything works as expected running npm run lint:watch
by itself, or npm run dev
without the lint:watch
command...but I don't know how to debug it. Is this a known issue with eslint-watch
in the way that it handles npm script arguments or something?
I don't know if this is an issue with eslint-watch
or npm-run-all
, so I have posted the issue in both places. I do know that all of my other packages work as expected so something seems to be wrong with either eslint-watch
or npm-run-all
.
npm install
npm run lint:watch
runs as expectednpm run dev
runs npm-run-all
which works for everything except for lint:watch
which is outputting TypeError: undefined is not a function
p.s. I don't understand why eslint-watch
hasn't been merged into the core eslint
package?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.