rizowski / eslint-watch

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

Tried it and had to uninstall it #192

Open billyzkid opened 1 year ago

billyzkid commented 1 year ago

Environment

Basic Description of the problem

Basically, it did not work out of the box as expected for me. I would expect a "wrapper" to allow the esw CLI to be a drop-in replacement for eslint, but several things either worked differently or not at all.

For example, here are the simple lint scripts I use in package.json along with a fairly vanilla .eslintrc for a TypeScript project:

"lint": "eslint ./src",
"lint:fix": "npm run lint -- --fix",

I installed eslint-watch and updated it to this:

"lint": "esw ./src",
"lint:fix": "npm run lint -- --fix",

which gave me this error for npm run lint:

Oops! Something went wrong! :(

ESLint: 8.39.0

No files matching the pattern "./src" were found.
Please check for typing mistakes in the pattern.

so I updated it to this:

"lint": "esw ./src/**/*.ts",
"lint:fix": "npm run lint -- --fix",

which worked, but the errors were not displayed in color as they are for eslint by default. So I changed it to this:

"lint": "esw ./src/**/*.ts --color",
"lint:fix": "npm run lint -- --fix",

Now it was linting with color. But then I tried adding the --clear option. Nothing happened when I ran npm run lint. Perhaps it requires --watch, but the docs aren't clear here. So I ran npm run lint:fix and suddenly the terminal was cleared. I don't understand the expected behavior.

Bottom line is eslint-watch feels too brittle and unpredictable to use, which is a bit surprising to me for such a popular package.

ghostd commented 12 months ago

Hi,

I ran into this issue and i fixed it by using the --ext option eg:

esw ./src --ext .ts
mtfurlan commented 12 months ago

I was also surprised esw wasn't a drop in wrapper for eslint. To make it act similar to tsc --watch:

esw src/ test/ --ext .ts --watch --changed --clear --color

The worst part is having to hardcode paths, when I don't have to do that when calling eslint . directly.