Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theoephraim/lint-fix-nodemon
Run ESLint+fix+nodemon without double restarts
https://github.com/theoephraim/lint-fix-nodemon
Last synced: 2 months ago
JSON representation
Run ESLint+fix+nodemon without double restarts
- Host: GitHub
- URL: https://github.com/theoephraim/lint-fix-nodemon
- Owner: theoephraim
- License: unlicense
- Created: 2020-02-22T20:52:13.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-13T02:11:59.000Z (almost 3 years ago)
- Last Synced: 2024-04-15T00:16:54.285Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 144 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lint-fix-nodemon
> Watch your files and run ESLint + fix + nodemon on save
**WHY DO YOU NEED THIS?**
1. Avoid a double restart when eslint fixes your files (nodemon would normally detect the initial change and then the fix change)
2. Don't get stuck if linting or starting the server fails - we just keep watching and trying again on each save### Installation
`npm install lint-fix-nodemon --save-dev` or `yarn add lint-fix-nodemon -D`### Setup
You can run it with `npx lint-fix-nodemon` or normally you should just add a script to your package.json file._I usually name it "dev" (`"dev": "lint-fix-nodemon"`) so you can run `npm run dev`_
### Configuration
By default, it will assume nodemon should run the script specified as your "main" in your package.json file.
Otherwise you can also pass it in as an argument -- for example: `lint-fix-nodemon ./api/start.js`Other configuration in terms of what files to watch and lint will be read from the [nodemonConfig](https://github.com/remy/nodemon#packagejson) entry in your package.json file
It will automatically ignore your node_modules folder and any files/folders that start with "."
### Setting ESLint extensions
Normally when running eslint from the cli, you must specify the extensions you wish to run on, or it will automatically just default to .js files only.
To avoid having to set it again, we copy the extension settings from the nodemon config set in package.json file.
This may mean you need to add some ignore rules in your eslintrc file, to ignore certain file types that you don't want to lint, but you do want changes to cause a nodemon restart.### An example package.json file
```
{
...
"scripts": {
"dev": "lint-fix-nodemon api/start.js",
...
},
"nodemonConfig": {
"watch": ["api/"],
"ignore": ["api/scripts"],
"ext": "js,json,ts"
},
...
}
```