Jorge Gonzalez
7d78ce68ef
feat(config): support TOML configuration files ( #4877 )
...
* Add initial support for TOML in configuration files
* Missed brace
* Fix snapshots
* refactor: move loadToml to utils
* Use @iarna/toml
* Add tests for loadToml
* Fix test for CI
* Remove jest-extended
* Create snapshot for load-toml
* Add feat to docs
* lint docs
* Use @iarna/toml/parse-string
* Change path string
2018-08-03 06:27:19 -04:00
Joseph Frazier
5153b15245
Respect EditorConfig when `--config` is passed ( #3992 )
...
* Respect EditorConfig when `--config` is passed
* Clarify config-resolution test file
See https://github.com/prettier/prettier/pull/3255#issuecomment-348420546
* Update test snapshots
2018-02-24 19:11:23 +11:00
Joseph Frazier
7b211eab24
editorconfig: Only search for .editorconfig up to the VCS directory ( #3559 )
...
* editorconfig: Only search for .editorconfig up to $PWD
This addresses https://github.com/prettier/prettier/issues/3558
I'm not sure if this is the best way to find the "project root", but it
seems better than before.
* editorconfig: Search for `.editorconfig` up to the VCS directory
This uses [find-project-root] to find the nearest directory containing `.git` or `.hg`
See here for context: https://github.com/prettier/prettier/pull/3559#issuecomment-353756948
[find-project-root]: https://github.com/kirstein/find-project-root
* editorconfig: Add test for finding VCS directory
It's a little hacky in that the .hg file isn't really a Mercurial
repository, but it's enough to illustrate the intent. See here for
context: https://github.com/prettier/prettier/pull/3559#issuecomment-353857109
2017-12-26 18:16:09 +11:00
Joseph Frazier
cecf0657a5
Re-add EditorConfig support (undo #3213 ) ( #3255 )
...
* Revert "Revert "Respect EditorConfig settings" (#3213 )"
This reverts commit d2241fc0d5
.
* Comment out EditorConfig docs
See https://github.com/prettier/prettier/pull/3213#issuecomment-343009769
* editorconfig: Support `indent_size = 0`
See https://github.com/prettier/prettier/pull/2760#discussion_r137447715
and c38b84c42a
* Revert "Comment out EditorConfig docs"
This reverts commit ddfa529c55cac4853a1e76e00c8b5e3ef158c01f.
* Mark EditorConfig functionality as v1.9.0+
See https://github.com/prettier/prettier/pull/3255#discussion_r150432508
* editorconfig: Upgrade editorconfig-to-prettier to 0.0.4
* editorconfig: Only enable for CLI, by default
https://github.com/prettier/prettier/pull/3255#issuecomment-348420546
* editorconfig: Add tests confirming that editorconfig is ignored by default in the API
https://github.com/prettier/prettier/pull/3255#issuecomment-348420546
* editorconfig: Add/fix CLI option parsing
* editorconfig: Move docs from configuration.md to options.md
* editorconfig: Add `oppositeDescription` to show docs for `--no-editorconfig`
Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154542792
* editorconfig: Update test snapshots
* editorconfig: Remove unnecessary options parsing code
Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154544560
* editorconfig: Move docs from options.md to api.md and cli.md
Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154545979
* resolveConfig: return null if both .prettierrc and .editorconfig are missing
Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154574613
* Don't add now-failing tests
The way these tests work, both `tests_integration/cli/config/.prettierrc`
and `.prettierrc` apply to `tests_integration/cli/config/editorconfig/file.shouldnotexist`,
so the test wouldn't work even on master. Here's a way to confirm that:
```js
const path = require('path')
const assert = require('assert')
const prettier = require('./')
const file = './tests_integration/cli/config/editorconfig/file.shouldnotexist'
console.log(prettier.resolveConfig.sync(file))
assert(prettier.resolveConfig.sync(file) === null)
```
2017-12-05 09:28:27 +11:00
Lucas Azzola
d2241fc0d5
Revert "Respect EditorConfig settings" ( #3213 )
...
* Revert "Respect EditorConfig settings (#2760 )"
This reverts commit 8f58ca0f48
.
2017-11-09 11:38:58 +11:00
Joseph Frazier
8f58ca0f48
Respect EditorConfig settings ( #2760 )
...
This fixes https://github.com/prettier/prettier/issues/42 .
It adds support for .editorconfig's `indent_style`, `indent_size`, `tab_width`,
and `max_line_length` properties.
It doesn't support the `end_of_line` property as described in
https://github.com/prettier/prettier/issues/42#issuecomment-327073326 ,
but that could be added later. The same goes for `quote_type`
(https://github.com/prettier/prettier-atom/issues/293#issue-267288335 ).
* Make test .prettierrc not set config for all file extensions
This makes it easier to keep tests isolated.
2017-11-08 14:30:28 -05:00
Ika
7770356a51
test(integration): update title and catch all outputs ( #2951 )
2017-10-02 18:08:34 +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
ikatyang
ca7be87f9e
test: remove unnecessary `eslint-disable`
2017-09-03 22:06:55 +08:00
Lucas Azzola
1c806f81b2
Rename --resolve-config to --find-config-path ( #2453 )
2017-07-11 23:57:26 +10:00
Lucas Azzola
dcccfed366
Implement cosmiconfig for workspace configuration ( #2434 )
...
* Implement cosmiconfig
* Add resolveOptions API and extname support
* Add --resolve-config and --config, rename resolveOptions to resolveConfig
* Move color to top-level CLI options
* Fix unknown param warning
* Change from {} to null when no config is found
* Change override API to emulate eslint
* Add test for eslint-style overrides
* Delete overrides from resolveConfig
2017-07-10 22:26:36 +10:00