Commit Graph
65 Commits
Author SHA1 Message Date
fisker Cheung 7c318cc677 Support .prettierrc.json5 config file (#8957) 2020-08-15 21:16:49 +08:00
fisker Cheung 5e71bb37bc Fix name field in tests_integration/**/package.json (#8958) 2020-08-11 19:18:35 +08:00
dependabot[bot]andfisker 07fbf265fa Build(deps): Bump cosmiconfig from 6.0.0 to 7.0.0 (#8890)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-08-10 21:59:41 +08:00
fisker Cheung 770ecfbabc Add test to confirm prettier . work with plugins (#8835) 2020-08-06 23:15:19 +08:00
fisker Cheung bf9974bc9c Add test to confirm a bug in third-party.js is fixed (#8837) 2020-08-02 07:05:26 +08:00
fisker Cheung b9ea67f32a Fix: resolving to incorrect config in getFileInfo() (#8585) 2020-06-19 22:28:27 +08:00
fisker Cheung fbf0beb716 Fix inferredParser when calling getFileInfo() with resolveConfig: true (#8551) 2020-06-17 18:47:56 +08:00
fisker Cheung e54d4fc01a Do not inferParser for ignored files (#8548) 2020-06-17 13:49:52 +08:00
fisker Cheung d2f51d7494 Fix ignore bug on windows (#8098)
* Fix file ignore bug on windows

* Use `ignore.ignores`

* Fix -stdin-filepath

* Add changelog
2020-04-21 14:33:20 +03:00
fisker CheungandGeorgii Dolzhykov f475a5bd43 Update spellcheck config and scripts (#8012)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-04-12 01:19:00 +08:00
fisker Cheung aeeb2ff7a8 Throw original error when loading external config (#7973) 2020-04-10 21:27:50 +08:00
dependabot-preview[bot]andGeorgii Dolzhykov 6257951386 Bump linguist-languages from 7.8.0 to 7.9.0 (#7809)
* Bump linguist-languages from 7.8.0 to 7.9.0

Bumps [linguist-languages](https://github.com/ikatyang/linguist-languages) from 7.8.0 to 7.9.0.
- [Release notes](https://github.com/ikatyang/linguist-languages/releases)
- [Commits](https://github.com/ikatyang/linguist-languages/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* ignore yarn.lock

* update snapshots

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-03-22 22:57:12 +02:00
Georgii Dolzhykov 3f1c46373a Expand directories in CLI (2020) (#7660) 2020-03-17 01:34:32 +02:00
Chris Blossom 1f30e18806 fix overrides pattern matching to include dot files (#5813) 2020-02-25 03:25:33 +02:00
fisker Cheung 647c041b57 Check pattern existence before glob (#7587) 2020-02-19 12:57:39 +02:00
Corinne Hoener 50e0ea91ee Respect prettierignore when executed in subdirectories (#7588)
* Respect prettierignore when executed in subdirectories

* Add ignore-in-subdirectories tests

* Add changelog entry
2020-02-18 00:40:26 +02:00
fisker Cheung 5cb59a07d1 Add tests for globby update (#7543) 2020-02-14 01:39:01 +02:00
Alexander Kachkaev 1b3a5d3572 Change endOfLine to lf by default for 2.0 (#7435)
* Towards changing default value for endOfLine

* Update tests and snapshots

* Add placeholder for changelog_unreleased

* Add CHANGELOG

* Undo adding snapshot tests for auto as it does not play well on Windows in CI

* Tweak changelog

* Update jest snapshot
2020-01-28 23:35:47 +02:00
fisker Cheung 0ffd9a774b Add .editorconfig (#7252) 2020-01-14 13:54:26 +03:00
fisker Cheung 159566798d Move multiple-patterns tests to patterns (#6777) 2019-11-01 18:02:34 +01:00
Kai Cataldo df45e12c5c API: add resolveConfig option to getFileInfo() (#6666)
* Add useConfig option to getFileInfo()

* useConfig -> resolveConfig
2019-10-23 13:56:59 +02:00
Evilebot Tnawi 6d4d6a7599 revert: --only-changed argument (#6594) 2019-10-03 11:21:05 -03:00
Gabriel Harel 6fae09b67e Add --only-changed flag to CLI (#5910) 2019-07-22 11:17:24 -03:00
James Reggio 353b2ca064 Config should not be evaluated for ignored files (#6233)
Prior to this change, the CLI would resolve the config for a file before
checking it against the ignored list. If the config was invalid, the CLI
would report a failure.

This change relocates the config-resolution phase until after the file
is confirmed to not be ignored.
2019-06-18 17:20:47 -03:00
Lucas Duailibe 448328270d Support overrides for dotfiles (#6194) 2019-06-07 09:45:56 -03:00
Lucas Azzola f32b289032 Support shared Prettier configuration (#5963)
* Support external configuration

* Document changes

* Update existing snapshots

* Update existing snapshots (2)

* Fix typo in docs

* Add example config repo
2019-03-13 09:34:51 +11:00
Ika 99a3efaa7a fix: update editorconfig-to-prettier (#5550) 2018-11-26 13:08:52 +08:00
Danny McCormick 18b03a31cc Fix tests for Windows and add Azure Pipelines for cross platform CI (#5410)
* Add azure pipelines

* Add gitattributes

* Updating tests to work on Windows or Unix

* Lint

* Cleaning up

* Fixing names

* Clean up naming

* try to consolidate images

* Clean up

* Add back txt to gitattributes
2018-11-14 07:55:50 -05:00
Alexander Kachkaev b87fe4cf22 Add option to enforce certain line endings (#5327) 2018-11-06 22:47:13 +08:00
Petter 1244729ad7 Infer via shebang (#5149)
If no file type can be inferred, this attempts to read the first line of a file and extract a shebang, which can be checked against a known list.
2018-10-05 08:47:23 +08:00
Ika 82a12a58a8 fix(config): better error message for unsupported extension (#4969) 2018-08-11 16:35:18 +08:00
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
Lucas Azzola a938076ae5 Ignore .git, .svn and .hg directories (#4906)
Fixes #4895
2018-07-30 00:08:51 +10:00
Ika 18aa527adc feat(api): support relative paths for plugin(SearchDir)s in config files (#4667)
* feat(api): support relative paths for plugin(SearchDir)s in config files

* fix: convince appveyor
2018-06-15 04:25:03 +08:00
Ika 75e86b9e6b fix(cli): no regression for --debug-check + --list-different (#4600) 2018-05-31 00:42:26 +08:00
Lucas Duailibe 5c6e0802af Don't default parser to babylon (#4528)
* Don't default parser to babylon

* Different default values according to version

* Fix error logging

* Add tests specifically for parser inference

* Add another test case

* Add API test
2018-05-23 16:55:06 -03:00
Ika 317f3a3c56 feat: split out JSON5 (#4367)
* feat: split out JSON5

* test: update snapshots

* test: update debug-check tests

* feat(playground): use JSON's code sample for JSON5

* fix: add missing trailing newline
2018-04-25 22:10:22 +08: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
Ika dc26445e51 refactor(options): use supportOptions to generate CLI options (#3622)
* refactor(cli-constant): use supportOptions

* refactor(options): use supportOptions

* refactor(cli-util): use supportOptions

* fix: do not infer parser in multiparser

* chore: remove unnecessary package

* chore: trigger another travis build

* test: add kebab-case test to ensure no regression

* test: update snapshots
2018-01-18 15:26:27 +08: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
Lucas Duailibe 639c523885 Skip folders in CLI pattern 2017-12-05 16:07:27 -02: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 https://github.com/josephfrazier/editorconfig-to-prettier/commit/c38b84c42a2e022067c104c494298a8c9533e7a7

* 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
Ika a1d878acc7 fix(cli): respect --ignore-path when using --stdin-filepath (#3309) 2017-11-23 21:54:04 +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 2ef879f20d feat(cli): add --loglevel option (#2992)
* feat(cli): add `--loglevel` option

* fix: handle error from invalid option

* fix: choice value and shouldLog logic

* test: fix test cases

* fix: change log style

* test: truncate snapshots

* test: reduce duplicate code

* test: use patterns instead of snapshots

* test: fix regex
2017-10-13 20:17:01 -05:00
Ika 6c8cde9672 fix(cli): do not early exit for --debug-check (#2987)
* test: add failing test

* fix(cli): do not early exit for `--debug-check`
2017-10-07 04:36:43 -05:00
Joern Bernhardt 3c00979530 Fix typo in test files (*formated -> *formatted) (#2982)
* Fix typo in test files

Signed-off-by: Joern Bernhardt <jb@campudus.com>

* Rename cursot-offset.js to cursor-offset.js

Signed-off-by: Joern Bernhardt <jb@campudus.com>
2017-10-06 20:01:21 +11:00