UNPKG

danger-plugin-no-console

Version:

Danger plugin to prevent merging code that still has `console.log`s inside it.

1,315 lines 206 kB
{ "type": "File", "start": 0, "end": 906, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 27, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 906, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 27, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 0, "end": 50, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 50 } }, "declarations": [ { "type": "VariableDeclarator", "start": 6, "end": 49, "loc": { "start": { "line": 1, "column": 6 }, "end": { "line": 1, "column": 49 } }, "id": { "type": "Identifier", "start": 6, "end": 13, "loc": { "start": { "line": 1, "column": 6 }, "end": { "line": 1, "column": 13 }, "identifierName": "PATTERN" }, "name": "PATTERN" }, "init": { "type": "RegExpLiteral", "start": 16, "end": 49, "loc": { "start": { "line": 1, "column": 16 }, "end": { "line": 1, "column": 49 } }, "extra": { "raw": "/console\\.(log|error|warn|info)/g" }, "pattern": "console\\.(log|error|warn|info)", "flags": "g" } } ], "kind": "const", "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Danger plugin to prevent merging code that still has `console.log`s inside it.\n ", "start": 52, "end": 141, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 5, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 142, "end": 905, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 26, "column": 1 } }, "declaration": { "type": "FunctionExpression", "start": 157, "end": 905, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 26, "column": 1 } }, "id": { "type": "Identifier", "start": 172, "end": 181, "loc": { "start": { "line": 6, "column": 30 }, "end": { "line": 6, "column": 39 }, "identifierName": "noConsole" }, "name": "noConsole" }, "generator": false, "expression": false, "async": true, "params": [ { "type": "AssignmentPattern", "start": 182, "end": 194, "loc": { "start": { "line": 6, "column": 40 }, "end": { "line": 6, "column": 52 } }, "left": { "type": "Identifier", "start": 182, "end": 189, "loc": { "start": { "line": 6, "column": 40 }, "end": { "line": 6, "column": 47 }, "identifierName": "options" }, "name": "options" }, "right": { "type": "ObjectExpression", "start": 192, "end": 194, "loc": { "start": { "line": 6, "column": 50 }, "end": { "line": 6, "column": 52 } }, "properties": [] } } ], "body": { "type": "BlockStatement", "start": 196, "end": 905, "loc": { "start": { "line": 6, "column": 54 }, "end": { "line": 26, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 200, "end": 242, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 44 } }, "declarations": [ { "type": "VariableDeclarator", "start": 206, "end": 241, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 43 } }, "id": { "type": "Identifier", "start": 206, "end": 215, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 17 }, "identifierName": "whitelist" }, "name": "whitelist" }, "init": { "type": "LogicalExpression", "start": 218, "end": 241, "loc": { "start": { "line": 7, "column": 20 }, "end": { "line": 7, "column": 43 } }, "left": { "type": "MemberExpression", "start": 218, "end": 235, "loc": { "start": { "line": 7, "column": 20 }, "end": { "line": 7, "column": 37 } }, "object": { "type": "Identifier", "start": 218, "end": 225, "loc": { "start": { "line": 7, "column": 20 }, "end": { "line": 7, "column": 27 }, "identifierName": "options" }, "name": "options" }, "property": { "type": "Identifier", "start": 226, "end": 235, "loc": { "start": { "line": 7, "column": 28 }, "end": { "line": 7, "column": 37 }, "identifierName": "whitelist" }, "name": "whitelist" }, "computed": false }, "operator": "||", "right": { "type": "ArrayExpression", "start": 239, "end": 241, "loc": { "start": { "line": 7, "column": 41 }, "end": { "line": 7, "column": 43 } }, "elements": [] } } } ], "kind": "const" }, { "type": "IfStatement", "start": 245, "end": 359, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 8, "column": 116 } }, "test": { "type": "UnaryExpression", "start": 249, "end": 274, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 31 } }, "operator": "!", "prefix": true, "argument": { "type": "CallExpression", "start": 250, "end": 274, "loc": { "start": { "line": 8, "column": 7 }, "end": { "line": 8, "column": 31 } }, "callee": { "type": "MemberExpression", "start": 250, "end": 263, "loc": { "start": { "line": 8, "column": 7 }, "end": { "line": 8, "column": 20 } }, "object": { "type": "Identifier", "start": 250, "end": 255, "loc": { "start": { "line": 8, "column": 7 }, "end": { "line": 8, "column": 12 }, "identifierName": "Array" }, "name": "Array" }, "property": { "type": "Identifier", "start": 256, "end": 263, "loc": { "start": { "line": 8, "column": 13 }, "end": { "line": 8, "column": 20 }, "identifierName": "isArray" }, "name": "isArray" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 264, "end": 273, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 30 }, "identifierName": "whitelist" }, "name": "whitelist" } ] }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "ThrowStatement", "start": 276, "end": 359, "loc": { "start": { "line": 8, "column": 33 }, "end": { "line": 8, "column": 116 } }, "argument": { "type": "NewExpression", "start": 282, "end": 358, "loc": { "start": { "line": 8, "column": 39 }, "end": { "line": 8, "column": 115 } }, "callee": { "type": "Identifier", "start": 286, "end": 291, "loc": { "start": { "line": 8, "column": 43 }, "end": { "line": 8, "column": 48 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 292, "end": 357, "loc": { "start": { "line": 8, "column": 49 }, "end": { "line": 8, "column": 114 } }, "extra": { "rawValue": "[danger-plugin-no-console] whitelist option has to be an array.", "raw": "'[danger-plugin-no-console] whitelist option has to be an array.'" }, "value": "[danger-plugin-no-console] whitelist option has to be an array." } ] } }, "alternate": null }, { "type": "VariableDeclaration", "start": 363, "end": 435, "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 74 } }, "declarations": [ { "type": "VariableDeclarator", "start": 369, "end": 435, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 74 } }, "id": { "type": "Identifier", "start": 369, "end": 374, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 13 }, "identifierName": "files" }, "name": "files" }, "init": { "type": "CallExpression", "start": 377, "end": 435, "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 74 } }, "callee": { "type": "MemberExpression", "start": 377, "end": 409, "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 48 } }, "object": { "type": "MemberExpression", "start": 377, "end": 402, "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 41 } }, "object": { "type": "MemberExpression", "start": 377, "end": 387, "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 26 } }, "object": { "type": "Identifier", "start": 377, "end": 383, "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 22 }, "identifierName": "danger" }, "name": "danger" }, "property": { "type": "Identifier", "start": 384, "end": 387, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 26 }, "identifierName": "git" }, "name": "git" }, "computed": false }, "property": { "type": "Identifier", "start": 388, "end": 402, "loc": { "start": { "line": 10, "column": 27 }, "end": { "line": 10, "column": 41 }, "identifierName": "modified_files" }, "name": "modified_files" }, "computed": false }, "property": { "type": "Identifier", "start": 403, "end": 409, "loc": { "start": { "line": 10, "column": 42 }, "end": { "line": 10, "column": 48 }, "identifierName": "concat" }, "name": "concat" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 410, "end": 434, "loc": { "start": { "line": 10, "column": 49 }, "end": { "line": 10, "column": 73 } }, "object": { "type": "MemberExpression", "start": 410, "end": 420, "loc": { "start": { "line": 10, "column": 49 }, "end": { "line": 10, "column": 59 } }, "object": { "type": "Identifier", "start": 410, "end": 416, "loc": { "start": { "line": 10, "column": 49 }, "end": { "line": 10, "column": 55 }, "identifierName": "danger" }, "name": "danger" }, "property": { "type": "Identifier", "start": 417, "end": 420, "loc": { "start": { "line": 10, "column": 56 }, "end": { "line": 10, "column": 59 }, "identifierName": "git" }, "name": "git" }, "computed": false }, "property": { "type": "Identifier", "start": 421, "end": 434, "loc": { "start": { "line": 10, "column": 60 }, "end": { "line": 10, "column": 73 }, "identifierName": "created_files" }, "name": "created_files" }, "computed": false } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 438, "end": 593, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 16, "column": 3 } }, "declarations": [ { "type": "VariableDeclarator", "start": 444, "end": 593, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 16, "column": 3 } }, "id": { "type": "Identifier", "start": 444, "end": 452, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 16 }, "identifierName": "contents" }, "name": "contents" }, "init": { "type": "AwaitExpression", "start": 455, "end": 593, "loc": { "start": { "line": 11, "column": 19 }, "end": { "line": 16, "column": 3 } }, "argument": { "type": "CallExpression", "start": 461, "end": 593, "loc": { "start": { "line": 11, "column": 25 }, "end": { "line": 16, "column": 3 } }, "callee": { "type": "MemberExpression", "start": 461, "end": 472, "loc": { "start": { "line": 11, "column": 25 }, "end": { "line": 11, "column": 36 } }, "object": { "type": "Identifier", "start": 461, "end": 468, "loc": { "start": { "line": 11, "column": 25 }, "end": { "line": 11, "column": 32 }, "identifierName": "Promise" }, "name": "Promise" }, "property": { "type": "Identifier", "start": 469, "end": 472, "loc": { "start": { "line": 11, "column": 33 }, "end": { "line": 11, "column": 36 }, "identifierName": "all" }, "name": "all" }, "computed": false }, "arguments": [ { "type": "CallExpression", "start": 478, "end": 589, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 15, "column": 8 } }, "callee": { "type": "MemberExpression", "start": 478, "end": 487, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 13 } }, "object": { "type": "Identifier", "start": 478, "end": 483, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 9 }, "identifierName": "files" }, "name": "files" }, "property": { "type": "Identifier", "start": 484, "end": 487, "loc": { "start": { "line": 12, "column": 10 }, "end": { "line": 12, "column": 13 }, "identifierName": "map" }, "name": "map" }, "computed": false }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 488, "end": 588, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 15, "column": 7 } }, "id": null, "generator": false, "expression": true, "async": false, "params": [ { "type": "Identifier", "start": 488, "end": 492, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 18 }, "identifierName": "file" }, "name": "file" } ], "body": { "type": "CallExpression", "start": 496, "end": 588, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 15, "column": 7 } }, "callee": { "type": "MemberExpression", "start": 496, "end": 539, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 65 } }, "object": { "type": "CallExpression", "start": 496, "end": 534, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 60 } }, "callee": { "type": "MemberExpression", "start": 496, "end": 528, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 54 } }, "object": { "type": "MemberExpression", "start": 496, "end": 515, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 41 } }, "object": { "type": "MemberExpression", "start": 496, "end": 509, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 35 } }, "object": { "type": "Identifier", "start": 496, "end": 502, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 28 }, "identifierName": "danger" }, "name": "danger" }, "property": { "type": "Identifier", "start": 503, "end": 509, "loc": { "start": { "line": 12, "column": 29 }, "end": { "line": 12, "column": 35 }, "identifierName": "github" }, "name": "github" }, "computed": false }, "property": { "type": "Identifier", "start": 510, "end": 515, "loc": { "start": { "line": 12, "column": 36 }, "end": { "line": 12, "column": 41 }, "identifierName": "utils" }, "name": "utils" }, "computed": false }, "property": { "type": "Identifier", "start": 516, "end": 528, "loc": { "start": { "line": 12, "column": 42 }, "end": { "line": 12, "column": 54 }, "identifierName": "fileContents" }, "name": "fileContents" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 529, "end": 533, "loc": { "start": { "line": 12, "column": 55 }, "end": { "line": 12, "column": 59 }, "identifierName": "file" }, "name": "file" } ] }, "property": { "type": "Identifier", "start": 535, "end": 539, "loc": { "start": { "line": 12, "column": 61 }, "end": { "line": 12, "column": 65 }, "identifierName": "then" }, "name": "then" }, "computed": false }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 540, "end": 587, "loc": { "start": { "line": 12, "column": 66 }, "end": { "line": 15, "column": 6 } }, "id": null, "generator": false, "expression": true, "async": false, "params": [ { "type": "Identifier", "start": 540, "end": 547, "loc": { "start": { "line": 12, "column": 66 }, "end": { "line": 12, "column": 73 }, "identifierName": "content" }, "name": "content" } ], "body": { "type": "ObjectExpression", "start": 552, "end": 586, "loc": { "start": { "line": 12, "column": 78 }, "end": { "line": 15, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 560, "end": 564, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 10 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 56