javascript-obfuscator / javascript-obfuscator/react-native-obfuscating-transformer

lots of TypeScript errors

未關閉
#69 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
TypeScript
星號
211
分支
102
PR 合併指標
30 天內沒有已合併 PR

描述

I'm experiencing many TypeScript errors (I cropped the cmd output).
As pointed out in https://github.com/microsoft/TypeScript/issues/40426 , you can not disable type checking on *.ts files from packages in node_modules, only on *.d.ts files.
Can the files be changed from *.ts files to *.d.ts files?

C:\project>yarn web
override webpack with config-overrides.js
(node:8468) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:8468) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
Starting the development server...
Failed to compile.

[eslint] Plugin "react" was conflicted between ".eslintrc.js » @react-native-community/eslint-config" and "BaseConfig » C:\project\node_modules\react-scripts\node_modules\eslint-config-react-app\base.js".
ERROR in [eslint] Plugin "react" was conflicted between ".eslintrc.js » @react-native-community/eslint-config" and "BaseConfig » C:\project\node_modules\react-scripts\node_modules\eslint-config-react-app\base.js".

webpack compiled with 1 error
ERROR in node_modules/javascript-obfuscator/src/analyzers/stack-trace-analyzer/callee-data-extractors/AbstractCalleeDataExtractor.ts:9:23
TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
     7 |
     8 | @injectable()
  >  9 | export abstract class AbstractCalleeDataExtractor implements ICalleeDataExtractor {
       |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    10 |     /**
    11 |      * @param {Node[]} blockScopeBody
    12 |      * @param {Node} callee

ERROR in node_modules/javascript-obfuscator/src/analyzers/stack-trace-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts:13:14
TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
    11 |
    12 | @injectable()
  > 13 | export class FunctionDeclarationCalleeDataExtractor extends AbstractCalleeDataExtractor {
       |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    14 |     /**
    15 |      * @param {NodeGuards[]} blockScopeBody
    16 |      * @param {Identifier} callee

ERROR in node_modules/javascript-obfuscator/src/analyzers/stack-trace-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts:49:67
TS18047: 'node.id' is possibly 'null'.
    47 |         estraverse.traverse(targetNode, {
    48 |             enter: (node: ESTree.Node): any => {
  > 49 |                 if (NodeGuards.isFunctionDeclarationNode(node) && node.id.name === name) {
       |                                                                   ^^^^^^^
    50 |                     calleeBlockStatement = node.body;
    51 |
    52 |                     return estraverse.VisitorOption.Break;

ERROR in node_modules/javascript-obfuscator/src/analyzers/stack-trace-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts:13:14
TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
    11 |
    12 | @injectable()
  > 13 | export class FunctionExpressionCalleeDataExtractor extends AbstractCalleeDataExtractor {
       |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    14 |     /**
    15 |      * @param {NodeGuards[]} blockScopeBody
    16 |      * @param {Identifier} callee

ERROR in node_modules/javascript-obfuscator/src/analyzers/stack-trace-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts:30:43
TS2339: Property 'body' does not exist on type 'never'.
  The intersection 'Identifier & FunctionExpression' was reduced to 'never' because property 'type' has conflicting types in some constituents.
    28 |
    29 |         if (NodeGuards.isFunctionExpressionNode(callee)) {
  > 30 |             calleeBlockStatement = callee.body;
       |                                           ^^^^
    31 |         }
    32 |
    33 |         if (!calleeBlockStatement) {

ERROR in node_modules/javascript-obfuscator/src/analyzers/stack-trace-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts:15:14
TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
    13 |
    14 | @injectable()
  > 15 | export class ObjectExpressionCalleeDataExtractor extends AbstractCalleeDataExtractor {
       |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    16 |     /**
    17 |      * @param {NodeGuards[]} blockScopeBody
    18 |      * @param {MemberExpression} callee
...

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

使用 yarn web 重現失敗,並將 ESLint 外掛程式衝突與 TypeScript 診斷分開處理。檢查回報的 node_modules/javascript-obfuscator/src/... 檔案以及 tsconfigjsconfig;編譯期間不再出現相依性錯誤即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
react-native, typescript
領域
build-system
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。