UNPKG

danger-plugin-no-console

Version:

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

1,462 lines (1,461 loc) 199 kB
{ "type": "File", "start": 0, "end": 1035, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 45, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1035, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 45, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 27, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 27 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 16, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 16 } }, "local": { "type": "Identifier", "start": 7, "end": 16, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 16 }, "identifierName": "noConsole" }, "name": "noConsole" } } ], "source": { "type": "StringLiteral", "start": 22, "end": 26, "loc": { "start": { "line": 1, "column": 22 }, "end": { "line": 1, "column": 26 } }, "extra": { "rawValue": "./", "raw": "'./'" }, "value": "./" } }, { "type": "VariableDeclaration", "start": 29, "end": 276, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 7, "column": 1 } }, "declarations": [ { "type": "VariableDeclarator", "start": 35, "end": 276, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 7, "column": 1 } }, "id": { "type": "Identifier", "start": 35, "end": 40, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 11 }, "identifierName": "files" }, "name": "files" }, "init": { "type": "ObjectExpression", "start": 43, "end": 276, "loc": { "start": { "line": 3, "column": 14 }, "end": { "line": 7, "column": 1 } }, "properties": [ { "type": "ObjectProperty", "start": 47, "end": 125, "loc": { "start": { "line": 4, "column": 2 }, "end": { "line": 4, "column": 80 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 47, "end": 59, "loc": { "start": { "line": 4, "column": 2 }, "end": { "line": 4, "column": 14 } }, "extra": { "rawValue": "src/log.js", "raw": "'src/log.js'" }, "value": "src/log.js" }, "value": { "type": "StringLiteral", "start": 61, "end": 125, "loc": { "start": { "line": 4, "column": 16 }, "end": { "line": 4, "column": 80 } }, "extra": { "rawValue": "function add(a, b) {\n console.log(a, b);\n return a + b;\n}", "raw": "'function add(a, b) {\\n console.log(a, b);\\n return a + b;\\n}'" }, "value": "function add(a, b) {\n console.log(a, b);\n return a + b;\n}" } }, { "type": "ObjectProperty", "start": 129, "end": 187, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 5, "column": 60 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 129, "end": 143, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 5, "column": 16 } }, "extra": { "rawValue": "src/clean.js", "raw": "'src/clean.js'" }, "value": "src/clean.js" }, "value": { "type": "StringLiteral", "start": 145, "end": 187, "loc": { "start": { "line": 5, "column": 18 }, "end": { "line": 5, "column": 60 } }, "extra": { "rawValue": "function add(a, b) {\n return a + b;\n}", "raw": "'function add(a, b) {\\n return a + b;\\n}'" }, "value": "function add(a, b) {\n return a + b;\n}" } }, { "type": "ObjectProperty", "start": 191, "end": 273, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 84 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 191, "end": 205, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 16 } }, "extra": { "rawValue": "src/error.js", "raw": "'src/error.js'" }, "value": "src/error.js" }, "value": { "type": "StringLiteral", "start": 207, "end": 273, "loc": { "start": { "line": 6, "column": 18 }, "end": { "line": 6, "column": 84 } }, "extra": { "rawValue": "function add(a, b) {\n console.error(a, b);\n return a + b;\n}", "raw": "'function add(a, b) {\\n console.error(a, b);\\n return a + b;\\n}'" }, "value": "function add(a, b) {\n console.error(a, b);\n return a + b;\n}" } } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 278, "end": 315, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 37 } }, "declarations": [ { "type": "VariableDeclarator", "start": 284, "end": 314, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 36 } }, "id": { "type": "Identifier", "start": 284, "end": 293, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 15 }, "identifierName": "fileNames" }, "name": "fileNames" }, "init": { "type": "CallExpression", "start": 296, "end": 314, "loc": { "start": { "line": 9, "column": 18 }, "end": { "line": 9, "column": 36 } }, "callee": { "type": "MemberExpression", "start": 296, "end": 307, "loc": { "start": { "line": 9, "column": 18 }, "end": { "line": 9, "column": 29 } }, "object": { "type": "Identifier", "start": 296, "end": 302, "loc": { "start": { "line": 9, "column": 18 }, "end": { "line": 9, "column": 24 }, "identifierName": "Object" }, "name": "Object" }, "property": { "type": "Identifier", "start": 303, "end": 307, "loc": { "start": { "line": 9, "column": 25 }, "end": { "line": 9, "column": 29 }, "identifierName": "keys" }, "name": "keys" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 308, "end": 313, "loc": { "start": { "line": 9, "column": 30 }, "end": { "line": 9, "column": 35 }, "identifierName": "files" }, "name": "files" } ] } } ], "kind": "const", "trailingComments": [ { "type": "CommentLine", "value": " Mock the Danger API", "start": 317, "end": 339, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 22 } } } ] }, { "type": "ExpressionStatement", "start": 340, "end": 577, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 24, "column": 1 } }, "expression": { "type": "AssignmentExpression", "start": 340, "end": 577, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 24, "column": 1 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 340, "end": 353, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 13 } }, "object": { "type": "Identifier", "start": 340, "end": 346, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 6 }, "identifierName": "global" }, "name": "global", "leadingComments": null }, "property": { "type": "Identifier", "start": 347, "end": 353, "loc": { "start": { "line": 12, "column": 7 }, "end": { "line": 12, "column": 13 }, "identifierName": "danger" }, "name": "danger" }, "computed": false, "leadingComments": null }, "right": { "type": "ObjectExpression", "start": 356, "end": 577, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 24, "column": 1 } }, "properties": [ { "type": "ObjectProperty", "start": 360, "end": 454, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 16, "column": 3 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 360, "end": 363, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 5 }, "identifierName": "git" }, "name": "git" }, "value": { "type": "ObjectExpression", "start": 365, "end": 454, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 16, "column": 3 } }, "properties": [ { "type": "ObjectProperty", "start": 371, "end": 415, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 48 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 371, "end": 385, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 18 }, "identifierName": "modified_files" }, "name": "modified_files" }, "value": { "type": "ArrayExpression", "start": 387, "end": 415, "loc": { "start": { "line": 14, "column": 20 }, "end": { "line": 14, "column": 48 } }, "elements": [ { "type": "MemberExpression", "start": 388, "end": 400, "loc": { "start": { "line": 14, "column": 21 }, "end": { "line": 14, "column": 33 } }, "object": { "type": "Identifier", "start": 388, "end": 397, "loc": { "start": { "line": 14, "column": 21 }, "end": { "line": 14, "column": 30 }, "identifierName": "fileNames" }, "name": "fileNames" }, "property": { "type": "NumericLiteral", "start": 398, "end": 399, "loc": { "start": { "line": 14, "column": 31 }, "end": { "line": 14, "column": 32 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 }, "computed": true }, { "type": "MemberExpression", "start": 402, "end": 414, "loc": { "start": { "line": 14, "column": 35 }, "end": { "line": 14, "column": 47 } }, "object": { "type": "Identifier", "start": 402, "end": 411, "loc": { "start": { "line": 14, "column": 35 }, "end": { "line": 14, "column": 44 }, "identifierName": "fileNames" }, "name": "fileNames" }, "property": { "type": "NumericLiteral", "start": 412, "end": 413, "loc": { "start": { "line": 14, "column": 45 }, "end": { "line": 14, "column": 46 } }, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, "computed": true } ] } }, { "type": "ObjectProperty", "start": 421, "end": 450, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 33 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 421, "end": 434, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 17 }, "identifierName": "created_files" }, "name": "created_files" }, "value": { "type": "ArrayExpression", "start": 436, "end": 450, "loc": { "start": { "line": 15, "column": 19 }, "end": { "line": 15, "column": 33 } }, "elements": [ { "type": "MemberExpression", "start": 437, "end": 449, "loc": { "start": { "line": 15, "column": 20 }, "end": { "line": 15, "column": 32 } }, "object": { "type": "Identifier", "start": 437, "end": 446, "loc": { "start": { "line": 15, "column": 20 }, "end": { "line": 15, "column": 29 }, "identifierName": "fileNames" }, "name": "fileNames" }, "property": { "type": "NumericLiteral", "start": 447, "end": 448, "loc": { "start": { "line": 15, "column": 30 }, "end": { "line": 15, "column": 31 } }, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 }, "computed": true } ] } } ] } }, { "type": "ObjectProperty", "start": 458, "end": 575, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 23, "column": 3 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 458, "end": 464, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 17, "column": 8 }, "identifierName": "github" }, "name": "github" }, "value": { "type": "ObjectExpression", "start": 466, "end": 575, "loc": { "start": { "line": 17, "column": 10 }, "end": { "line": 23, "column": 3 } }, "properties": [ { "type": "ObjectProperty", "start": 472, "end": 571, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 22, "column": 5 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 472, "end": 477, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 9 }, "identifierName": "utils" }, "name": "utils" }, "value": { "type": "ObjectExpression", "start": 479, "end": 571, "loc": { "start": { "line": 18, "column": 11 }, "end": { "line": 22, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 487, "end": 565, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 21, "column": 8 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 487, "end": 499, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 18 }, "identifierName": "fileContents" }, "name": "fileContents" }, "value": { "type": "ArrowFunctionExpression", "start": 501, "end": 565, "loc": { "start": { "line": 19, "column": 20 }, "end": { "line": 21, "column": 8 } }, "id": null, "generator": false, "expression": true, "async": false, "params": [ { "type": "Identifier", "start": 502, "end": 506, "loc": { "start": { "line": 19, "column": 21 }, "end": { "line": 19, "column": 25 }, "identifierName": "path" }, "name": "path" } ], "body": { "type": "NewExpression", "start": 511, "end": 565, "loc": { "start": { "line": 19, "column": 30 }, "end": { "line": 21, "column": 8 } }, "callee": { "type": "Identifier", "start": 515, "end": 522, "loc": { "start": { "line": 19, "column": 34 }, "end": { "line": 19, "column": 41 }, "identifierName": "Promise" }, "name": "Promise" }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 523, "end": 564, "loc": { "start": { "line": 19, "column": 42 }, "end": { "line": 21, "column": 7 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 523, "end": 526, "loc": { "start": { "line": 19, "column": 42 }, "end": { "line": 19, "column": 45 }, "identifierName": "res" }, "name": "res" } ], "body": { "type": "BlockStatement", "start": 530, "end": 564, "loc": { "start": { "line": 19, "column": 49 }, "end": { "line": 21, "column": 7 } }, "body": [ { "type": "ExpressionStatement", "start": 540, "end": 556, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 24 } }, "expression": { "type": "CallExpression", "start": 540, "end": 556, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 24 } }, "callee": { "type": "Identifier", "start": 540, "end": 543, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 11 }, "identifierName": "res" }, "name": "res" }, "arguments": [ { "type": "MemberExpression", "start": 544, "end": 555, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 23 } }, "object": { "type": "Identifier", "start": 544, "end": 549, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 17 }, "identifierName": "files" }, "name": "files" }, "property": { "type": "Identifier", "start": 550, "end": 554, "loc": { "start": { "line": 20, "column": 18 }, "end": { "line": 20, "column": 22 }, "identifierName": "path" }, "name": "path" }, "computed": true } ] } } ], "directives": [] } } ] } } } ] } } ] } } ] }, "leadingComments": null }, "leadingComments": [ { "type": "CommentLine", "value": " Mock the Danger API", "start": 317, "end": 339, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 22 } } } ] }, { "type": "ExpressionStatement", "start": 579, "end": 626, "loc": { "start": { "line": 26, "column": 0 }, "end": { "line": 28, "column": 2 } }, "expression": { "type": "CallExpression", "start": 579, "end": 626, "loc": { "start": { "line": 26, "column": 0 }, "end": { "line": 28, "column": 2 } }, "callee": { "type": "Identifier", "start": 579, "end": 589, "loc": { "start": { "line": 26, "column": 0 }, "end": { "line": 26, "column": 10 }, "identifierName": "beforeEach" }, "name": "beforeEach" }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 590, "end": 625, "loc": { "start": { "line": 26, "column": 11 }, "end": { "line": 28, "column": 1 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 596, "end": 625, "loc": { "start": { "line": 26, "column": 17 }, "end": { "line": 28, "column": 1 } }, "body": [ { "type": "ExpressionStatement", "start": 600, "end": 623, "loc": { "start": { "line": 27, "column": 2 }, "end": { "line": 27, "column": 25 } }, "expression": { "type": "AssignmentExpression", "start": 600, "end": 623, "loc": { "start": { "line": 27, "column": 2 }, "end": { "line": 27, "column": 25 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 600, "end": 611, "loc": { "start": { "line": 27, "column": 2 }, "end": { "line": 27, "column": 13 } }, "object": { "type": "Identifier", "start": 600, "end": 606, "loc": { "start": { "line": 27, "column": 2 }, "end": { "line": 27, "column": 8 }, "identifierName": "global" }, "name": "global" }, "property": { "type": "Identifier", "start": 607, "end": 611, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 27, "column": 13 }, "identifierName": "fail" }, "name": "fail" }, "computed": false }, "right": { "type": "CallExpression", "start": 614, "end": 623, "loc": { "start": { "line": 27, "column": 16 }, "end": {