Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI ESLint #42184

Merged
merged 25 commits into from
Sep 16, 2024
Merged

UI ESLint #42184

merged 25 commits into from
Sep 16, 2024

Conversation

loucyx
Copy link
Contributor

@loucyx loucyx commented Sep 11, 2024

Using my open-source ESLint configuration as a base, and updating to adapt to the code in Airflow UI, I:

  • Added a rules directory in airflow/ui with .js files tackling different parts of the UI (Core rules, TypeScript rules, prettier rules and so on).
  • Updated the prettier configuration.
  • Added a .vscode settings file to organize imports and apply fixes in each explicit save.
  • Upgraded some dependencies and added a few more plugins.

Feel free to explore each file inside rules, each rule has some documentation on top explaining what it does, I curated each and every one of them manually.

The PR is separated in 2 commits, one only has the configuration changes mentioned above, the other is the changes that had to be made to make the linter happy.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
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 newsfragments.

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Sep 11, 2024
Copy link

boring-cyborg bot commented Sep 11, 2024

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@loucyx
Copy link
Contributor Author

loucyx commented Sep 13, 2024

@bbovenzi FYI: I renamed main.tsx back to be all lower case, because it isn't a component and all references to that file were still in lowercase.

@loucyx
Copy link
Contributor Author

loucyx commented Sep 13, 2024

@bbovenzi I also fixed the linting of dist, now it only lints what it has to lint 😄

Copy link
Contributor

@bbovenzi bbovenzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on. I hope this helps set a good foundation for our new UI.

@pierrejeambrun
Copy link
Member

Thanks a lot for addressing the comments, the PR is looking good. We have one gitignore left with the ‘.vscode’ removal.

I’ll be able to try this locally on Monday (I’m on my phone atm), just to confirm that the errors I had previously are gone :)

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Sep 16, 2024

On my end if I do:

rm -rf node_modules/
pnpm install
pnpm lint

Must be something on my local conf i guess.

Like it keeps trying to run on dist but it is excluded from the config 🤔. Is that something that you manage to reproduce ?
Screenshot 2024-09-16 at 11 41 22

pre-commit hook is also throwing that same error:
pre-commit run ts-compile-format-lint-ui --all-files

Weird even the CI command fails locally:

breeze static-checks --all-files --show-diff-on-failure --color always --initialize-environment

I'll clean containers rebuild images and try again.

@pierrejeambrun
Copy link
Member

Main was just fixed here, rebasing should solve the CI problem.

@loucyx
Copy link
Contributor Author

loucyx commented Sep 16, 2024

@pierrejeambrun just in case I pushed a commit making the dist ignoring global, should make it so it doesn't run in the dist directory at all ^_^

@pierrejeambrun
Copy link
Member

Looking good, working locally. We still have one .vscode in gitignore removed that shouldn't, I think we can merge once we revert that small diff :)

@loucyx
Copy link
Contributor Author

loucyx commented Sep 16, 2024

@pierrejeambrun there were 3 aperances of .vscode in .gitignore, the only one that remains removed is redundant:

.vscode/* # Everything in the `.vscode` folder (the folder will not be committed)
!.vscode/extensions.json # Exclude `extensions.json`
.vscode # Redundant ignore of `.vscode` folder

I just kept the last one removed, I can add it back, but the effect is the same afaik.

@pierrejeambrun
Copy link
Member

Oh yes indeed, thanks for removing that useless ignore.

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@bbovenzi bbovenzi merged commit 30925c7 into apache:main Sep 16, 2024
50 checks passed
Copy link

boring-cyborg bot commented Sep 16, 2024

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@loucyx loucyx deleted the ui-eslint branch September 16, 2024 17:03
gopidesupavan pushed a commit to gopidesupavan/airflow that referenced this pull request Sep 17, 2024
* 🚨 new ESLint rules and configuration.

* 🚨 fix all linting errors.

* 🚚 fix component casing.

* 🔧 add new import sorting for prettier.

* 🚨 apply new sorting of imports.

* 🔧 add missing `noUncheckedIndexedAccess` setting to avoid potential mistakes with index access.

* 📄 add license to `prettier.config.js`

* 🎨 format code examples to use spaces instead of tabs.

* 🎨 format openapi-gen files.

* 🔧 exclude `pnpm-lock.yaml` from adding a license.

* 🔧 add ignore of `pnpm-lock.yaml` in more places.
🌐 add statics word.

* 🔧 add `.vscode/settings.json`

* 🔧 add `*.tsbuildinfo` to `.gitignore`.
⬇️ downgrade typescript.

* 🔧 revert `.vscode` files ignore in gitignore.
🔥 remove `settings.json` for now.

* ⏪ revert formatting in .pre-commit-config.yaml

* 🚚 change casing of files to match main.

* 🔀 fix main merge issues -_-

* 🚚 fix incorrect main file casing change.

* 🔥 delete duplicated files that were moved in main.

* 🎨 add missing space in pre-commit-config

* ✏️ fix pnpm-lock.yaml

* 🔧 fix dist ignoring.

* 🤔 Lint and fox vite.config.ts.
joaopamaral pushed a commit to joaopamaral/airflow that referenced this pull request Oct 21, 2024
* 🚨 new ESLint rules and configuration.

* 🚨 fix all linting errors.

* 🚚 fix component casing.

* 🔧 add new import sorting for prettier.

* 🚨 apply new sorting of imports.

* 🔧 add missing `noUncheckedIndexedAccess` setting to avoid potential mistakes with index access.

* 📄 add license to `prettier.config.js`

* 🎨 format code examples to use spaces instead of tabs.

* 🎨 format openapi-gen files.

* 🔧 exclude `pnpm-lock.yaml` from adding a license.

* 🔧 add ignore of `pnpm-lock.yaml` in more places.
🌐 add statics word.

* 🔧 add `.vscode/settings.json`

* 🔧 add `*.tsbuildinfo` to `.gitignore`.
⬇️ downgrade typescript.

* 🔧 revert `.vscode` files ignore in gitignore.
🔥 remove `settings.json` for now.

* ⏪ revert formatting in .pre-commit-config.yaml

* 🚚 change casing of files to match main.

* 🔀 fix main merge issues -_-

* 🚚 fix incorrect main file casing change.

* 🔥 delete duplicated files that were moved in main.

* 🎨 add missing space in pre-commit-config

* ✏️ fix pnpm-lock.yaml

* 🔧 fix dist ignoring.

* 🤔 Lint and fox vite.config.ts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants