Sfoglia il codice sorgente

Dependencies and tslint rules update

sanex3339 7 anni fa
parent
commit
7ced85e9b8

+ 3 - 3
package.json

@@ -20,7 +20,7 @@
   },
   "dependencies": {
     "chalk": "2.1.0",
-    "chance": "1.0.10",
+    "chance": "1.0.11",
     "class-validator": "0.7.2",
     "commander": "2.11.0",
     "escodegen-wallaby": "1.6.12",
@@ -48,7 +48,7 @@
     "@types/md5": "2.1.32",
     "@types/mkdirp": "0.5.1",
     "@types/mocha": "2.2.42",
-    "@types/node": "8.0.24",
+    "@types/node": "8.0.25",
     "@types/sinon": "2.3.3",
     "@types/string-template": "1.0.2",
     "@types/webpack-env": "1.13.0",
@@ -64,7 +64,7 @@
     "pre-commit": "1.2.2",
     "sinon": "3.2.1",
     "ts-node": "3.3.0",
-    "tslint": "5.6.0",
+    "tslint": "5.7.0",
     "tslint-eslint-rules": "4.1.1",
     "tslint-webpack-plugin": "1.0.0",
     "typescript": "2.5.0",

+ 1 - 1
src/analyzers/stack-trace-analyzer/callee-data-extractors/AbstractCalleeDataExtractor.ts

@@ -12,5 +12,5 @@ export abstract class AbstractCalleeDataExtractor implements ICalleeDataExtracto
      * @param {Node} callee
      * @returns {ICalleeData}
      */
-    public abstract extract (blockScopeBody: ESTree.Node[], callee: ESTree.Node): ICalleeData|null;
+    public abstract extract (blockScopeBody: ESTree.Node[], callee: ESTree.Node): ICalleeData | null;
 }

+ 4 - 4
src/analyzers/stack-trace-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts

@@ -16,12 +16,12 @@ export class FunctionDeclarationCalleeDataExtractor extends AbstractCalleeDataEx
      * @param {Identifier} callee
      * @returns {ICalleeData}
      */
