Commit Graph

1048 Commits (2466ce11a5233a88b1682ef70b04c1993c2bdda0)

Author SHA1 Message Date
Lucas Duailibe 2466ce11a5 Force template literals to break after ` for sytled-components (#2926)
Force template literals to break after ` for styled-components
2017-10-02 17:55:42 +02:00
Lucas Azzola a6096ee799 Respect --stdin-filepath, regardless of config source (#2948)
* Respect --stdin-filepath, regardless of config source

Fixes #2946

* Remove obsolete snapshot
2017-10-01 15:55:35 +11:00
Ika 0d756080b5 fix: ignore and show warning for unknown option from config file (#2929) 2017-09-28 19:59:32 +02:00
Lucas Azzola 264ec70999 Don't use parens with optional chaining meber expressions (#2921) 2017-09-28 17:46:47 +10:00
Lucas Duailibe 038d02b3e2 Revert "Fix line break in test declarations with a single argument function declaration" (#2912)
This reverts commit 3703cb5b07.
2017-09-27 21:32:34 +02:00
Lucas Azzola 11a7b8d308 Fix printing of comments between decorators and method names (#2906) 2017-09-28 00:03:11 +10:00
Lucas Duailibe 3703cb5b07 Fix line break in test declarations with a single argument function declaration (#2877) 2017-09-26 19:24:25 +02:00
jackyho112 88049a3d6b Keep original empty lines in argument list (#2763)
* Account for empty lines in argument list in typical cases

* Fix build errors

* Fix one more build error

* Refactor

* Have better variable names for printing argument list

* Account for feedback on argument list empty lines

* Improve expanion argument logics

* Add a lot more tests

* Improve a test

* Make code cleaner

* Fix a lint error

* Refactor

* Add one last check

* Refactor
2017-09-26 17:47:56 +02:00
Lucas Azzola daef144102 Support fit(), xit(), it.only(), etc (#2900) 2017-09-26 23:12:38 +10:00
Stephen Scott e1c2085d2e Merge pull request #2888 from motiz88/fix-2593
Use semicolons in Flow interface-like bodies (#2593)
2017-09-25 22:31:24 -07:00
Simon Lydell c6bac7cfe6 Split Less and SCSS parsing into different parsers (#2844)
* Split Less and SCSS parsing into different parsers

Now, .less files are always parsed with postcss-less, and .scss files
areare always parsed with postcss-scss. This:

- Is less hacky.
- Is meant to avoid issues like #2829.
- Is probably more performant.

`parser: "postcss"` and `--parser postcss` continue to work like before:
First trying postcss-less, and if that fails, postcss-scss, unless a
regex says that we should try in the opposite order. The new values for
the parser option are "postcss-less" and "postcss-scss".

* Remove postcss from package.json since it is not used

* Rename parser-less to less and parser-scss to scss

* Deprecate parser:postcss in favor of parser:css

* Fix CSS tests
2017-09-26 07:08:11 +02:00
Ika 630ea58a50 refactor: use custom error (#2896) 2017-09-25 21:11:27 +02:00
Ika 4435ecbc7b fix(cli): validate options for every `config-precedence` (#2894)
* fix(cli): validate options for every `config-precedence`

* refactor: use camelcase

* refactor: reduce duplicate code

* refactor: rename function

* refactor: rename parameter
2017-09-25 21:04:25 +02:00
Ika d0a622ffa8 fix: do not print stack trace for invalid option (#2895)
* fix: do not print stack trace for invalid option

* refactor: use ConfigError
2017-09-25 20:42:56 +02:00
Moti Zilberman 5e146cdabe Use semicolons in Flow interface-like bodies (#2593)
Closes #2593.
2017-09-25 12:45:40 +01:00
Simon Lydell cd4d4e7273 Don't lowercase SCSS placeholder selectors (#2876)
Fixes #2872.
2017-09-21 20:23:22 +02:00
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
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
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
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
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
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
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 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
Simon Lydell 2b9e1f80c5 Refactor option category grouping 2017-09-13 18:21:04 +08:00
Simon Lydell c2847d90cd Make ESLint catch category typos 2017-09-13 18:21:04 +08:00
Simon Lydell f53eab9b8d Make cli-util.js a bit more readable 2017-09-13 18:21:04 +08:00
Simon Lydell e192279218 Remove the other .splice in cli-util.js 2017-09-13 18:21:04 +08:00
Simon Lydell 1c6a881ed9 Remove one .splice in cli-util.js 2017-09-13 18:21:04 +08:00
Simon Lydell 79eaa5a6e1 Remove reassignment in createUsage 2017-09-13 18:21:04 +08:00
Simon Lydell 72132b4e97 Remove trailing whitespace in cli-constant.js 2017-09-13 18:21:04 +08:00
Lucas Azzola 3f74c45b91 Support graphql(schema, `query`) (#2781) 2017-09-11 20:18:11 +02:00
Lucas Duailibe f51929e262 Lint fix 2017-09-10 15:00:52 -06:00
Lucas Duailibe 902f7f0339 Use same logic for binary chain 2017-09-10 15:00:52 -06:00