[
https://issues.apache.org/jira/browse/THRIFT-4551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18112896#comment-18112896
]
Sylwester Lachiewicz commented on THRIFT-4551:
----------------------------------------------
Current state of this ticket, checked against master today.
Prettier itself landed in 2018 and is wired in: it is a devDependency in
[package.json:59|https://github.com/apache/thrift/blob/master/package.json#L59],
{{npm run prettier}} is defined at
[package.json:76|https://github.com/apache/thrift/blob/master/package.json#L76],
and
[eslint.config.mjs|https://github.com/apache/thrift/blob/master/eslint.config.mjs]
loads {{eslint-plugin-prettier/recommended}}. What is still open is the
follow-up that reopened this ticket — reformatting the files that predate it.
[PR #1548|https://github.com/apache/thrift/pull/1548] tried that in 2018 and
was rejected because prettier's output conflicted with jshint. jshint is gone
now, so that blocker no longer exists.
{{prettier --check '**/*.{js,mjs,ts}'}} currently reports 25 files: 16 under
{{lib/js}}, 6 under {{lib/nodejs/lib/thrift}} and 3 under {{lib/nodets/test}}.
Adding Node.js - Library and TypeScript - Library to the components to match
that spread.
Suggested order for whoever picks this up, smallest risk first:
# {{lib/js}} and {{lib/nodets}} —
[eslint.config.mjs|https://github.com/apache/thrift/blob/master/eslint.config.mjs]
ignores {{lib/js/*}}, so reformatting there cannot collide with a lint rule.
# {{lib/nodejs/lib/thrift}} — covered by eslint, so run {{npm run prettier}}
and {{npm run lint-tests}} together.
# A CI check, so the tree does not drift again. Note that
[lib/nodejs/Makefile.am:37|https://github.com/apache/thrift/blob/master/lib/nodejs/Makefile.am#L37]
runs {{lint-tests}} only, so library sources are not linted today; that gap is
worth its own ticket rather than being folded in here.
> Add prettier for consistent JS code formatting
> ----------------------------------------------
>
> Key: THRIFT-4551
> URL: https://issues.apache.org/jira/browse/THRIFT-4551
> Project: Thrift
> Issue Type: Improvement
> Components: JavaScript - Library, Node.js - Library, TypeScript -
> Library
> Affects Versions: 0.11.0
> Reporter: Filip Spiridonov
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> [Prettier|https://prettier.io/] is awesome. See
> [why|https://prettier.io/docs/en/why-prettier.html] you should use it.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)