Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed Jul 15, 2019
1 parent 51e0e97 commit b7a373f
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 113 deletions.
24 changes: 12 additions & 12 deletions ReactCommon/hermes/inspector/tools/msggen/__tests__/CommandTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { Command } from '../src/Command.js';

test('parses simple command', () => {
let obj = {
"name": "setBreakpointsActive",
"parameters": [
{ "name": "active", "type": "boolean", "description": "New value for breakpoints active state." }
'name': 'setBreakpointsActive',
'parameters': [
{ 'name': 'active', 'type': 'boolean', 'description': 'New value for breakpoints active state.' },
],
"description": "Activates / deactivates all breakpoints on the page."
'description': 'Activates / deactivates all breakpoints on the page.',
};
let command = Command.create('Debugger', obj, false);

Expand All @@ -31,16 +31,16 @@ test('parses simple command', () => {

test('parses command with return', () => {
let obj = {
"name": "setBreakpoint",
"parameters": [
{ "name": "location", "$ref": "Location", "description": "Location to set breakpoint in." },
{ "name": "condition", "type": "string", "optional": true, "description": "Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true." }
'name': 'setBreakpoint',
'parameters': [
{ 'name': 'location', '$ref': 'Location', 'description': 'Location to set breakpoint in.' },
{ 'name': 'condition', 'type': 'string', 'optional': true, 'description': 'Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.' },
],
"returns": [
{ "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." },
{ "name": "actualLocation", "$ref": "Location", "description": "Location this breakpoint resolved into." }
'returns': [
{ 'name': 'breakpointId', '$ref': 'BreakpointId', 'description': 'Id of the created breakpoint for further reference.' },
{ 'name': 'actualLocation', '$ref': 'Location', 'description': 'Location this breakpoint resolved into.' },
],
"description": "Sets JavaScript breakpoint at a given location."
'description': 'Sets JavaScript breakpoint at a given location.',
};
let command = Command.create('Debugger', obj, false);

Expand Down
14 changes: 7 additions & 7 deletions ReactCommon/hermes/inspector/tools/msggen/__tests__/EventTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { Event } from '../src/Event.js';

test('parses simple event', () => {
let obj = {
"name": "resumed",
"description": "Fired when the virtual machine resumed execution."
'name': 'resumed',
'description': 'Fired when the virtual machine resumed execution.',
};
let event = Event.create('Debugger', obj, false);

Expand All @@ -25,12 +25,12 @@ test('parses simple event', () => {

test('parses event with params', () => {
let obj = {
"name": "breakpointResolved",
"parameters": [
{ "name": "breakpointId", "$ref": "BreakpointId", "description": "Breakpoint unique identifier." },
{ "name": "location", "$ref": "Location", "description": "Actual breakpoint location." }
'name': 'breakpointResolved',
'parameters': [
{ 'name': 'breakpointId', '$ref': 'BreakpointId', 'description': 'Breakpoint unique identifier.' },
{ 'name': 'location', '$ref': 'Location', 'description': 'Actual breakpoint location.' },
],
"description": "Fired when breakpoint is resolved to an actual script and location."
'description': 'Fired when breakpoint is resolved to an actual script and location.',
};
let event = Event.create('Debugger', obj, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ beforeEach(() => {

test('emits type decl', () => {
let obj = {
"id": "Location",
"type": "object",
"properties": [
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Script identifier as reported in the <code>Debugger.scriptParsed</code>." },
{ "name": "lineNumber", "type": "integer", "description": "Line number in the script (0-based)." },
{ "name": "columnNumber", "type": "integer", "optional": true, "description": "Column number in the script (0-based)." }
'id': 'Location',
'type': 'object',
'properties': [
{ 'name': 'scriptId', '$ref': 'Runtime.ScriptId', 'description': 'Script identifier as reported in the <code>Debugger.scriptParsed</code>.' },
{ 'name': 'lineNumber', 'type': 'integer', 'description': 'Line number in the script (0-based).' },
{ 'name': 'columnNumber', 'type': 'integer', 'optional': true, 'description': 'Column number in the script (0-based).' },
],
"description": "Location in the source code."
'description': 'Location in the source code.',
};
let type = Type.create('Debugger', obj);

Expand All @@ -51,14 +51,14 @@ test('emits type decl', () => {

test('emits request decl', () => {
let obj = {
"name": "getScriptSource",
"parameters": [
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to get source for." }
'name': 'getScriptSource',
'parameters': [
{ 'name': 'scriptId', '$ref': 'Runtime.ScriptId', 'description': 'Id of the script to get source for.' },
],
"returns": [
{ "name": "scriptSource", "type": "string", "description": "Script source." }
'returns': [
{ 'name': 'scriptSource', 'type': 'string', 'description': 'Script source.' },
],
"description": "Returns source for the script with given id."
'description': 'Returns source for the script with given id.',
};
let command = Command.create('Debugger', obj);

Expand All @@ -79,14 +79,14 @@ test('emits request decl', () => {

test('emits response decl', () => {
let obj = {
"name": "getScriptSource",
"parameters": [
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to get source for." }
'name': 'getScriptSource',
'parameters': [
{ 'name': 'scriptId', '$ref': 'Runtime.ScriptId', 'description': 'Id of the script to get source for.' },
],
"returns": [
{ "name": "scriptSource", "type": "string", "description": "Script source." }
'returns': [
{ 'name': 'scriptSource', 'type': 'string', 'description': 'Script source.' },
],
"description": "Returns source for the script with given id."
'description': 'Returns source for the script with given id.',
};
let command = Command.create('Debugger', obj);

Expand All @@ -105,11 +105,11 @@ test('emits response decl', () => {

test('emits notification decl', () => {
let obj = {
"name": "messageAdded",
"parameters": [
{ "name": "message", "$ref": "ConsoleMessage", "description": "Console message that has been added." }
'name': 'messageAdded',
'parameters': [
{ 'name': 'message', '$ref': 'ConsoleMessage', 'description': 'Console message that has been added.' },
],
"description": "Issued when new console message is added."
'description': 'Issued when new console message is added.',
};
let event = Event.create('Console', obj);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
emitNotificationDef,
emitRequestDef,
emitResponseDef,
emitTypeDef
emitTypeDef,
} from '../src/ImplementationWriter';
import { Event } from '../src/Event';
import { Command } from '../src/Command';
Expand All @@ -23,14 +23,14 @@ beforeEach(() => {

test('emits type def', () => {
let obj = {
"id": "Location",
"type": "object",
"properties": [
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Script identifier as reported in the <code>Debugger.scriptParsed</code>." },
{ "name": "lineNumber", "type": "integer", "description": "Line number in the script (0-based)." },
{ "name": "columnNumber", "type": "integer", "optional": true, "description": "Column number in the script (0-based)." }
'id': 'Location',
'type': 'object',
'properties': [
{ 'name': 'scriptId', '$ref': 'Runtime.ScriptId', 'description': 'Script identifier as reported in the <code>Debugger.scriptParsed</code>.' },
{ 'name': 'lineNumber', 'type': 'integer', 'description': 'Line number in the script (0-based).' },
{ 'name': 'columnNumber', 'type': 'integer', 'optional': true, 'description': 'Column number in the script (0-based).' },
],
"description": "Location in the source code."
'description': 'Location in the source code.',
};
let type = Type.create('Debugger', obj);

Expand All @@ -55,14 +55,14 @@ test('emits type def', () => {

test('emits request def', () => {
let obj = {
"name": "getScriptSource",
"parameters": [
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to get source for." }
'name': 'getScriptSource',
'parameters': [
{ 'name': 'scriptId', '$ref': 'Runtime.ScriptId', 'description': 'Id of the script to get source for.' },
],
"returns": [
{ "name": "scriptSource", "type": "string", "description": "Script source." }
'returns': [
{ 'name': 'scriptSource', 'type': 'string', 'description': 'Script source.' },
],
"description": "Returns source for the script with given id."
'description': 'Returns source for the script with given id.',
};
let command = Command.create('Debugger', obj);

Expand Down Expand Up @@ -100,14 +100,14 @@ test('emits request def', () => {

test('emits response def', () => {
let obj = {
"name": "getScriptSource",
"parameters": [
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to get source for." }
'name': 'getScriptSource',
'parameters': [
{ 'name': 'scriptId', '$ref': 'Runtime.ScriptId', 'description': 'Id of the script to get source for.' },
],
"returns": [
{ "name": "scriptSource", "type": "string", "description": "Script source." }
'returns': [
{ 'name': 'scriptSource', 'type': 'string', 'description': 'Script source.' },
],
"description": "Returns source for the script with given id."
'description': 'Returns source for the script with given id.',
};
let command = Command.create('Debugger', obj);

Expand Down Expand Up @@ -135,11 +135,11 @@ test('emits response def', () => {

test('emits notification def', () => {
let obj = {
"name": "messageAdded",
"parameters": [
{ "name": "message", "$ref": "ConsoleMessage", "description": "Console message that has been added." }
'name': 'messageAdded',
'parameters': [
{ 'name': 'message', '$ref': 'ConsoleMessage', 'description': 'Console message that has been added.' },
],
"description": "Issued when new console message is added."
'description': 'Issued when new console message is added.',
};
let event = Event.create('Console', obj);

Expand Down
58 changes: 29 additions & 29 deletions ReactCommon/hermes/inspector/tools/msggen/__tests__/PropertyTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { Property } from '../src/Property.js';

test('parses required primitive prop', () => {
let obj = {
"name": "lineNumber",
"type": "integer",
"description": "Line number in the script (0-based)."
'name': 'lineNumber',
'type': 'integer',
'description': 'Line number in the script (0-based).',
};
let prop = Property.create('Debugger', obj);

Expand All @@ -27,10 +27,10 @@ test('parses required primitive prop', () => {

test('parses optional primitive prop', () => {
let obj = {
"name": "samplingInterval",
"type": "number",
"optional": true,
"description": "Average sample interval in bytes."
'name': 'samplingInterval',
'type': 'number',
'optional': true,
'description': 'Average sample interval in bytes.',
};
let prop = Property.create('HeapProfiler', obj);

Expand All @@ -47,10 +47,10 @@ test('parses optional primitive prop', () => {

test('parses optional ref prop', () => {
let obj = {
"name": "exceptionDetails",
"optional": true,
"$ref": "Runtime.ExceptionDetails",
"description": "Exception details if any."
'name': 'exceptionDetails',
'optional': true,
'$ref': 'Runtime.ExceptionDetails',
'description': 'Exception details if any.',
};
let prop = Property.create('Debugger', obj);

Expand All @@ -67,11 +67,11 @@ test('parses optional ref prop', () => {

test('parses recursive ref prop', () => {
let obj = {
"name": "parent",
"$ref": "StackTrace",
"optional": true,
"recursive": true,
"description": "Asynchronous JavaScript stack trace..."
'name': 'parent',
'$ref': 'StackTrace',
'optional': true,
'recursive': true,
'description': 'Asynchronous JavaScript stack trace...',
};
let prop = Property.create('Runtime', obj);

Expand All @@ -89,20 +89,20 @@ test('parses recursive ref prop', () => {

test('parses optional array items prop', () => {
let obj = {
"name": "hitBreakpoints",
"type": "array",
"optional": true,
"items": { "type": "string" },
"description": "Hit breakpoints IDs"
'name': 'hitBreakpoints',
'type': 'array',
'optional': true,
'items': { 'type': 'string' },
'description': 'Hit breakpoints IDs',
};
let prop = Property.create('Debugger', obj);

expect(prop.domain).toBe('Debugger');
expect(prop.name).toBe('hitBreakpoints');
expect(prop.type).toBe('array');
expect(prop.optional).toBe(true);
expect(prop.items).toEqual({ "type": "string" });
expect(prop.description).toBe("Hit breakpoints IDs");
expect(prop.items).toEqual({ 'type': 'string' });
expect(prop.description).toBe('Hit breakpoints IDs');

expect(prop.getFullCppType()).toBe('folly::Optional<std::vector<std::string>>');
expect(prop.getCppIdentifier()).toBe('hitBreakpoints');
Expand All @@ -111,18 +111,18 @@ test('parses optional array items prop', () => {

test('parses array ref prop', () => {
let obj = {
"name": "domains",
"type": "array",
"items": { "$ref": "Domain" },
"description": "List of supported domains."
'name': 'domains',
'type': 'array',
'items': { '$ref': 'Domain' },
'description': 'List of supported domains.',
};
let prop = Property.create('Schema', obj);

expect(prop.domain).toBe('Schema');
expect(prop.name).toBe('domains');
expect(prop.type).toBe('array');
expect(prop.items).toEqual({ $ref: "Domain" });
expect(prop.description).toBe("List of supported domains.");
expect(prop.items).toEqual({ $ref: 'Domain' });
expect(prop.description).toBe('List of supported domains.');

expect(prop.getFullCppType()).toBe('std::vector<schema::Domain>');
expect(prop.getCppIdentifier()).toBe('domains');
Expand Down
20 changes: 10 additions & 10 deletions ReactCommon/hermes/inspector/tools/msggen/__tests__/TypeTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { Type } from '../src/Type.js';

test('parses primitive type', () => {
let obj = {
"id": "Timestamp",
"type": "number",
"description": "Number of milliseconds since epoch."
'id': 'Timestamp',
'type': 'number',
'description': 'Number of milliseconds since epoch.',
};
let type = Type.create('Runtime', obj, false);

Expand All @@ -26,14 +26,14 @@ test('parses primitive type', () => {

test('parses object type', () => {
let obj = {
"id": "Location",
"type": "object",
"properties": [
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Script identifier as reported in the <code>Debugger.scriptParsed</code>." },
{ "name": "lineNumber", "type": "integer", "description": "Line number in the script (0-based)." },
{ "name": "columnNumber", "type": "integer", "optional": true, "description": "Column number in the script (0-based)." }
'id': 'Location',
'type': 'object',
'properties': [
{ 'name': 'scriptId', '$ref': 'Runtime.ScriptId', 'description': 'Script identifier as reported in the <code>Debugger.scriptParsed</code>.' },
{ 'name': 'lineNumber', 'type': 'integer', 'description': 'Line number in the script (0-based).' },
{ 'name': 'columnNumber', 'type': 'integer', 'optional': true, 'description': 'Column number in the script (0-based).' },
],
"description": "Location in the source code."
'description': 'Location in the source code.',
};
let type = Type.create('Debugger', obj, false);

Expand Down
Loading

0 comments on commit b7a373f

Please sign in to comment.