Просмотр исходного кода

dev: Add pyright as a pre-commit hook (#29280)

Adds Pyright as a pre-commit hook check for
potential unbound variables
Ahmed Etefy 3 лет назад
Родитель
Сommit
90924346cd
4 измененных файлов с 27 добавлено и 0 удалено
  1. 7 0
      .pre-commit-config.yaml
  2. 1 0
      package.json
  3. 14 0
      pyrightconfig.json
  4. 5 0
      yarn.lock

+ 7 - 0
.pre-commit-config.yaml

@@ -57,6 +57,13 @@ repos:
       language: system
       files: requirements-base.txt
       pass_filenames: false
+    - id: pyright
+      name: pyright
+      entry: pyright
+      language: node
+      types: [ python ]
+      pass_filenames: true
+      additional_dependencies: [ "pyright@1.1.178" ]
 
 -   repo: https://github.com/sirosen/check-jsonschema
     rev: 0.3.0

+ 1 - 0
package.json

@@ -103,6 +103,7 @@
     "prism-sentry": "^1.0.2",
     "process": "^0.11.10",
     "prop-types": "^15.6.0",
+    "pyright": "^1.1.178",
     "qrcode.react": "^1.0.1",
     "query-string": "7.0.1",
     "react": "17.0.2",

+ 14 - 0
pyrightconfig.json

@@ -0,0 +1,14 @@
+{
+  "include": [
+    "src"
+  ],
+
+  "exclude": [
+    ".volta/**"
+  ],
+
+  "typeCheckingMode": "off",
+  "reportMissingImports": "none",
+  "reportUndefinedVariable": "none",
+  "reportUnboundVariable": "error"
+}

+ 5 - 0
yarn.lock

@@ -12117,6 +12117,11 @@ puppeteer@^10.1.0:
     unbzip2-stream "1.3.3"
     ws "7.4.6"
 
+pyright@^1.1.178:
+  version "1.1.178"
+  resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.178.tgz#0c3db46989ae59c01643f5b9778c6b43a56696c7"
+  integrity sha512-OhEoC5HfKZqvY5GVCsHeroYDx85xp4CZwevhNsePxNzZyW+W491K4bfLTvuOBnvcnMWip+aMQ7zzFDkw74Gtkg==
+
 qr.js@0.0.0:
   version "0.0.0"
   resolved "https://registry.yarnpkg.com/qr.js/-/qr.js-0.0.0.tgz#cace86386f59a0db8050fa90d9b6b0e88a1e364f"