-    public extract (blockScopeBody: ESTree.Node[], callee: ESTree.Identifier): ICalleeData|null {
+    public extract (blockScopeBody: ESTree.Node[], callee: ESTree.Identifier): ICalleeData | null {
         if (!Node.isIdentifierNode(callee)) {
             return null;
         }
 
-        const calleeBlockStatement: ESTree.BlockStatement|null = this.getCalleeBlockStatement(
+        const calleeBlockStatement: ESTree.BlockStatement | null = this.getCalleeBlockStatement(
             NodeUtils.getBlockScopesOfNode(blockScopeBody[0])[0],
             callee.name
         );
@@ -41,8 +41,8 @@ export class FunctionDeclarationCalleeDataExtractor extends AbstractCalleeDataEx
      * @param {string} name
      * @returns {BlockStatement}
      */
-    private getCalleeBlockStatement (targetNode: ESTree.Node, name: string): ESTree.BlockStatement|null {
-        let calleeBlockStatement: ESTree.BlockStatement|null = null;
+    private getCalleeBlockStatement (targetNode: ESTree.Node, name: string): ESTree.BlockStatement | null {
+        let calleeBlockStatement: ESTree.BlockStatement | null = null;
 
         estraverse.traverse(targetNode, {
             enter: (node: ESTree.Node): any => {

+ 4 - 4
src/analyzers/stack-trace-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts

@@ -16,8 +16,8 @@ export class FunctionExpressionCalleeDataExtractor extends AbstractCalleeDataExt
      * @param {Identifier} callee
      * @returns {ICalleeData}
      */
-    public extract (blockScopeBody: ESTree.Node[], callee: ESTree.Identifier): ICalleeData|null {
-        let calleeBlockStatement: ESTree.BlockStatement|null = null;
+    public extract (blockScopeBody: ESTree.Node[], callee: ESTree.Identifier): ICalleeData | null {
+        let calleeBlockStatement: ESTree.BlockStatement | null = null;
 
         if (Node.isIdentifierNode(callee)) {
             calleeBlockStatement = this.getCalleeBlockStatement(
@@ -45,8 +45,8 @@ export class FunctionExpressionCalleeDataExtractor extends AbstractCalleeDataExt
      * @param {string} name
      * @returns {BlockStatement}
      */
-    private getCalleeBlockStatement (targetNode: ESTree.Node, name: string): ESTree.BlockStatement|null {
-        let calleeBlockStatement: ESTree.BlockStatement|null = null;
+    private getCalleeBlockStatement (targetNode: ESTree.Node, name: string): ESTree.BlockStatement | null {
+        let calleeBlockStatement: ESTree.BlockStatement | null = null;
 
         estraverse.traverse(targetNode, {
             enter: (node: ESTree.Node, parentNode: ESTree.Node): any => {

+ 8 - 8
src/analyzers/stack-trace-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts

@@ -18,7 +18,7 @@ export class ObjectExpressionCalleeDataExtractor extends AbstractCalleeDataExtra
      * @param {MemberExpression} callee
      * @returns {ICalleeData}
      */
-    public extract (blockScopeBody: ESTree.Node[], callee: ESTree.MemberExpression): ICalleeData|null {
+    public extract (blockScopeBody: ESTree.Node[], callee: ESTree.MemberExpression): ICalleeData | null {
         if (!Node.isMemberExpressionNode(callee)) {
             return null;
         }
@@ -29,8 +29,8 @@ export class ObjectExpressionCalleeDataExtractor extends AbstractCalleeDataExtra
             return null;
         }
 
-        const functionExpressionName: string|number|null = objectMembersCallsChain[objectMembersCallsChain.length - 1];
-        const calleeBlockStatement: ESTree.BlockStatement|null = this.getCalleeBlockStatement(
+        const functionExpressionName: string | number | null = objectMembersCallsChain[objectMembersCallsChain.length - 1];
+        const calleeBlockStatement: ESTree.BlockStatement | null = this.getCalleeBlockStatement(
             NodeUtils.getBlockScopesOfNode(blockScopeBody[0])[0],
             objectMembersCallsChain
         );
@@ -91,14 +91,14 @@ export class ObjectExpressionCalleeDataExtractor extends AbstractCalleeDataExtra
     private getCalleeBlockStatement (
         targetNode: ESTree.Node,
         objectMembersCallsChain: TObjectMembersCallsChain
-    ): ESTree.BlockStatement|null {
-        const objectName: string|number|undefined = objectMembersCallsChain.shift();
+    ): ESTree.BlockStatement | null {
+        const objectName: string | number | undefined = objectMembersCallsChain.shift();
 
         if (!objectName) {
             return null;
         }
 
-        let calleeBlockStatement: ESTree.BlockStatement|null = null;
+        let calleeBlockStatement: ESTree.BlockStatement | null = null;
 
         estraverse.traverse(targetNode, {
             enter: (node: ESTree.Node, parentNode: ESTree.Node): any => {
@@ -127,8 +127,8 @@ export class ObjectExpressionCalleeDataExtractor extends AbstractCalleeDataExtra
     private findCalleeBlockStatement (
         objectExpressionProperties: ESTree.Property[],
         objectMembersCallsChain: TObjectMembersCallsChain
-    ): ESTree.BlockStatement|null {
-        const nextItemInCallsChain: string|number|undefined = objectMembersCallsChain.shift();
+    ): ESTree.BlockStatement | null {
+        const nextItemInCallsChain: string | number | undefined = objectMembersCallsChain.shift();
 
         if (!nextItemInCallsChain) {
             return null;

+ 1 - 1
src/cli/JavaScriptObfuscatorCLI.ts

@@ -107,7 +107,7 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
      */
     private buildOptions (): TInputOptions {
         const inputCLIOptions: TInputOptions = JavaScriptObfuscatorCLI.filterOptions(this.inputCLIOptions);
-        const configFilePath: string|undefined = this.inputCLIOptions.config;
+        const configFilePath: string | undefined = this.inputCLIOptions.config;
         const configFileLocation: string = configFilePath ? path.resolve(configFilePath, '.') : '';
         const configFileOptions: TInputOptions = configFileLocation ? CLIUtils.getUserConfig(configFileLocation) : {};
 

+ 1 - 1
src/cli/utils/CLIUtils.ts

@@ -24,7 +24,7 @@ export class CLIUtils {
      * @param {string} inputPath
      * @returns {string}
      */
-    public static getOutputCodePath (outputPath: string|undefined, inputPath: string): string {
+    public static getOutputCodePath (outputPath: string | undefined, inputPath: string): string {
         if (outputPath) {
             return outputPath;
         }

+ 1 - 1
src/interfaces/analyzers/stack-trace-analyzer/ICalleeDataExtractor.d.ts

@@ -8,5 +8,5 @@ export interface ICalleeDataExtractor {
      * @param callee
      * @returns ICalleeData|null
      */
-    extract (blockScopeBody: ESTree.Node[], callee: ESTree.Node): ICalleeData|null;
+    extract (blockScopeBody: ESTree.Node[], callee: ESTree.Node): ICalleeData | null;
 }

+ 1 - 1
src/interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/IEncodedValue.d.ts

@@ -1,4 +1,4 @@
 export interface IEncodedValue {
     encodedValue: string;
-    key: string|null;
+    key: string | null;
 }

+ 1 - 1
src/node/Nodes.ts

@@ -250,7 +250,7 @@ export class Nodes {
      * @param {string} raw
      * @returns {Literal}
      */
-    public static getLiteralNode (value: boolean|number|string, raw?: string): ESTree.Literal {
+    public static getLiteralNode (value: boolean | number | string, raw?: string): ESTree.Literal {
         raw = raw !== undefined ? raw : `'${value}'`;
 
         return {

+ 1 - 1
src/types/analyzers/stack-trace-analyzer/TObjectMembersCallsChain.d.ts

@@ -1 +1 @@
-export type TObjectMembersCallsChain = (string|number)[];
+export type TObjectMembersCallsChain = (string | number)[];

+ 1 - 1
src/types/node/TNodeWithBlockStatement.d.ts

@@ -1,3 +1,3 @@
 import * as ESTree from 'estree';
 
-export type TNodeWithBlockStatement = ESTree.BlockStatement|ESTree.Program;
+export type TNodeWithBlockStatement = ESTree.BlockStatement | ESTree.Program;

+ 1 - 1
src/types/node/TStatement.d.ts

@@ -1,3 +1,3 @@
 import * as ESTree from 'estree';
 
-export type TStatement = ESTree.Statement|ESTree.ModuleDeclaration;
+export type TStatement = ESTree.Statement | ESTree.ModuleDeclaration;

+ 1 - 1
src/types/options/TStringArrayEncoding.d.ts

@@ -1 +1 @@
-export type TStringArrayEncoding = boolean|'base64'|'rc4';
+export type TStringArrayEncoding = boolean | 'base64' | 'rc4';

+ 5 - 1
tslint.json

@@ -82,6 +82,7 @@
     "no-multi-spaces": [true],
     "no-null-keyword": false,
     "no-parameter-properties": true,
+    "no-parameter-reassignment": false,
     "no-reference": true,
     "no-reference-import": true,
     "no-regex-spaces": true,
@@ -89,6 +90,7 @@
     "no-shadowed-variable": true,
     "no-string-literal": true,
     "no-string-throw": true,
+    "no-submodule-imports": true,
     "no-switch-case-fall-through": false,
     "no-trailing-whitespace": false,
     "no-unnecessary-callback-wrapper": true,
@@ -184,7 +186,9 @@
       "check-decl",
       "check-operator",
       "check-separator",
-      "check-type"
+      "check-type",
+      "check-type-operator",
+      "check-rest-spread"
     ]
   }
 }

+ 18 - 22
yarn.lock

@@ -56,10 +56,14 @@
   version "2.2.42"
   resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.42.tgz#ab769f51d37646b6fe8d4a086a98c285b1fab3f5"
 
-"@types/node@*", "@types/[email protected]":
+"@types/node@*":
   version "8.0.24"
   resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.24.tgz#06c580084d9add1fb40c1510ef0b448961246fb1"
 
+"@types/[email protected]":
+  version "8.0.25"
+  resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.25.tgz#66ecaf4df93f5281b48427ee96fbcdfc4f0cdce1"
+
 "@types/[email protected]":
   version "2.3.3"
   resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-2.3.3.tgz#1f20b96f954b4997a09c1c0a20264aaba6b00147"
@@ -298,15 +302,7 @@ [email protected]:
   optionalDependencies:
     chokidar "^1.6.1"
 
-babel-code-frame@^6.22.0:
-  version "6.22.0"
-  resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4"
-  dependencies:
-    chalk "^1.1.0"
-    esutils "^2.0.2"
-    js-tokens "^3.0.0"
-
-babel-code-frame@^6.26.0:
+babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
   version "6.26.0"
   resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
   dependencies:
@@ -943,7 +939,7 @@ [email protected]:
     pathval "^1.0.0"
     type-detect "^4.0.0"
 
[email protected], chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3:
[email protected], chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3:
   version "1.1.3"
   resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
   dependencies:
@@ -961,9 +957,9 @@ [email protected], chalk@^2.0.0, chalk@^2.1.0:
     escape-string-regexp "^1.0.5"
     supports-color "^4.0.0"
 
[email protected]0:
-  version "1.0.10"
-  resolved "https://registry.yarnpkg.com/chance/-/chance-1.0.10.tgz#03500b04ad94e778dd2891b09ec73a6ad87b1996"
[email protected]1:
+  version "1.0.11"
+  resolved "https://registry.yarnpkg.com/chance/-/chance-1.0.11.tgz#48e82f7583df356053e0ad122d4654c5066c570d"
 
 charenc@~0.0.1:
   version "0.0.2"
@@ -3831,15 +3827,15 @@ [email protected]:
     tslib "^1.0.0"
     tsutils "^1.4.0"
 
-tslint-webpack-plugin@^1.0.0:
[email protected]:
   version "1.0.0"
   resolved "https://registry.yarnpkg.com/tslint-webpack-plugin/-/tslint-webpack-plugin-1.0.0.tgz#c3fdf3b29e77ae4f54e6981b3a85a65909f39ec9"
   dependencies:
     chalk "^2.1.0"
 
-tslint@5.6.0:
-  version "5.6.0"
-  resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.6.0.tgz#088aa6c6026623338650b2900828ab3edf59f6cf"
+tslint@5.7.0:
+  version "5.7.0"
+  resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.7.0.tgz#c25e0d0c92fa1201c2bc30e844e08e682b4f3552"
   dependencies:
     babel-code-frame "^6.22.0"
     colors "^1.1.2"
@@ -3850,15 +3846,15 @@ [email protected]:
     resolve "^1.3.2"
     semver "^5.3.0"
     tslib "^1.7.1"
-    tsutils "^2.7.1"
+    tsutils "^2.8.1"
 
 tsutils@^1.4.0:
   version "1.9.1"
   resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.9.1.tgz#b9f9ab44e55af9681831d5f28d0aeeaf5c750cb0"
 
-tsutils@^2.7.1:
-  version "2.8.0"
-  resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.8.0.tgz#0160173729b3bf138628dd14a1537e00851d814a"
+tsutils@^2.8.1:
+  version "2.8.2"
+  resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.8.2.tgz#2c1486ba431260845b0ac6f902afd9d708a8ea6a"
   dependencies:
     tslib "^1.7.1"