You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/03/16 18:01:27 UTC

[GitHub] [airflow] potiuk commented on a change in pull request #14836: Pre commit new UI

potiuk commented on a change in pull request #14836:
URL: https://github.com/apache/airflow/pull/14836#discussion_r595416991



##########
File path: .pre-commit-config.yaml
##########
@@ -563,6 +563,10 @@ repos:
         language_version: python3
         additional_dependencies: ['flynt']
         files: \.py$
+      - id: ui-lint-test
+        name: Lint and test React UI
+        language: system
+        entry: ./scripts/ci/pre_commit/pre_commit_ui_lint_test.sh

Review comment:
       I believe using system hook and script is not needed (but I am not sure if it works with yarn)
   
   pre-commit has a built-in `language: node` and it understand package.json. Not sure about yarn.lock though . But if we can make it works - it will even automatically rebuild the node environment for you and allow to run yarn commands. 
   
   You can some examples here: 
   
   https://github.com/Exocortex/pre-commit/blob/master/.pre-commit-hooks.yaml
   
   Also I think you should select the files that the lint should run on - .js files basically. Pre-commit has the nice feature that it only runs the checks on files that are changed in your commit but also splits the checks to N parallell checks - as many as many processors you have. So for sure you need "files:" field to tell pre-commit which files it should run on and your command (either script or yarn command) should take those files as parameters. 
   
   
   For example when you only change a.js, b.js, c.js but not d.js  and you have 2 CPUs precommit should run two commands in parallel:
   
   ```
   yarn lint a.js b.js
   yarn lint c.js
   ```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org