You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "guan404ming (via GitHub)" <gi...@apache.org> on 2025/06/20 15:05:15 UTC
[PR] i18n: add jsoncRules to handle translation key sort [airflow]
guan404ming opened a new pull request, #51968:
URL: https://github.com/apache/airflow/pull/51968
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
## Related Issue
#51735
## Why
The original perfectionist can't handle json files properly in public folder.
## How
- add [eslint-plugin-jsonc](https://www.npmjs.com/package/eslint-plugin-jsonc) to handle translation related json files lint
- remove unused rules in i18n
<img width="1043" alt="image" src="https://github.com/user-attachments/assets/021f7940-8c9e-4a06-81ee-042163028167" />
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] i18n: add jsoncRules to handle translation key sort [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on PR #51968:
URL: https://github.com/apache/airflow/pull/51968#issuecomment-2996448756
> I've decided to keep both since:
jsonc-eslint-parser is used by our custom plugin to check translation completeness via ESLint.
eslint-plugin-jsonc helps enforce translation key sorting and has auto-fix function built in.
Both are dev dependencies, so it's not a big deal, if it's easier to have both of them because it's more flexible for us, I think it's not a big deal.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] i18n: add jsoncRules to handle translation key sort [airflow]
Posted by "guan404ming (via GitHub)" <gi...@apache.org>.
guan404ming commented on PR #51968:
URL: https://github.com/apache/airflow/pull/51968#issuecomment-2992129770
It looks like:
- [jsonc-eslint-parser](https://www.npmjs.com/package/jsonc-eslint-parser) is a parser for JSON, JSONC, and JSON5, meant to be used with ESLint plugins.
- [eslint-plugin-jsonc](https://www.npmjs.com/package/eslint-plugin-jsonc) is an ESLint plugin specifically for handling JSON, JSONC, and JSON5 files.
So, if an ESLint plugin needs to parse our JSON files, we should be using a JSON parser like jsonc-eslint-parser. Let me know if I'm mistaken, thanks!
> Also I'm surprised, it means that all our translation files are properly sorted by key, what's enforcing that ? (prettier maybe ?)
It’s ESLint. We used the perfectionist plugin at that time but it doesn't work when files are in public folder
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] i18n: add jsoncRules to handle translation key sort [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #51968:
URL: https://github.com/apache/airflow/pull/51968#issuecomment-2993729045
> yes I think we should use `jsonc-eslint-parser` everywhere if possible. If not then `eslint-plugin-jsonc`.
agree
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] i18n: add jsoncRules to handle translation key sort [airflow]
Posted by "guan404ming (via GitHub)" <gi...@apache.org>.
guan404ming commented on PR #51968:
URL: https://github.com/apache/airflow/pull/51968#issuecomment-2994025189
I've decided to keep both since:
- `jsonc-eslint-parser` is used by our custom plugin to check translation completeness via ESLint.
- `eslint-plugin-jsonc` helps enforce translation key sorting and has auto-fix function built in.
We could consider implementing custom logic for sorting keys ourselves, which would allow us to rely solely on the parser. However, that would likely introduce additional complexity to the workflow. Let me know if you think it's worth consolidating, but for now I feel keeping both is the more practical choice.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] i18n: add jsoncRules to handle translation key sort [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun merged PR #51968:
URL: https://github.com/apache/airflow/pull/51968
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] i18n: add jsoncRules to handle translation key sort [airflow]
Posted by "guan404ming (via GitHub)" <gi...@apache.org>.
guan404ming commented on PR #51968:
URL: https://github.com/apache/airflow/pull/51968#issuecomment-2997040275
> Also after some more research it appears we need both. Thanks
Thanks for the review and research.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org