Commit Graph
2648 Commits
Author SHA1 Message Date
SUZUKI Sosuke 4169dbb871 Fix printing comment for the last operand of union types (#15409) 2023-09-16 21:52:02 +09:00
SUZUKI Sosuke c041f3fb4f Support embedded formatting in template literals annotated with as const (#15408) 2023-09-16 21:42:17 +09:00
George Zahariev 675490ae55 Support as and satisfies expressions for Flow (#15130) 2023-09-16 17:28:18 +09:00
Joseph Frazier 825dbe3daa cleanup EditorConfig handling: Remove unused parsing/ignoring of insert_final_newline to insertFinalNewline (#15398)
EditorConfig handling: Remove parsing/ignoring of `insert_final_newline` to `insertFinalNewline`

Now that https://github.com/prettier/prettier/pull/15394 has been
merged, this addresses https://github.com/prettier/prettier/issues/14514#issuecomment-1471056464
2023-09-14 12:45:11 -04:00
fisker Cheung 6c833b4445 Support URL as ignorePath in getFileInfo() (#15364) 2023-09-14 20:10:10 +08:00
Joseph Frazier ae6f9ac25b Move editorconfig-to-prettier package into repo (#15394)
I'd like to vendor/upstream this code because it's been the topic of a handful of issues in its repo over the years, including https://github.com/josephfrazier/editorconfig-to-prettier/issues/9, https://github.com/josephfrazier/editorconfig-to-prettier/issues/21, and most recently https://github.com/josephfrazier/editorconfig-to-prettier/issues/24, and I feel that having it in-repo would be more appropriate (not to mention [the issues in _this_ repo that pertain to editorconfig parsing](https://github.com/search?q=repo%3Aprettier%2Fprettier+editorconfig++&type=issues&state=open)). I've elaborated on my thoughts in https://github.com/josephfrazier/editorconfig-to-prettier/issues/24#issuecomment-1718405985, which I'll quote below:

> hey @Drakmyth, thanks for continuing this conversation! I appreciate all the links you've provided that indicate existing intention and implementations of parsing non-standard/custom properties. It seems like this question might not be as simple as I thought it was previously.
> 
> @fisker, thanks for chiming in as well!
> 
> As you (@fisker) mentioned in [#16 (comment)](https://github.com/josephfrazier/editorconfig-to-prettier/pull/16#issuecomment-1486130040), this package was originally intended for use by Prettier, and while there are some other dependents (according to [github](https://github.com/josephfrazier/editorconfig-to-prettier/network/dependents?dependent_type=PACKAGE) and [npm](https://www.npmjs.com/package/editorconfig-to-prettier?activeTab=dependents)), Prettier is still the vast majority of the usage this package sees.
> 
> Given that, I think it might make sense for this package's code/functionality to move into the Prettier repository, so that any issues relating to it can be discussed where it's used. Personally, I don't use `.editorconfig` with Prettier, so I don't feel especially well-positioned to make decisions on how things should work, especially when [the output of this package is subsequently modified by Prettier](https://github.com/prettier/prettier/blob/7c512651f8814924a042034ff821190c68ef409d/src/config/resolve-editorconfig.js#L13-L16) (I think you had also [mentioned](https://github.com/prettier/prettier/issues/14514#issuecomment-1471056464) this previously, @fisker), indicating that its behavior is already divergent from the intended use case.
> 
> What do y'all think of that proposal? If we have https://github.com/prettier/prettier/ vendor this repository's code, then I can archive this repo and direct people to discuss functionality in the Prettier issues.

This also implements @fisker's suggested change to ES module syntax from https://github.com/josephfrazier/editorconfig-to-prettier/pull/16/, as it's required for lint/test etc to pass.

Once this is merged, I'll likely archive the https://github.com/josephfrazier/editorconfig-to-prettier/ repo after adding a note directing any visitors here instead.

---

* Vendor editorconfig-to-prettier.js from https://github.com/josephfrazier/editorconfig-to-prettier/blob/8bb8226c40d7f2c8cf629301576850876c8617d4/index.js

* WIP Use `require` instead of `import`

* Revert "WIP Use `require` instead of `import`"

This reverts commit 4656b727960822b3d9d0659b68c99d8fa9a9ba58.

* Use `export` in editorconfig-to-prettier.js instead of `module.exports`, see https://github.com/josephfrazier/editorconfig-to-prettier/pull/16/

Copied from https://raw.githubusercontent.com/josephfrazier/editorconfig-to-prettier/e245d7051f3e2a1153b82362ed241f3f7482ab18/index.js

* `yarn fix`

* Add tests/unit/editorconfig-to-prettier.js from https://github.com/josephfrazier/editorconfig-to-prettier/pull/16/

Copied from https://raw.githubusercontent.com/josephfrazier/editorconfig-to-prettier/9effd580e7b6722007e1ace9913512e450cda46f/test.js

* tests/unit/editorconfig-to-prettier.js: Fix path to implementation

* WIP Naively convert assert.deepEqual to expect/toStrictEqual, see https://github.com/prettier/prettier/pull/15394#issuecomment-1718623556

* Wrap `test()` around `expect` calls

* XXX Force a middle test to fail to ensure the syntax works

* Revert "XXX Force a middle test to fail to ensure the syntax works"

This reverts commit 947eb34e1175944ebebf0a6271e13af99adcd663.

* `yarn fix`
2023-09-14 07:31:45 -04:00
fisker Cheung bf7d90ae84 Switch html-styles to html-ua-styles (#15334) 2023-09-14 09:45:15 +08:00
auvred 7c512651f8 Do not split call of scss function with leading dash (#15370)
* Do not split call of scss function with leading dash

* add changelog

* apply check only for scss parser

* Revert "apply check only for scss parser"

This reverts commit 378bf1ac11830ff22c922efbd10c322ed573a31e.

* add more test cases

* use test case from original issue
2023-09-13 21:46:22 +09:00
renovate[bot]andfisker Cheung 4eaf68cd6c chore(deps): update dependency @babel/parser to v7.22.16 (#15380)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2023-09-12 19:18:02 +08:00
fisker Cheung 98ae581402 Minor tweak to CLI (#15366) 2023-09-07 16:32:43 +08:00
fisker Cheung b9a3995e3a Refactor: Accept URL in isIgnored and inferParser (#15361) 2023-09-07 09:27:39 +08:00
fisker Cheung b2c33a4cec Accept URL in getFileInfo (#15360) 2023-09-06 15:49:22 +08:00
fisker Cheung 7e45a92707 Accept URL in resolveConfig (#15354) 2023-09-06 14:54:36 +08:00
fisker CheungandSUZUKI Sosuke 56752e00e5 Accept URL in resolveConfigFile (#15332)
Co-authored-by: SUZUKI Sosuke <aosukeke@gmail.com>
2023-09-04 19:59:42 +08:00
fisker Cheung 37139afeaa Meta tweak (#15331) 2023-09-04 19:54:16 +08:00
fisker Cheung 411ef345a2 Fix comment between parentheses and function body (#15326) 2023-09-02 09:18:15 +08:00
fisker Cheung 958b355ccb Fix comment around TSParameterProperty (#15324) 2023-09-02 09:16:36 +08:00
fisker Cheung 7c7ab7f7a2 Fix --stdin-file-path (#15328) 2023-09-02 09:15:48 +08:00
fisker Cheung 0d04d78367 Replace cosmiconfig with lilconfig (#15232) 2023-09-02 01:02:22 +08:00
Sosuke Suzuki 29f8861154 Bump Prettier dependency to 3.0.3 2023-08-29 21:31:25 +09:00
fisker Cheung a35008fb0a Support shared config that forbids require() (#15233) 2023-08-29 16:11:43 +08:00
SUZUKI Sosukeandfisker Cheung 1ce97d13a3 Support TypeScript 5.2 using / await using declaration (#15321)
* Update `@typescript-eslint` packages

* Install `typescript`

* Tweaks snapshot tests

* Tweaks error files

* Add tests for `using` with types

* Add changelog

* Update misc tests

* Update snapshots

* Revert misc tests and remove `typescript`

* Update changelog_unreleased/typescript/15321.md

Co-authored-by: fisker Cheung <lionkay@gmail.com>

* Fix file name typo

* Keep valid file

* Update tests

* Update changelog_unreleased/typescript/15321.md

Co-authored-by: fisker Cheung <lionkay@gmail.com>

* Remove non-existing filenames.

---------

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2023-08-29 15:51:50 +09:00
SUZUKI Sosuke 90fab608ae Do not print trailing commas in arrow function type parameter lists in ts code blocks (#15286)
* Remove trailing comma for `ts` code blocks

* Add changelog

* Support `typescript`

* Update link

* Update tests
2023-08-24 17:02:56 +09:00
fisker Cheung f75f717c4e Allow break require() argument (#15256) 2023-08-23 15:58:06 +09:00
fisker Cheung dc3ebe812f Add test to close #14635 (#15254) 2023-08-23 15:57:07 +09:00
Sosuke Suzuki 73668b5973 Bump Prettier dependency to 3.0.2 2023-08-16 00:46:46 +09:00
SUZUKI Sosuke 1b0c756bd6 Print declare and export keywords for nested namespace (#15249) 2023-08-15 22:38:07 +09:00
auvred 8a3e73c6c0 Do not add trailing comma for grouped scss comments (#15217)
* Do not add trailing comma for grouped scss comments

* add changelog
2023-08-11 18:44:05 +09:00
Seiya bf0b3040be Break after equal on assignment if rhs is await/yield expression (#15204)
* add as-is test

* break after equal on assignment if rhs is wait

Discussion: #15196

* rename test file

* add as-is test

* treat YieldExpression

* add tests

* add changelog

* fix a bug

* add test for delegated yield
2023-08-06 13:02:40 +09:00
fisker Cheung 29854ca8da Fix comments print in IfStatement (#15076) 2023-07-29 10:01:46 +08:00
fisker Cheung 12fd8891af Update typescript-eslint to v6 (#14429) 2023-07-22 02:35:30 +08:00
renovate[bot]andfisker e98083c84f chore(deps): update dependency vnopts to v2 (#15114)
* chore(deps): update dependency vnopts to v2

* Update

* Update snapshot

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2023-07-22 01:49:00 +09:00
auvred ceed405395 Add typing to support readonly array properties of AST Node (#15127)
* Add typing to support `readonly` array properties of AST Node

* add changelog

* fix changelog

* add test case
2023-07-22 01:43:26 +09:00
Pamela Lozano 5b38f6ec4f Add space before unary minus followed by a function call. (#15129) 2023-07-22 01:42:32 +09:00
auvred 7485c45bcc Add support for Vue "Generic Components" (#15066)
* add support for vue generic components

* add changelog and remove duplicated test case

* refactor

* rename file + simplify isVueScriptTag usage

* __isVueScriptGeneric -> __isEmbeddedTypescriptGenericParameters

* add link to blog post to changelog
2023-07-16 14:40:12 +09:00
auvred 8da37cce0b Add parenthesis around leading multiline comment in return statement (#15037) 2023-07-16 14:15:08 +09:00
YimingIsCOLD fa43afcc67 Fix parsing jsx style element with spread attribute (#15095) 2023-07-16 13:33:13 +09:00
renovate[bot]andfisker e15c64e712 chore(deps): update dependency linguist-languages to v7.26.1 (#15058)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2023-07-15 21:07:01 +08:00
fisker Cheung e2f4ce38f7 Improve cursor tracking (#14812) 2023-07-06 09:51:29 +08:00
Sosuke Suzuki fa48415617 Bump Prettier dependency to 3.0.0 2023-07-05 21:50:05 +09:00
renovate[bot]andfisker Cheung 1a0d9ed800 chore(deps): update dependency cosmiconfig to v8.2.0 (#14901)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2023-07-04 11:27:37 +08:00
renovate[bot]andfisker 25fa483e35 chore(deps): update dependency typescript to v5.1.5 (#14896)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2023-07-04 11:26:24 +08:00
renovate[bot]andfisker 61804e2516 chore(deps): update dependency espree to v9.6.0 (#15000)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2023-07-03 10:26:24 +08:00
Pieter VanderwerffandSUZUKI Sosuke ff7b025197 Support trailing comments in function parameters for all parameter node types (#14835)
* Support trailing comments in function parameters for all parameter node types

* Create 14835.md

---------

Co-authored-by: SUZUKI Sosuke <aosukeke@gmail.com>
2023-07-03 02:47:13 +09:00
Alex InkinandSosuke Suzuki fcb66949c9 Remove space after pipe name (#14961)
* Remove space after pipe name

* Add changelog

* Update changelog

* Update changelog

---------

Co-authored-by: Sosuke Suzuki <sosuke.suzuki@dr-ubie.com>
2023-07-03 02:28:17 +09:00
renovate[bot] bf581d35cf chore(deps): update dependency acorn to v8.9.0 (#14951)
Signed-off-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-18 10:43:10 +08:00
db1cdc007f test(vue): add tests for script lang (#14912)
Co-authored-by: fisker <lionkay@gmail.com>
Co-authored-by: SUZUKI Sosuke <aosukeke@gmail.com>
2023-06-13 23:02:21 +08:00
Sébastien Règne 54586e00b4 feat: Add name to errors (#14913)
* feat: Add name to errors.

* feat: Add name to errors.

* Add tests
2023-06-13 13:57:43 +09:00
SUZUKI SosukeandNicolò Ribaudo 7ad852636d Support Import Attributes (#14863)
* Print import attributes

* Update visitor keys for import attributes

* Update snapshots for visitor-keys

* Update `babel-plugins` tests

* Update import attributes tests

* Update misc tests

* Add changelog

* Enable `importAttributes` and `importAssertions`

* Print ImportAssertion syntax

* Add `babel-plugins` tests

* Add import assertions tests

* Add misc tests for import assertions

* Update changelog

* Fix words

* Use `deprecatedAssertSyntax`

* Update `@babel/parser`

* Use deprecatedAssertSyntax

* Remove needless tests

* Update `@babel/types`

* Update visitor-keys

* Run `yarn dedupe`

* Update src/language-js/print/module.js

Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>

* Address review

---------

Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
2023-05-31 00:47:12 +09:00
SUZUKI Sosuke 4d7afff735 Tests for await using syntax (#14862)
* Add tests for `await using`

* Add tests for `await using` from Babel

* Add changelog

* Fix changelog
2023-05-29 20:50:18 +09:00