Comparing version 1.6.1 to 1.7.0
{ | ||
"name": "prettier", | ||
"version": "1.6.1", | ||
"version": "1.7.0", | ||
"description": "Prettier is an opinionated code formatter", | ||
@@ -18,3 +18,2 @@ "bin": { | ||
"cross-env": "5.0.1", | ||
"cross-spawn": "5.1.0", | ||
"eslint": "4.1.1", | ||
@@ -25,3 +24,4 @@ "eslint-friendly-formatter": "3.0.0", | ||
"eslint-plugin-react": "7.1.0", | ||
"jest": "20.0.0", | ||
"jest": "21.1.0", | ||
"markdown-toc": "1.1.0", | ||
"mkdirp": "^0.5.1", | ||
@@ -46,4 +46,5 @@ "prettier": "1.6.0", | ||
"lint": "cross-env EFF_NO_LINK_RULES=true eslint . --format node_modules/eslint-friendly-formatter", | ||
"build": "./scripts/build/build.js" | ||
"build": "node ./scripts/build/build.js", | ||
"toc": "node ./scripts/table-of-contents.js" | ||
} | ||
} |
104
README.md
@@ -24,2 +24,6 @@ # Prettier | ||
<!-- Do not edit TOC, regenerate with `yarn toc` --> | ||
<!-- toc --> | ||
* [What does Prettier do?](#what-does-prettier-do) | ||
@@ -69,2 +73,5 @@ * [Why Prettier?](#why-prettier) | ||
* [Contributing](#contributing) | ||
<!-- tocstop --> | ||
</details> | ||
@@ -239,14 +246,8 @@ | ||
#### `--with-node-modules` | ||
#### `--debug-check` | ||
Prettier CLI will ignore files located in `node_modules` directory. To opt-out from this behavior use `--with-node-modules` flag. | ||
If you're worried that Prettier will change the correctness of your code, add `--debug-check` to the command. | ||
This will cause Prettier to print an error message if it detects that code correctness might have changed. | ||
Note that `--write` cannot be used with `--debug-check`. | ||
#### `--list-different` | ||
Another useful flag is `--list-different` (or `-l`) which prints the filenames of files that are different from Prettier formatting. If there are differences the script errors out, which is useful in a CI scenario. | ||
```bash | ||
prettier --single-quote --list-different "src/**/*.js" | ||
``` | ||
#### `--find-config-path` and `--config` | ||
@@ -275,8 +276,55 @@ | ||
#### `--debug-check` | ||
#### `--ignore-path` | ||
If you're worried that Prettier will change the correctness of your code, add `--debug-check` to the command. | ||
This will cause Prettier to print an error message if it detects that code correctness might have changed. | ||
Note that `--write` cannot be used with `--debug-check`. | ||
Path to a file containing patterns that describe files to ignore. By default, prettier looks for `./.prettierignore`. | ||
#### `--require-pragma` | ||
Require a special comment, called a pragma, to be present in the file's first docblock comment in order for prettier to format it. | ||
```js | ||
/** | ||
* @prettier | ||
*/ | ||
``` | ||
Valid pragmas are `@prettier` and `@format`. | ||
#### `--list-different` | ||
Another useful flag is `--list-different` (or `-l`) which prints the filenames of files that are different from Prettier formatting. If there are differences the script errors out, which is useful in a CI scenario. | ||
```bash | ||
prettier --single-quote --list-different "src/**/*.js" | ||
``` | ||
#### `--no-config` | ||
Do not look for a configuration file. The default settings will be used. | ||
#### `--config-precedence` | ||
Defines how config file should be evaluated in combination of CLI options. | ||
**cli-override (default)** | ||
CLI options take precedence over config file | ||
**file-override** | ||
Config file take precedence over CLI options | ||
**prefer-file** | ||
If a config file is found will evaluate it and ignore other CLI options. If no config file is found CLI options will evaluate as normal. | ||
This option adds support to editor integrations where users define their default configuration but want to respect project specific configuration. | ||
#### `--with-node-modules` | ||
Prettier CLI will ignore files located in `node_modules` directory. To opt-out from this behavior use `--with-node-modules` flag. | ||
#### `--write` | ||
This rewrites all processed files in place. This is comparable to the `eslint --fix` workflow. | ||
### ESLint | ||
@@ -339,3 +387,3 @@ | ||
"lint-staged": { | ||
"*.js": [ | ||
"*.{js,json,css}": [ | ||
"prettier --write", | ||
@@ -436,2 +484,4 @@ "git add" | ||
Use `prettier.resolveConfig.sync([filePath [, options]])` if you'd like to use sync version. | ||
#### `prettier.clearConfigCache()` | ||
@@ -629,2 +679,26 @@ | ||
### Require pragma | ||
Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file. This is very useful | ||
when gradually transitioning large, unformatted codebases to prettier. | ||
For example, a file with the following as its first comment will be formatted when `--require-pragma` is supplied: | ||
```js | ||
/** | ||
* @prettier | ||
*/ | ||
``` | ||
or | ||
```js | ||
/** | ||
* @format | ||
*/ | ||
``` | ||
Default | CLI Override | API Override | ||
--------|--------------|------------- | ||
`false` | `--require-pragma` | `requirePragma: <bool>` | ||
## Configuration File | ||
@@ -631,0 +705,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5052505
64968
890
21
3