Commit Graph

1621 Commits (184e368a9ac0fd8cc4195fec06378f3829ad7a68)

Author SHA1 Message Date
Ika 184e368a9a feat: support detailed `--help` (#2847)
* feat: support detailed --help

* refactor: put alias first, separate with comma

* feat: support detailed --help for --no-option

* docs: add missing type

* docs: remove `This requires node 8 or a transform`

* docs: remove config-precedence's choice descriptions in option.description

* docs: replace `option-name` with `flag`

* docs: update docs for `choices`

* docs: update `help` description

* docs: update error message

* docs: replace `undocumented` with empty string

* refactor: extract `getOptionDefaultValue`

* refactor: dynamically generate `defaults to ...`

* refactor: extract `getOptionWithLevenSuggestion`

* refactor: extract `createChoiceUsages`

* refactor: remove `optionTitleName`

* test: add `--help` tests for all options

* fix: handle `--help --help`

* feat: support `--help <alias>`

* refactor: use `flattenArray`

* feat: handle `--help <unknown>`

* docs: add description for `semi`, `color` and `bracket-spacing`

* fix: remove unnecessary option in `--help`
2017-09-21 07:54:13 +02:00
Lucas Duailibe 9b0d6b8de0 Fix different precedence binary expression when inlining (#2827) 2017-09-20 17:07:51 +02:00
Brian Ng 2be986d0d7 Add support for ClassPrivateProperty (#2837) 2017-09-19 21:41:24 +02:00
Simon Lydell 68d1b56696 Comment out config file extensions docs until next release
See #2861.
2017-09-19 21:37:20 +02:00
Hugo Dias f6356ae94c chore: add prettier-stylelint to the related projects (#2859) 2017-09-19 20:23:06 +02:00
Daniel Tschinder eb776b7635 Update cosmiconfig to 3.0.1 to avoid memory leak (#2848) 2017-09-18 09:09:07 +10:00
Nick Ribal 592f99fde6 Enable cosmiconfig rcExtensions (#2749)
* Enable cosmiconfig rcExtensions; add two tests

* Remove default value; make integration input files self descripting; update all integration snapshots

* Add engines field to package.json
2017-09-17 02:47:53 +10:00
Simon Lydell ed67690925 Fix playground for the next release 2017-09-16 15:35:32 +02:00
Lucas Azzola 48899289da Upgrade cosmiconfig to v3, remove hardcoded combinatoric problem (#2843)
* Upgrade cosmiconfig to v3, remove hardcoded combinatoric problem

* Fix indendation change from 1.7

* Ensure default value for useCache is true

* Pin mem version
2017-09-16 20:24:08 +10:00
Joseph Frazier 2c59fb2f07 Upgrade prettier dependency to 1.7.0, fix lint (#2821) 2017-09-15 15:49:55 -04:00
Simon Lydell fb55367633 Don't lowercase Less variables when parsed with SCSS parser (#2833)
Fixes #2829
2017-09-15 19:48:16 +02:00
Simon Lydell 23041e2113 Don't lowercase `&class` in SCSS/Less selectors (#2834)
Fixes #2830
2017-09-15 19:48:04 +02:00
Brian Ng 5bd8ca472b Bump Babylon (#2831) 2017-09-15 17:26:35 +02:00
Simon Lydell 06c9127f02 Update instructions for running tests against dist
Fixes #2819.
2017-09-14 21:56:59 +02:00
Simon Lydell ec4abdfb1e Don't lowercase CSS custom media names (#2822)
Fixes #2820. While that issue is about `@media (--fooBar)` in
particular, this commit changes to never lowercase stuff starting with
`--` in general, as it seems like those `--customStuff` things can pop
up kind of anywhere.
2017-09-14 21:55:11 +02:00
Simon Lydell 219acfe0f8 Fix playground error 2017-09-14 19:52:37 +02:00
Simon Lydell 2ef7173f13 Fix playground button color 2017-09-14 19:40:38 +02:00
Stephen Scott bcb4224205 1.7.0
🎉
2017-09-14 11:21:33 -06:00
Stephen Scott 655fef1bf9 Merge pull request #2767 from ikatyang/refactor/cli
refactor(cli): centralize options
2017-09-14 11:12:19 -06:00
Simon Lydell 9c598b1846 Adjust quotes in some more cases of `@import` in CSS (#2818)
Fixes #2817.
2017-09-14 14:04:04 +02:00
Simon Lydell 1be06af923 Merge pull request #2814 from ikatyang/chore/jest-21
chore(deps): update jest-* to v21.1.0
2017-09-14 13:21:50 +02:00
Ika c100911bbc chore(deps): pin cosmiconfig (#2815) 2017-09-14 19:10:55 +08:00
Simon Lydell 457903ff74 Merge pull request #2791 from lydell/playground
Improve the playground
2017-09-14 12:24:02 +02:00
Simon Lydell 2756ab9a75 Add syntax highlighting for issue template options 2017-09-14 08:51:37 +02:00
Simon Lydell 1469ef9cea Use the jsx CodeMirror mode instead of javascript
Unfortunately, the "neat" theme we were using for CodeMirror does not
appear to support JSX, so I removed it and went back to the default
theme.
2017-09-14 08:49:20 +02:00
ikatyang 6fa30d9ccf refactor(runPrettier): replace multi-`.mockRestore()` with `jest.restoreAllMocks()` 2017-09-14 13:23:10 +08:00
ikatyang 6f9da6441c chore(deps): update jest-* to v21.1.0 2017-09-14 13:13:03 +08:00
ikatyang b2a8f3ffce Merge branch 'master' into refactor/cli 2017-09-14 12:49:07 +08:00
ikatyang 0bb7933bb1 refactor: move `categoryOrder` to cli-constant 2017-09-14 12:39:38 +08:00
ikatyang 7d7fb36499 docs: `requirePragma: <bool>` 2017-09-13 21:43:57 -06:00
Ika 71f5d185a7 docs(readme): port requirePragma docs to README.md (#2812)
* fix default value
2017-09-14 11:26:43 +08:00
Simon Lydell 5d0ed5c671 Remove 1px page scrollbar in playground 2017-09-14 01:03:38 +02:00
Simon Lydell b9c35cc249 Merge branch 'master' into playground
Conflicts:
	scripts/build/build.js
2017-09-14 00:50:14 +02:00
Simon Lydell 40cf41b15e Try to improve the playground default example 2017-09-14 00:48:22 +02:00
Simon Lydell 1375e6880a Generate ISSUE_TEMPLATE.md on build 2017-09-14 00:14:35 +02:00
Simon Lydell ecaeec5b59 Add feature to test idempotency in playground 2017-09-13 23:40:51 +02:00
Simon Lydell 5b576f4e78 Add more buttons to the playground 2017-09-13 23:07:19 +02:00
Simon Lydell 323941bfd8 Clean up playground CSS and design
- Move the version to the header. Saves some vertical space.
- Use system font.
- Simplify CSS.
- Better header alignment.
2017-09-13 21:01:11 +02:00
Will Binns-Smith d5e5d66407 Add option to require @prettier or @format pragma (#2772)
* Add option to require @prettier or @format pragma

Fixes #2397.

Inspired by `eslint-plugin-prettier` and the discussion in #2397, this
implements requiring a special comment pragma to be present in a file's
first comment in order to be formatted.

This will help large codebases gradually transition to prettier over
time without tons of churn or large code reviews.

I implemented this as a standard prettier "option", not just a typical
`argv` flag, as it is relevant in both the cli and the api. This way it
can be provided programmatically, on the command line, or standardized
in a prettierrc file so like the style options, every user can use this
setting consistently and only apply prettier to relevant files, no
mattier their editor integration.

This requires the pragma begin with `@` (in fact it's inserted if the
user doesn't provide it). Currently the usage implies it must be
"prettier" or "format", but it can technically be any value other than
"none", which is similar to the `trailingCommas` option.

cc @vjeux

* Don't quote anything in runPrettier; this is usually handled by a shell

* Make --require-pragma a boolean option

* Use jest-docblock to find pragmas without parsing the ast

* Clarify docs

* includes -> indexOf

* Move test out of integration
2017-09-13 09:03:18 -07:00
Simon Lydell cf9d52e9f3 Hide ast and doc editors while loading the playground 2017-09-13 16:47:21 +02:00
Simon Lydell 709e271051 Improve CLI usage summary and fix typo 2017-09-13 18:21:04 +08:00
Simon Lydell 45d200a06d Improve option categorization and usage summary
- Move the very important options --write and --list-different to the
  top, in the new Output category. It could be argued that --help and
  --version also belong there, but I don't think they deserve such a
  prominent position, so they are left in the Other category.
  --find-config-path could also be considered an Output option, but I
  think it fits better in the Config category.
- Now that there's an Output category, should there also be an Input
  category? I thought about that, but the only candidates for such a
  category are --stdin and --stdin-filepath and I don't think they are
  important enough to have their own category, so they stay in Other.
- Move --cursor-offset, --range-end and --range-start to a new Editor
  category, since they are mainly for editor integrations.
- Document how Prettier deals with input and output by default.
2017-09-13 18:21:04 +08:00
Simon Lydell 32dfb80c86 Remove unnecessary fall-through comment 2017-09-13 18:21:04 +08:00
Simon Lydell be65370301 Remove reassignment in createOptionUsage 2017-09-13 18:21:04 +08:00
Simon Lydell 5d435abe0a Tweak option categories
- Move Format options first, since they feel the most important.
- Move --find-config-path to the Config category.
- Merge Command into Other. It wasn't clear what "Command" options are,
  and the Other category isn't too long anyway.
- Move --range-end and --range-start into Other. The aren't Format
  options.
2017-09-13 18:21:04 +08:00
Simon Lydell c99f7e2e38 Tweak option descriptions 2017-09-13 18:21:04 +08:00
Simon Lydell 602c2a2774 Rename detailOptions to detailedOptions 2017-09-13 18:21:04 +08:00
Simon Lydell 661c029036 Make createUsage a bit easier to read 2017-09-13 18:21:04 +08:00
Simon Lydell 4e5c808730 Fix typo in option description 2017-09-13 18:21:04 +08:00
Simon Lydell e060406df1 Update options config comment 2017-09-13 18:21:04 +08:00