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
Lucas Azzola
d5de6ac84f
Delete $schema from resolved config
2017-10-18 23:54:55 +11:00
Lucas Azzola
21d7561ecd
Resolve file paths relative to config file ( #3037 )
...
* Add currently passing test case for #3005
* Fix test to fail without code change
2017-10-15 18:32:16 +11:00
Ika
0d756080b5
fix: ignore and show warning for unknown option from config file ( #2929 )
2017-09-28 19:59:32 +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
Mitermayer Reis
c59a82cbae
Add CLI option '--config-precedence' ( #2733 )
...
Add CLI option '--config-precedence'
2017-09-05 08:56:23 +10:00
ikatyang
ca7be87f9e
test: remove unnecessary `eslint-disable`
2017-09-03 22:06:55 +08:00
ikatyang
ac9fa43114
test(integration): add more tests
2017-09-03 21:31:33 +08: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