From cfa3399ad48d777ef7488a1f688b85ecd148389a Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Mon, 15 Mar 2021 20:55:32 -0400 Subject: [PATCH 1/6] add lint pre-commit --- .pre-commit-config.yaml | 17 +++ BREEZE.rst | 2 +- STATIC_CODE_CHECKS.rst | 2 + airflow/ui/package.json | 2 + airflow/ui/yarn.lock | 225 ++++++++++++++++++++++++++++++++++++++-- breeze-complete | 1 + 6 files changed, 242 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e586c8ce34edf..5a1c634c8c290 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -463,6 +463,23 @@ repos: require_serial: true files: provider.yaml$|scripts/ci/pre_commit/pre_commit_check_provider_yaml_files.py$|^docs/ additional_dependencies: ['PyYAML==5.3.1', 'jsonschema==3.2.0', 'tabulate==0.8.7'] + - id: eslint + name: ESLint + entry: "eslint" + args: + - --config + - airflow/ui/.eslintrc + - --resolve-plugins-relative-to + - airflow/ui/node_modules/ + language: node + files: ^airflow/ui/.*\.(ts|tsx)$ + # Keep dependency versions in sync w/ airflow/ui/package.json + additional_dependencies: + - eslint@7.0.0 + - eslint-config-airbnb-typescript@12.3.1 + - neutrino@9.5.0 + - neutrinojs-typescript@1.1.6 + - neutrinojs-typescript-eslint@1.3.1 - id: mermaid name: Generate mermaid images entry: ./scripts/ci/pre_commit/pre_commit_mermaid.sh diff --git a/BREEZE.rst b/BREEZE.rst index 36ccae6e6532d..77ff422c55fff 100644 --- a/BREEZE.rst +++ b/BREEZE.rst @@ -2311,7 +2311,7 @@ This is the current syntax for `./breeze <./breeze>`_: check-executables-have-shebangs check-hooks-apply check-integrations check-merge-conflict check-xml consistent-pylint daysago-import-check debug-statements detect-private-key doctoc dont-use-safe-filter end-of-file-fixer - fix-encoding-pragma flake8 flynt forbid-tabs helm-lint identity + eslint fix-encoding-pragma flake8 flynt forbid-tabs helm-lint identity incorrect-use-of-LoggingMixin insert-license isort json-schema language-matters lint-dockerfile lint-openapi markdownlint mermaid mixed-line-ending mypy mypy-helm no-providers-in-core-examples no-relative-imports pre-commit-descriptions diff --git a/STATIC_CODE_CHECKS.rst b/STATIC_CODE_CHECKS.rst index 69bc52a05e74c..7b90159bdfe04 100644 --- a/STATIC_CODE_CHECKS.rst +++ b/STATIC_CODE_CHECKS.rst @@ -96,6 +96,8 @@ require Breeze Docker images to be installed locally: ----------------------------------- ---------------------------------------------------------------- ------------ ``end-of-file-fixer`` Makes sure that there is an empty line at the end. ----------------------------------- ---------------------------------------------------------------- ------------ +``eslint`` Checks JS files with ESLint. +----------------------------------- ---------------------------------------------------------------- ------------ ``fix-encoding-pragma`` Removes encoding header from python files ----------------------------------- ---------------------------------------------------------------- ------------ ``pyupgrade`` Runs pyupgrade diff --git a/airflow/ui/package.json b/airflow/ui/package.json index 3d3a8a9581dc5..42741264c0075 100644 --- a/airflow/ui/package.json +++ b/airflow/ui/package.json @@ -29,6 +29,8 @@ "@types/react-dom": "^17.0.2", "eslint": "^7", "eslint-config-airbnb-typescript": "^12.3.1", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-jsx-a11y": "^6.4.1", "jest": "^26", "neutrino": "^9.5.0", "neutrinojs-typescript": "^1.1.6", diff --git a/airflow/ui/yarn.lock b/airflow/ui/yarn.lock index 3e5024e28ae4f..53ac04cecd3b4 100644 --- a/airflow/ui/yarn.lock +++ b/airflow/ui/yarn.lock @@ -896,7 +896,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.12.5", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.9.2": version "7.13.10" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.10.tgz#47d42a57b6095f4468da440388fdbad8bebf0d7d" integrity sha512-4QPkjJq6Ns3V/RgpEahRk+AGfL0eO6RHHtTWoNNr5mO49G6B5+X6d6THgWEAvTrznU5xYpbAlVKRYcsCgh/Akw== @@ -2074,6 +2074,11 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad" integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA== +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + "@types/lodash.mergewith@4.6.6": version "4.6.6" resolved "https://registry.yarnpkg.com/@types/lodash.mergewith/-/lodash.mergewith-4.6.6.tgz#c4698f5b214a433ff35cb2c75ee6ec7f99d79f10" @@ -2690,6 +2695,15 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= +array.prototype.flat@^1.2.3: + version "1.2.4" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz#6ef638b43312bd401b4c6199fdec7e2dc9e9a123" + integrity sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg== + dependencies: + call-bind "^1.0.0" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.1" + array.prototype.flatmap@^1.2.3: version "1.2.4" resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.2.4.tgz#94cfd47cc1556ec0747d97f7c7738c58122004c9" @@ -2735,6 +2749,11 @@ assign-symbols@^1.0.0: resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= +ast-types-flow@^0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" + integrity sha1-9wtzXGvKGlycItmCw+Oef+ujva0= + ast-types@0.9.6: version "0.9.6" resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.6.tgz#102c9e9e9005d3e7e3829bf0c4fa24ee862ee9b9" @@ -2782,6 +2801,16 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== +axe-core@^4.0.2: + version "4.1.3" + resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.1.3.tgz#64a4c85509e0991f5168340edc4bedd1ceea6966" + integrity sha512-vwPpH4Aj4122EW38mxO/fxhGKtwWTMLDIJfZ1He0Edbtjcfna/R3YB67yVhezUMzqc3Jr3+Ii50KRntlENL4xQ== + +axobject-query@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be" + integrity sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA== + babel-core@^7.0.0-bridge.0: version "7.0.0-bridge.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" @@ -3560,6 +3589,11 @@ constants-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= + content-disposition@0.5.3: version "0.5.3" resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" @@ -3815,6 +3849,11 @@ cyclist@^1.0.1: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= +damerau-levenshtein@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.6.tgz#143c1641cb3d85c60c32329e26899adea8701791" + integrity sha512-JVrozIeElnj3QzfUIt8tB8YMluBJom4Vw9qTPpjGYQ9fYlB3D/rb6OordUxf3xeFB35LKWs0xqcO5U6ySvBtug== + dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" @@ -3831,7 +3870,7 @@ data-urls@^2.0.0: whatwg-mimetype "^2.3.0" whatwg-url "^8.0.0" -debug@2.6.9, debug@^2.2.0, debug@^2.3.3: +debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== @@ -4045,6 +4084,14 @@ dns-txt@^2.0.2: dependencies: buffer-indexof "^1.0.0" +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" @@ -4185,6 +4232,11 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +emoji-regex@^9.0.0: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== + emojis-list@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78" @@ -4235,7 +4287,7 @@ errno@^0.1.3, errno@~0.1.7: dependencies: prr "~1.0.1" -error-ex@^1.3.1: +error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== @@ -4345,6 +4397,14 @@ eslint-config-airbnb@^18.2.0: object.assign "^4.1.2" object.entries "^1.1.2" +eslint-import-resolver-node@^0.3.4: + version "0.3.4" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz#85ffa81942c25012d8231096ddf679c03042c717" + integrity sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA== + dependencies: + debug "^2.6.9" + resolve "^1.13.1" + eslint-loader@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/eslint-loader/-/eslint-loader-4.0.2.tgz#386a1e21bcb613b3cf2d252a3b708023ccfb41ec" @@ -4356,6 +4416,14 @@ eslint-loader@^4.0.2: object-hash "^2.0.3" schema-utils "^2.6.5" +eslint-module-utils@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz#579ebd094f56af7797d19c9866c9c9486629bfa6" + integrity sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA== + dependencies: + debug "^2.6.9" + pkg-dir "^2.0.0" + eslint-plugin-babel@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-5.3.1.tgz#75a2413ffbf17e7be57458301c60291f2cfbf560" @@ -4363,6 +4431,25 @@ eslint-plugin-babel@^5.3.1: dependencies: eslint-rule-composer "^0.3.0" +eslint-plugin-import@^2.22.1: + version "2.22.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz#0896c7e6a0cf44109a2d97b95903c2bb689d7702" + integrity sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw== + dependencies: + array-includes "^3.1.1" + array.prototype.flat "^1.2.3" + contains-path "^0.1.0" + debug "^2.6.9" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.4" + eslint-module-utils "^2.6.0" + has "^1.0.3" + minimatch "^3.0.4" + object.values "^1.1.1" + read-pkg-up "^2.0.0" + resolve "^1.17.0" + tsconfig-paths "^3.9.0" + eslint-plugin-jest@^23.20.0: version "23.20.0" resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.20.0.tgz#e1d69c75f639e99d836642453c4e75ed22da4099" @@ -4370,6 +4457,23 @@ eslint-plugin-jest@^23.20.0: dependencies: "@typescript-eslint/experimental-utils" "^2.5.0" +eslint-plugin-jsx-a11y@^6.4.1: + version "6.4.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.4.1.tgz#a2d84caa49756942f42f1ffab9002436391718fd" + integrity sha512-0rGPJBbwHoGNPU73/QCLP/vveMlM1b1Z9PponxO87jfr6tuH5ligXbDT6nHSSzBC8ovX2Z+BQu7Bk5D/Xgq9zg== + dependencies: + "@babel/runtime" "^7.11.2" + aria-query "^4.2.2" + array-includes "^3.1.1" + ast-types-flow "^0.0.7" + axe-core "^4.0.2" + axobject-query "^2.2.0" + damerau-levenshtein "^1.0.6" + emoji-regex "^9.0.0" + has "^1.0.3" + jsx-ast-utils "^3.1.0" + language-tags "^1.0.5" + eslint-plugin-react-hooks@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.2.0.tgz#8c229c268d468956334c943bb45fc860280f5556" @@ -4832,6 +4936,13 @@ find-root@^1.1.0: resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" integrity sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng== +find-up@^2.0.0, find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= + dependencies: + locate-path "^2.0.0" + find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -6495,7 +6606,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -"jsx-ast-utils@^2.4.1 || ^3.0.0": +"jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.2.0.tgz#41108d2cec408c3453c1bbe8a4aae9e1e2bd8f82" integrity sha512-EIsmt3O3ljsU6sot/J4E1zDRxfBNrhjyf/OKjlydwgEimQuznlM4Wv7U+ueONJMyEn1WRE0K8dhi3dVAXYT24Q== @@ -6537,6 +6648,18 @@ kleur@^3.0.3: resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== +language-subtag-registry@~0.3.2: + version "0.3.21" + resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.21.tgz#04ac218bea46f04cb039084602c6da9e788dd45a" + integrity sha512-L0IqwlIXjilBVVYKFT37X9Ih11Um5NEl9cbJIuU/SwP/zEEAbBPOnEeeuxVMf45ydWQRDQN3Nqc96OgbH1K+Pg== + +language-tags@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/language-tags/-/language-tags-1.0.5.tgz#d321dbc4da30ba8bf3024e040fa5c14661f9193a" + integrity sha1-0yHbxNowuovzAk4ED6XBRmH5GTo= + dependencies: + language-subtag-registry "~0.3.2" + leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -6563,6 +6686,16 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + loader-runner@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" @@ -6586,6 +6719,14 @@ loader-utils@^2.0.0: emojis-list "^3.0.0" json5 "^2.1.2" +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -7094,7 +7235,7 @@ node-releases@^1.1.70: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.71.tgz#cb1334b179896b1c89ecfdd4b725fb7bbdfc7dbb" integrity sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg== -normalize-package-data@^2.5.0: +normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== @@ -7348,6 +7489,13 @@ p-finally@^1.0.0: resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= +p-limit@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== + dependencies: + p-try "^1.0.0" + p-limit@^2.0.0, p-limit@^2.2.0, p-limit@^2.2.1: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -7355,6 +7503,13 @@ p-limit@^2.0.0, p-limit@^2.2.0, p-limit@^2.2.1: dependencies: p-try "^2.0.0" +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= + dependencies: + p-limit "^1.1.0" + p-locate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" @@ -7381,6 +7536,11 @@ p-retry@^3.0.1: dependencies: retry "^0.12.0" +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= + p-try@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" @@ -7433,6 +7593,13 @@ parse-asn1@^5.0.0, parse-asn1@^5.1.5: pbkdf2 "^3.0.3" safe-buffer "^5.1.1" +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= + dependencies: + error-ex "^1.2.0" + parse-json@^5.0.0: version "5.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" @@ -7521,6 +7688,13 @@ path-to-regexp@0.1.7: resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= + dependencies: + pify "^2.0.0" + path-type@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" @@ -7588,6 +7762,13 @@ pirates@^4.0.1: dependencies: node-modules-regexp "^1.0.0" +pkg-dir@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" + integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s= + dependencies: + find-up "^2.1.0" + pkg-dir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" @@ -7996,6 +8177,14 @@ react@^16: object-assign "^4.1.1" prop-types "^15.6.2" +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + read-pkg-up@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" @@ -8005,6 +8194,15 @@ read-pkg-up@^7.0.1: read-pkg "^5.2.0" type-fest "^0.8.1" +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + read-pkg@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" @@ -8275,7 +8473,7 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.10.0, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.18.1: +resolve@^1.10.0, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.18.1: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== @@ -8956,6 +9154,11 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= + strip-bom@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" @@ -9220,6 +9423,16 @@ tr46@^2.0.2: dependencies: punycode "^2.1.1" +tsconfig-paths@^3.9.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" + integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.1" + minimist "^1.2.0" + strip-bom "^3.0.0" + tslib@^1.0.0, tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" diff --git a/breeze-complete b/breeze-complete index 445f3cb9c575f..8f4d9fab8e2fb 100644 --- a/breeze-complete +++ b/breeze-complete @@ -95,6 +95,7 @@ detect-private-key doctoc dont-use-safe-filter end-of-file-fixer +eslint fix-encoding-pragma flake8 flynt From abe717e34d8fc0a133befb0445d4818a6a40f8fb Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Tue, 16 Mar 2021 11:50:08 -0400 Subject: [PATCH 2/6] test with husky --- .husky/.gitignore | 1 + .husky/pre-commit | 4 ++++ .pre-commit-config.yaml | 2 +- BREEZE.rst | 2 +- STATIC_CODE_CHECKS.rst | 2 +- airflow/ui/package.json | 4 +++- airflow/ui/yarn.lock | 5 +++++ breeze-complete | 2 +- 8 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 .husky/.gitignore create mode 100755 .husky/pre-commit diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000000000..31354ec138999 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000000000..2211e5067a4f0 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +cd airflow/ui && yarn lint && yarn test diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a1c634c8c290..ebb0432ec4f1d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -463,7 +463,7 @@ repos: require_serial: true files: provider.yaml$|scripts/ci/pre_commit/pre_commit_check_provider_yaml_files.py$|^docs/ additional_dependencies: ['PyYAML==5.3.1', 'jsonschema==3.2.0', 'tabulate==0.8.7'] - - id: eslint + - id: eslint-ui name: ESLint entry: "eslint" args: diff --git a/BREEZE.rst b/BREEZE.rst index 77ff422c55fff..9aaaba0e3d8d4 100644 --- a/BREEZE.rst +++ b/BREEZE.rst @@ -2311,7 +2311,7 @@ This is the current syntax for `./breeze <./breeze>`_: check-executables-have-shebangs check-hooks-apply check-integrations check-merge-conflict check-xml consistent-pylint daysago-import-check debug-statements detect-private-key doctoc dont-use-safe-filter end-of-file-fixer - eslint fix-encoding-pragma flake8 flynt forbid-tabs helm-lint identity + eslint-ui fix-encoding-pragma flake8 flynt forbid-tabs helm-lint identity incorrect-use-of-LoggingMixin insert-license isort json-schema language-matters lint-dockerfile lint-openapi markdownlint mermaid mixed-line-ending mypy mypy-helm no-providers-in-core-examples no-relative-imports pre-commit-descriptions diff --git a/STATIC_CODE_CHECKS.rst b/STATIC_CODE_CHECKS.rst index 7b90159bdfe04..4aa0c1a7b1353 100644 --- a/STATIC_CODE_CHECKS.rst +++ b/STATIC_CODE_CHECKS.rst @@ -96,7 +96,7 @@ require Breeze Docker images to be installed locally: ----------------------------------- ---------------------------------------------------------------- ------------ ``end-of-file-fixer`` Makes sure that there is an empty line at the end. ----------------------------------- ---------------------------------------------------------------- ------------ -``eslint`` Checks JS files with ESLint. +``eslint-ui`` Checks TS in the new UI with ESLINT. ----------------------------------- ---------------------------------------------------------------- ------------ ``fix-encoding-pragma`` Removes encoding header from python files ----------------------------------- ---------------------------------------------------------------- ------------ diff --git a/airflow/ui/package.json b/airflow/ui/package.json index 42741264c0075..4c17fd4d83823 100644 --- a/airflow/ui/package.json +++ b/airflow/ui/package.json @@ -6,7 +6,8 @@ "start": "webpack-dev-server --mode development --open", "build": "webpack --mode production", "test": "jest", - "lint": "eslint --format codeframe --ext mjs,jsx,js,tsx,ts src test && tsc" + "lint": "eslint --format codeframe --ext mjs,jsx,js,tsx,ts src test && tsc", + "prepare": "cd ../.. && husky install" }, "dependencies": { "@chakra-ui/react": "^1.3.4", @@ -31,6 +32,7 @@ "eslint-config-airbnb-typescript": "^12.3.1", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jsx-a11y": "^6.4.1", + "husky": "^5.1.3", "jest": "^26", "neutrino": "^9.5.0", "neutrinojs-typescript": "^1.1.6", diff --git a/airflow/ui/yarn.lock b/airflow/ui/yarn.lock index 53ac04cecd3b4..4a1b029007810 100644 --- a/airflow/ui/yarn.lock +++ b/airflow/ui/yarn.lock @@ -5595,6 +5595,11 @@ human-signals@^1.1.1: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== +husky@^5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/husky/-/husky-5.1.3.tgz#1a0645a4fe3ffc006c4d0d8bd0bcb4c98787cc9d" + integrity sha512-fbNJ+Gz5wx2LIBtMweJNY1D7Uc8p1XERi5KNRMccwfQA+rXlxWNSdUxswo0gT8XqxywTIw7Ywm/F4v/O35RdMg== + iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" diff --git a/breeze-complete b/breeze-complete index 8f4d9fab8e2fb..b01186a5960ac 100644 --- a/breeze-complete +++ b/breeze-complete @@ -95,7 +95,7 @@ detect-private-key doctoc dont-use-safe-filter end-of-file-fixer -eslint +eslint-ui fix-encoding-pragma flake8 flynt From e22962da0831ff359e0a1bed1d1a3696983f7ed2 Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Tue, 16 Mar 2021 11:53:17 -0400 Subject: [PATCH 3/6] remove eslint pre commit hook --- .pre-commit-config.yaml | 17 ----------------- BREEZE.rst | 2 +- STATIC_CODE_CHECKS.rst | 2 -- breeze-complete | 1 - 4 files changed, 1 insertion(+), 21 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ebb0432ec4f1d..e586c8ce34edf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -463,23 +463,6 @@ repos: require_serial: true files: provider.yaml$|scripts/ci/pre_commit/pre_commit_check_provider_yaml_files.py$|^docs/ additional_dependencies: ['PyYAML==5.3.1', 'jsonschema==3.2.0', 'tabulate==0.8.7'] - - id: eslint-ui - name: ESLint - entry: "eslint" - args: - - --config - - airflow/ui/.eslintrc - - --resolve-plugins-relative-to - - airflow/ui/node_modules/ - language: node - files: ^airflow/ui/.*\.(ts|tsx)$ - # Keep dependency versions in sync w/ airflow/ui/package.json - additional_dependencies: - - eslint@7.0.0 - - eslint-config-airbnb-typescript@12.3.1 - - neutrino@9.5.0 - - neutrinojs-typescript@1.1.6 - - neutrinojs-typescript-eslint@1.3.1 - id: mermaid name: Generate mermaid images entry: ./scripts/ci/pre_commit/pre_commit_mermaid.sh diff --git a/BREEZE.rst b/BREEZE.rst index 9aaaba0e3d8d4..36ccae6e6532d 100644 --- a/BREEZE.rst +++ b/BREEZE.rst @@ -2311,7 +2311,7 @@ This is the current syntax for `./breeze <./breeze>`_: check-executables-have-shebangs check-hooks-apply check-integrations check-merge-conflict check-xml consistent-pylint daysago-import-check debug-statements detect-private-key doctoc dont-use-safe-filter end-of-file-fixer - eslint-ui fix-encoding-pragma flake8 flynt forbid-tabs helm-lint identity + fix-encoding-pragma flake8 flynt forbid-tabs helm-lint identity incorrect-use-of-LoggingMixin insert-license isort json-schema language-matters lint-dockerfile lint-openapi markdownlint mermaid mixed-line-ending mypy mypy-helm no-providers-in-core-examples no-relative-imports pre-commit-descriptions diff --git a/STATIC_CODE_CHECKS.rst b/STATIC_CODE_CHECKS.rst index 4aa0c1a7b1353..69bc52a05e74c 100644 --- a/STATIC_CODE_CHECKS.rst +++ b/STATIC_CODE_CHECKS.rst @@ -96,8 +96,6 @@ require Breeze Docker images to be installed locally: ----------------------------------- ---------------------------------------------------------------- ------------ ``end-of-file-fixer`` Makes sure that there is an empty line at the end. ----------------------------------- ---------------------------------------------------------------- ------------ -``eslint-ui`` Checks TS in the new UI with ESLINT. ------------------------------------ ---------------------------------------------------------------- ------------ ``fix-encoding-pragma`` Removes encoding header from python files ----------------------------------- ---------------------------------------------------------------- ------------ ``pyupgrade`` Runs pyupgrade diff --git a/breeze-complete b/breeze-complete index b01186a5960ac..445f3cb9c575f 100644 --- a/breeze-complete +++ b/breeze-complete @@ -95,7 +95,6 @@ detect-private-key doctoc dont-use-safe-filter end-of-file-fixer -eslint-ui fix-encoding-pragma flake8 flynt From e9f6cb49aa88a1f3541907d4cb3f6d2b99e0e35d Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Tue, 16 Mar 2021 12:47:00 -0400 Subject: [PATCH 4/6] move pre-commit back to main repo config --- .husky/.gitignore | 1 - .husky/pre-commit | 4 ---- .pre-commit-config.yaml | 4 ++++ BREEZE.rst | 2 +- STATIC_CODE_CHECKS.rst | 2 ++ airflow/ui/package.json | 4 +--- airflow/ui/yarn.lock | 5 ----- breeze-complete | 1 + .../ci/pre_commit/pre_commit_ui_lint_test.sh | 22 +++++++++++++++++++ 9 files changed, 31 insertions(+), 14 deletions(-) delete mode 100644 .husky/.gitignore delete mode 100755 .husky/pre-commit create mode 100755 scripts/ci/pre_commit/pre_commit_ui_lint_test.sh diff --git a/.husky/.gitignore b/.husky/.gitignore deleted file mode 100644 index 31354ec138999..0000000000000 --- a/.husky/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_ diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 2211e5067a4f0..0000000000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -cd airflow/ui && yarn lint && yarn test diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e586c8ce34edf..ce3407e004d9a 100644 --- a/.pre-commit-config.yaml +++ b/.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 ## ADD MOST PRE-COMMITS ABOVE THAT LINE # The below pre-commits are those requiring CI image to be built - id: build diff --git a/BREEZE.rst b/BREEZE.rst index 36ccae6e6532d..34d7f1c76e88b 100644 --- a/BREEZE.rst +++ b/BREEZE.rst @@ -2318,7 +2318,7 @@ This is the current syntax for `./breeze <./breeze>`_: pre-commit-hook-names provide-create-sessions providers-init-file provider-yamls pydevd pydocstyle pylint pylint-tests python-no-log-warn pyupgrade restrict-start_date rst-backticks setup-order setup-extra-packages shellcheck - sort-in-the-wild sort-spelling-wordlist stylelint trailing-whitespace + sort-in-the-wild sort-spelling-wordlist stylelint trailing-whitespace ui-lint-test update-breeze-file update-extras update-local-yml-file update-setup-cfg-file version-sync yamllint diff --git a/STATIC_CODE_CHECKS.rst b/STATIC_CODE_CHECKS.rst index 69bc52a05e74c..49505a7e2582e 100644 --- a/STATIC_CODE_CHECKS.rst +++ b/STATIC_CODE_CHECKS.rst @@ -170,6 +170,8 @@ require Breeze Docker images to be installed locally: ----------------------------------- ---------------------------------------------------------------- ------------ ``trailing-whitespace`` Removes trailing whitespace at end of line ----------------------------------- ---------------------------------------------------------------- ------------ +``ui-lint-test`` Lint and test the React UI +----------------------------------- ---------------------------------------------------------------- ------------ ``update-breeze-file`` Update output of breeze command in BREEZE.rst ----------------------------------- ---------------------------------------------------------------- ------------ ``update-extras`` Updates extras in the documentation diff --git a/airflow/ui/package.json b/airflow/ui/package.json index 4c17fd4d83823..42741264c0075 100644 --- a/airflow/ui/package.json +++ b/airflow/ui/package.json @@ -6,8 +6,7 @@ "start": "webpack-dev-server --mode development --open", "build": "webpack --mode production", "test": "jest", - "lint": "eslint --format codeframe --ext mjs,jsx,js,tsx,ts src test && tsc", - "prepare": "cd ../.. && husky install" + "lint": "eslint --format codeframe --ext mjs,jsx,js,tsx,ts src test && tsc" }, "dependencies": { "@chakra-ui/react": "^1.3.4", @@ -32,7 +31,6 @@ "eslint-config-airbnb-typescript": "^12.3.1", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jsx-a11y": "^6.4.1", - "husky": "^5.1.3", "jest": "^26", "neutrino": "^9.5.0", "neutrinojs-typescript": "^1.1.6", diff --git a/airflow/ui/yarn.lock b/airflow/ui/yarn.lock index 4a1b029007810..53ac04cecd3b4 100644 --- a/airflow/ui/yarn.lock +++ b/airflow/ui/yarn.lock @@ -5595,11 +5595,6 @@ human-signals@^1.1.1: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== -husky@^5.1.3: - version "5.1.3" - resolved "https://registry.yarnpkg.com/husky/-/husky-5.1.3.tgz#1a0645a4fe3ffc006c4d0d8bd0bcb4c98787cc9d" - integrity sha512-fbNJ+Gz5wx2LIBtMweJNY1D7Uc8p1XERi5KNRMccwfQA+rXlxWNSdUxswo0gT8XqxywTIw7Ywm/F4v/O35RdMg== - iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" diff --git a/breeze-complete b/breeze-complete index 445f3cb9c575f..1a58368fb6a11 100644 --- a/breeze-complete +++ b/breeze-complete @@ -135,6 +135,7 @@ sort-in-the-wild sort-spelling-wordlist stylelint trailing-whitespace +ui-lint-test update-breeze-file update-extras update-local-yml-file diff --git a/scripts/ci/pre_commit/pre_commit_ui_lint_test.sh b/scripts/ci/pre_commit/pre_commit_ui_lint_test.sh new file mode 100755 index 0000000000000..769570439f77c --- /dev/null +++ b/scripts/ci/pre_commit/pre_commit_ui_lint_test.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# 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. + +# shellcheck source=scripts/ci/libraries/_script_init.sh +. "$( dirname "${BASH_SOURCE[0]}" )/../libraries/_script_init.sh" + +cd airflow/ui && yarn && yarn lint && yarn test From f0f50c964e151d03f58074d18e1219d15aedab22 Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Tue, 16 Mar 2021 14:16:40 -0400 Subject: [PATCH 5/6] use node language and split hooks --- .pre-commit-config.yaml | 16 ++++++++++---- BREEZE.rst | 4 ++-- STATIC_CODE_CHECKS.rst | 4 +++- breeze-complete | 3 ++- .../ci/pre_commit/pre_commit_ui_lint_test.sh | 22 ------------------- 5 files changed, 19 insertions(+), 30 deletions(-) delete mode 100755 scripts/ci/pre_commit/pre_commit_ui_lint_test.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ce3407e004d9a..f0ade6dedf452 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -563,10 +563,18 @@ 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 + - id: ui-lint + name: Lint React UI + language: node + entry: bash + args: ["-c", "cd airflow/ui && yarn lint"] + files: ^airflow/ui/.*\.(ts|tsx)$ + - id: ui-test + name: Test React UI + language: node + entry: bash + args: ["-c", "cd airflow/ui && yarn test"] + files: ^airflow/ui/.*\.(ts|tsx)$ ## ADD MOST PRE-COMMITS ABOVE THAT LINE # The below pre-commits are those requiring CI image to be built - id: build diff --git a/BREEZE.rst b/BREEZE.rst index 34d7f1c76e88b..8323b0f9b4327 100644 --- a/BREEZE.rst +++ b/BREEZE.rst @@ -2318,8 +2318,8 @@ This is the current syntax for `./breeze <./breeze>`_: pre-commit-hook-names provide-create-sessions providers-init-file provider-yamls pydevd pydocstyle pylint pylint-tests python-no-log-warn pyupgrade restrict-start_date rst-backticks setup-order setup-extra-packages shellcheck - sort-in-the-wild sort-spelling-wordlist stylelint trailing-whitespace ui-lint-test - update-breeze-file update-extras update-local-yml-file update-setup-cfg-file + sort-in-the-wild sort-spelling-wordlist stylelint trailing-whitespace ui-lint + ui-test update-breeze-file update-extras update-local-yml-file update-setup-cfg-file version-sync yamllint You can pass extra arguments including options to the pre-commit framework as diff --git a/STATIC_CODE_CHECKS.rst b/STATIC_CODE_CHECKS.rst index 49505a7e2582e..5b14a8597a40d 100644 --- a/STATIC_CODE_CHECKS.rst +++ b/STATIC_CODE_CHECKS.rst @@ -170,7 +170,9 @@ require Breeze Docker images to be installed locally: ----------------------------------- ---------------------------------------------------------------- ------------ ``trailing-whitespace`` Removes trailing whitespace at end of line ----------------------------------- ---------------------------------------------------------------- ------------ -``ui-lint-test`` Lint and test the React UI +``ui-lint`` Lint the React UI +----------------------------------- ---------------------------------------------------------------- ------------ +``ui-test`` Test the React UI ----------------------------------- ---------------------------------------------------------------- ------------ ``update-breeze-file`` Update output of breeze command in BREEZE.rst ----------------------------------- ---------------------------------------------------------------- ------------ diff --git a/breeze-complete b/breeze-complete index 1a58368fb6a11..cb6bb3a38860d 100644 --- a/breeze-complete +++ b/breeze-complete @@ -135,7 +135,8 @@ sort-in-the-wild sort-spelling-wordlist stylelint trailing-whitespace -ui-lint-test +ui-lint +ui-test update-breeze-file update-extras update-local-yml-file diff --git a/scripts/ci/pre_commit/pre_commit_ui_lint_test.sh b/scripts/ci/pre_commit/pre_commit_ui_lint_test.sh deleted file mode 100755 index 769570439f77c..0000000000000 --- a/scripts/ci/pre_commit/pre_commit_ui_lint_test.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -# 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. - -# shellcheck source=scripts/ci/libraries/_script_init.sh -. "$( dirname "${BASH_SOURCE[0]}" )/../libraries/_script_init.sh" - -cd airflow/ui && yarn && yarn lint && yarn test From 32360c6fe32f4905f88b3b2495f01db3631b97a3 Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Tue, 16 Mar 2021 17:24:14 -0400 Subject: [PATCH 6/6] add yarn install --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f0ade6dedf452..176d466696eee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -567,13 +567,13 @@ repos: name: Lint React UI language: node entry: bash - args: ["-c", "cd airflow/ui && yarn lint"] + args: ["-c", "cd airflow/ui && yarn install && yarn lint"] files: ^airflow/ui/.*\.(ts|tsx)$ - id: ui-test name: Test React UI language: node entry: bash - args: ["-c", "cd airflow/ui && yarn test"] + args: ["-c", "cd airflow/ui && yarn install && yarn test"] files: ^airflow/ui/.*\.(ts|tsx)$ ## ADD MOST PRE-COMMITS ABOVE THAT LINE # The below pre-commits are those requiring CI image to be built