diff --git a/gdbgui/src/js/BinaryLoader.jsx b/gdbgui/src/js/BinaryLoader.jsx index 94999868..33c9c59a 100644 --- a/gdbgui/src/js/BinaryLoader.jsx +++ b/gdbgui/src/js/BinaryLoader.jsx @@ -154,7 +154,9 @@ class BinaryLoader extends React.Component { } /> - {this.state.past_binaries.map((b, i) => )} + {this.state.past_binaries.map((b, i) => ( + + ))} ); diff --git a/gdbgui/src/js/Breakpoints.jsx b/gdbgui/src/js/Breakpoints.jsx index 98427f2c..4e67e911 100644 --- a/gdbgui/src/js/Breakpoints.jsx +++ b/gdbgui/src/js/Breakpoints.jsx @@ -66,13 +66,14 @@ class Breakpoint extends React.Component { ); } - get_num_times_hit(bkpt){ - if ((bkpt.times === undefined) // E.g. 'bkpt' is a child breakpoint - || - (bkpt.times == 0)) { - return "" + get_num_times_hit(bkpt) { + if ( + bkpt.times === undefined || // E.g. 'bkpt' is a child breakpoint + bkpt.times == 0 + ) { + return ""; } else if (bkpt.times == 1) { - return "1 hit" + return "1 hit"; } else { return `${bkpt.times} hits`; } @@ -131,7 +132,7 @@ class Breakpoint extends React.Component { thread groups: {b["thread-groups"]} - + {times_hit} diff --git a/gdbgui/src/js/CopyToClipboard.tsx b/gdbgui/src/js/CopyToClipboard.tsx index 890f1010..95a6f3ca 100644 --- a/gdbgui/src/js/CopyToClipboard.tsx +++ b/gdbgui/src/js/CopyToClipboard.tsx @@ -3,7 +3,7 @@ import ToolTip from "./ToolTip.jsx"; import { store } from "statorgfc"; type Props = { - content: string | null + content: string | null; }; class CopyToClipboard extends React.Component { diff --git a/gdbgui/src/js/FileOps.jsx b/gdbgui/src/js/FileOps.jsx index 5e777a3a..2608c068 100644 --- a/gdbgui/src/js/FileOps.jsx +++ b/gdbgui/src/js/FileOps.jsx @@ -429,7 +429,8 @@ const FileOps = {

{`Binary: ${store.get("inferior_binary_path")}, modified ${moment( store.get("inferior_binary_path_last_modified_unix_sec") * 1000 - ).format(constants.DATE_FORMAT)}`}) + ).format(constants.DATE_FORMAT)}`} + )

); diff --git a/gdbgui/src/js/GdbApi.jsx b/gdbgui/src/js/GdbApi.jsx index d7beb01d..f78dad5c 100644 --- a/gdbgui/src/js/GdbApi.jsx +++ b/gdbgui/src/js/GdbApi.jsx @@ -33,13 +33,10 @@ const GdbApi = { const TIMEOUT_MIN = 5; /* global io */ /* global initial_data */ - GdbApi.socket = io.connect( - `/gdb_listener`, - { - timeout: TIMEOUT_MIN * 60 * 1000, - query: `csrf_token=${initial_data.csrf_token}&gdbpid=${initial_data.gdbpid}` - } - ); + GdbApi.socket = io.connect(`/gdb_listener`, { + timeout: TIMEOUT_MIN * 60 * 1000, + query: `csrf_token=${initial_data.csrf_token}&gdbpid=${initial_data.gdbpid}` + }); GdbApi.socket.on("connect", function() { debug_print("connected"); diff --git a/gdbgui/src/js/GdbVariable.jsx b/gdbgui/src/js/GdbVariable.jsx index 0c9096c5..46fd6048 100644 --- a/gdbgui/src/js/GdbVariable.jsx +++ b/gdbgui/src/js/GdbVariable.jsx @@ -352,8 +352,7 @@ class GdbVariable extends React.Component { {_.trim(mi_obj.type) || ""}
- : - {tree} + :{tree} {plot_button} {delete_button}
diff --git a/gdbgui/src/js/Links.tsx b/gdbgui/src/js/Links.tsx index 110bac6f..d8505275 100644 --- a/gdbgui/src/js/Links.tsx +++ b/gdbgui/src/js/Links.tsx @@ -4,10 +4,10 @@ import CopyToClipboard from "./CopyToClipboard"; import MemoryLink from "./MemoryLink"; type Props = { - file?: string - fullname?: string - line: string - num_lines?: number + file?: string; + fullname?: string; + line: string; + num_lines?: number; }; export class FileLink extends React.Component { @@ -52,10 +52,10 @@ export class FileLink extends React.Component { } type FrameLinkProps = { - addr: string - file?: string - fullname?: string - line: string + addr: string; + file?: string; + fullname?: string; + line: string; }; export class FrameLink extends React.Component { diff --git a/gdbgui/src/js/MemoryLink.tsx b/gdbgui/src/js/MemoryLink.tsx index 18fd2bff..bac8e860 100644 --- a/gdbgui/src/js/MemoryLink.tsx +++ b/gdbgui/src/js/MemoryLink.tsx @@ -2,8 +2,8 @@ import * as React from "react"; import Memory from "./Memory.jsx"; type Props = { - addr: string - style?: React.CSSProperties + addr: string; + style?: React.CSSProperties; }; class MemoryLink extends React.Component { diff --git a/gdbgui/src/js/Settings.jsx b/gdbgui/src/js/Settings.jsx index 100e4eee..8bdcbb7b 100644 --- a/gdbgui/src/js/Settings.jsx +++ b/gdbgui/src/js/Settings.jsx @@ -108,7 +108,9 @@ class Settings extends React.Component { localStorage.setItem("theme", e.currentTarget.value); }} > - {store.get("themes").map(t => )} + {store.get("themes").map(t => ( + + ))} diff --git a/gdbgui/src/js/TopBar.jsx b/gdbgui/src/js/TopBar.jsx index 21175742..cba6d54e 100644 --- a/gdbgui/src/js/TopBar.jsx +++ b/gdbgui/src/js/TopBar.jsx @@ -62,9 +62,7 @@ let About = { show_about: function() { Actions.show_modal( "About gdbgui", - - Copyright © Chad Smith, grassfedcode.com - + Copyright © Chad Smith, grassfedcode.com ); } }; diff --git a/gdbgui/src/js/constants.js b/gdbgui/src/js/constants.js index 30e59e6c..281e28af 100644 --- a/gdbgui/src/js/constants.js +++ b/gdbgui/src/js/constants.js @@ -21,7 +21,7 @@ let constants = { BACKTRACE_LINK: "BACKTRACE_LINK", GDBGUI_OUTPUT: "GDBGUI_OUTPUT", GDBGUI_OUTPUT_RAW: "GDBGUI_OUTPUT_RAW", - AUTOCOMPLETE_OPTION: "AUTOCOMPLETE_OPTION", + AUTOCOMPLETE_OPTION: "AUTOCOMPLETE_OPTION" }, source_code_selection_states: { diff --git a/gdbgui/src/js/tests/Util.jest.js b/gdbgui/src/js/tests/Util.jest.js index 7a6b2263..804f78b1 100644 --- a/gdbgui/src/js/tests/Util.jest.js +++ b/gdbgui/src/js/tests/Util.jest.js @@ -1,27 +1,27 @@ -import Util from '../Util.js'; +import Util from "../Util.js"; /* eslint-env jest */ -test('parses spaces', ()=>{ - const fn = Util.string_to_array_safe_quotes - expect(fn('hi')).toEqual(['hi']) - expect(fn('"hi bye"')).toEqual(['"hi bye"']) - expect(fn('hi bye')).toEqual(['hi', 'bye']) - expect(fn('hi bye "1 2, 3" asdf\n\t' )).toEqual(['hi', 'bye', '"1 2, 3"', 'asdf\n\t']) - expect(fn('"hi bye" "1 2, 3" asdf\n\t' )).toEqual(['"hi bye"', '"1 2, 3"', 'asdf\n\t']) -}) +test("parses spaces", () => { + const fn = Util.string_to_array_safe_quotes; + expect(fn("hi")).toEqual(["hi"]); + expect(fn('"hi bye"')).toEqual(['"hi bye"']); + expect(fn("hi bye")).toEqual(["hi", "bye"]); + expect(fn('hi bye "1 2, 3" asdf\n\t')).toEqual(["hi", "bye", '"1 2, 3"', "asdf\n\t"]); + expect(fn('"hi bye" "1 2, 3" asdf\n\t')).toEqual(['"hi bye"', '"1 2, 3"', "asdf\n\t"]); +}); -test('dot version comparison', ()=>{ - expect(Util.is_newer('1.0.0', '1.0.0')).toEqual(false) - expect(Util.is_newer('1.0.0', '0.9.9')).toEqual(true) - expect(Util.is_newer('0.1.0', '0.0.9')).toEqual(true) - expect(Util.is_newer('0.0.8', '0.0.9')).toEqual(false) - expect(Util.is_newer('0.11.3.1', '0.11.3.0')).toEqual(true) - expect(Util.is_newer('0.11.4.0', '0.11.3.0')).toEqual(true) - expect(Util.is_newer('0.11.4.0\n', '0.11.3.0')).toEqual(true) - expect(Util.is_newer('0.11.3.0', '0.11.3.0\n')).toEqual(false) - expect(Util.is_newer('0.11.3.0', '0.11.4.0\n')).toEqual(false) - expect(Util.is_newer('0.12.0.0', '0.11.4.0\n')).toEqual(true) - expect(Util.is_newer('1.0.0', '0.11.4.0\n')).toEqual(true) - expect(Util.is_newer('1.0.1', '1.0.0')).toEqual(true) -}) +test("dot version comparison", () => { + expect(Util.is_newer("1.0.0", "1.0.0")).toEqual(false); + expect(Util.is_newer("1.0.0", "0.9.9")).toEqual(true); + expect(Util.is_newer("0.1.0", "0.0.9")).toEqual(true); + expect(Util.is_newer("0.0.8", "0.0.9")).toEqual(false); + expect(Util.is_newer("0.11.3.1", "0.11.3.0")).toEqual(true); + expect(Util.is_newer("0.11.4.0", "0.11.3.0")).toEqual(true); + expect(Util.is_newer("0.11.4.0\n", "0.11.3.0")).toEqual(true); + expect(Util.is_newer("0.11.3.0", "0.11.3.0\n")).toEqual(false); + expect(Util.is_newer("0.11.3.0", "0.11.4.0\n")).toEqual(false); + expect(Util.is_newer("0.12.0.0", "0.11.4.0\n")).toEqual(true); + expect(Util.is_newer("1.0.0", "0.11.4.0\n")).toEqual(true); + expect(Util.is_newer("1.0.1", "1.0.0")).toEqual(true); +}); diff --git a/gdbgui/src/js/types.d.ts b/gdbgui/src/js/types.d.ts index e37e4de6..c1425b78 100644 --- a/gdbgui/src/js/types.d.ts +++ b/gdbgui/src/js/types.d.ts @@ -1,5 +1,5 @@ -declare module 'statorgfc' { +declare module "statorgfc" { export let store: { - get(key: string): any - } -} \ No newline at end of file + get(key: string): any; + }; +} diff --git a/noxfile.py b/noxfile.py index 88402c9c..602f6902 100644 --- a/noxfile.py +++ b/noxfile.py @@ -21,6 +21,15 @@ def tests(session): @nox.session(python="3.7") def lint(session): + session.run( + "npx", + "prettier", + "--check", + "--config", + ".prettierrc.js", + "gdbgui/src/js/**/*", + external=True, + ) session.install(*lint_dependencies) files = ["gdbgui", "tests"] + [str(p) for p in Path(".").glob("*.py")] session.run("black", "--check", *files)