prettier-cli-watcher v1.0.6
prettier-cli-watcher
Runs prettier from CLI on project files when modified.
Install
Locally per project:
$ npm install prettier-cli-watcher --save-dev
# or
$ yarn add prettier-cli-watcher --dev
Or globally:
$ sudo npm install -g prettier-cli-watcher
# or
$ yarn global add prettier-cli-watcher
How To Use
$ prettier-cli-watcher
Or use a package.json
script:
...
"scripts": {
"pretty": "prettier-cli-watcher"
}
...
Then run via $ npm run pretty
or $ yarn run pretty
.
Options
--dir
: The absolute path of directory to watch (default:process.cwd()
).--config
: The project's prettier config is automatically located and used via cosmiconfig.- Or provide the file's absolute path or relative path to
--dir
.
- Or provide the file's absolute path or relative path to
--ignore
: Like the prettier config, the project's.prettierignore
file is also located and used.- Or provide the file's absolute path or relative path to
--dir
. - Note: By default the entire
--dir
directory is watched. Make sure to use a.prettierignore
file to ignore paths likenode_modules/
,.git/
, anddist/
, for example.
- Or provide the file's absolute path or relative path to
--notify
: Enable OS notifications when prettier errors.--quiet
: Disable output.--setup
: List setup details.--dry
: Run prettier without saving changes (for ignore test runs).--version
: List prettier-cli-watcher version.
Configuration Files
cosmiconfig is used to locate the project's prettier configuration file if one is not explicitly provided. Going from top to bottom, the following places are searched until a prettier configuration file is found. If one is not found the default prettier settings are used.
[
'package.json',
'.prettierrc',
'configs/.prettierrc',
'.prettierrc.json',
'configs/.prettierrc.json',
'.prettierrc.yaml',
'configs/.prettierrc.yaml',
'.prettierrc.yml',
'configs/.prettierrc.yml',
'.prettierrc.js',
'configs/.prettierrc.js',
'prettier.config.js',
'configs/prettier.config.json',
'configs/prettier.config.js',
'.prettierrc.toml',
'configs/.prettierrc.toml'
]
Likewise, the project's .prettierignore
is looked for at the following locations. By default the entire --dir
directory is watched so ensure to use a .prettierignore
file to ignore paths like node_modules/
, .git/
, and dist/
, for example.
[
'.prettierignore',
'configs/.prettierignore',
'configs/prettierignore'
]
OS Support
- Made using Node.js
v8.14.0
on a Linux machine runningUbuntu 16.04.5 LTS
. - Tested and working on:
macOS High Sierra (v10.13)
.Windows 10 (v1703 OS Build: 15063.674)
.
Contributing
Contributions are welcome! Found a bug, feel like documentation is lacking/confusing and needs an update, have performance/feature suggestions or simply found a typo? Let me know! :)
See how to contribute here.
Attribution
License
This project uses the MIT License.
1 year ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago