From 47cbeb576e22f11bb834265d67fae97e789e1416 Mon Sep 17 00:00:00 2001 From: Danielle Whyte Date: Mon, 16 Oct 2023 12:34:26 -0500 Subject: [PATCH] fix lint --- .../server-item-renderer.stories.tsx | 24 ++- .../__testdata__/item-renderer.testdata.ts | 171 +++++++++--------- packages/perseus/src/renderer.tsx | 8 +- packages/perseus/src/server-item-renderer.tsx | 30 +-- 4 files changed, 130 insertions(+), 103 deletions(-) diff --git a/packages/perseus/src/__stories__/server-item-renderer.stories.tsx b/packages/perseus/src/__stories__/server-item-renderer.stories.tsx index 28bc19932c..8af3bab32e 100644 --- a/packages/perseus/src/__stories__/server-item-renderer.stories.tsx +++ b/packages/perseus/src/__stories__/server-item-renderer.stories.tsx @@ -29,10 +29,24 @@ export const SATPassageItem = (args: StoryArgs): React.ReactElement => { return ; }; -export const SATPassageItemLeftColumn = (args: StoryArgs): React.ReactElement => { - return ; +export const SATPassageItemLeftColumn = ( + args: StoryArgs, +): React.ReactElement => { + return ( + + ); }; -export const SATPassageItemRightColumn = (args: StoryArgs): React.ReactElement => { - return ; -}; \ No newline at end of file +export const SATPassageItemRightColumn = ( + args: StoryArgs, +): React.ReactElement => { + return ( + + ); +}; diff --git a/packages/perseus/src/__testdata__/item-renderer.testdata.ts b/packages/perseus/src/__testdata__/item-renderer.testdata.ts index 9b3371d642..2d0a171a51 100644 --- a/packages/perseus/src/__testdata__/item-renderer.testdata.ts +++ b/packages/perseus/src/__testdata__/item-renderer.testdata.ts @@ -299,107 +299,116 @@ export const mockedItem: PerseusItem = { }; export const satPassageItem: PerseusItem = { - "question": { - "content": ">Select text to highlight it. _(Laptop/desktop only)_\n\n>**This passage is excerpted from Louisa May Alcott, *Rose in Bloom*, originally published in 1876. **\n\n[[☃ passage 1]]\n\n=====\n\n[[☃ group 1]]", - "images": {}, - "widgets": { + question: { + content: + ">Select text to highlight it. _(Laptop/desktop only)_\n\n>**This passage is excerpted from Louisa May Alcott, *Rose in Bloom*, originally published in 1876. **\n\n[[☃ passage 1]]\n\n=====\n\n[[☃ group 1]]", + images: {}, + widgets: { "passage 1": { - "type": "passage", - "alignment": "default", - "static": false, - "graded": true, - "options": { - "static": false, - "passageTitle": "", - "passageText": "Three young men stood together on a wharf one bright October day awaiting the arrival of an ocean steamer with an impatience which found a {{vent}} in lively skirmishes with a small lad, who pervaded the premises like a will-o'-the-wisp and afforded much amusement to the other groups assembled there.\n\n{{\"{{They are the Campbells, waiting for their cousin, who has been abroad several years with her uncle, the doctor,\"}} whispered one lady to another as the handsomest of the young men touched his hat to her as he passed, lugging the boy, whom he had just rescued from a little expedition down among the piles.\n\n\"Which is that?\" asked the stranger.\n\n{{\"Prince Charlie, as he's called a fine fellow, the most promising of the seven, but a little fast, people say,\" }}answered the first speaker with a shake of the head.\n\"Are the others his brothers?\"\n\n\"No, cousins. {{The elder is Archie, a most exemplary young man. He has just gone into business with the merchant uncle and bids fair to be an honor to his family. }}The other, with the eyeglasses and no gloves, is Mac, the odd one, just out of college.\"\n\n\"And the boy?\"\n\n{{\"Oh, he is Jamie, the youngest brother of Archibald, and the pet of the whole family. Mercy on us he'll be in if they don't hold on to him}}!\"}}\n\nThe ladies' chat came to a sudden end just there, for by the time Jamie had been fished out of a hogshead, the steamer hove in sight and everything else was forgotten. As it swung slowly around to enter the dock, a boyish voice shouted, \"There she is! I see her and Uncle and Phebe! Hooray for Cousin Rose!\" And three small cheers were given with a will by Jamie as he stood on a post waving his arms like a windmill while his brother held onto the tail of his jacket.\n\nYes, there they were, Uncle Alec swinging his hat like a boy, with Phebe smiling and nodding on one side and Rose kissing both hands delightedly on the other as she recognized familiar faces and heard familiar voices welcoming her home.\n\n\"Bless her dear heart, she's bonnier than ever! Looks like a Madonna doesn't she? with that blue cloak round her, and her bright hair flying in the wind!\" said Charlie excitedly as they watched the group upon the deck with eager eyes.\n\n{{\"Madonnas don't wear hats like that. Rose hasn't changed much, but Phebe has. Why, she's a regular beauty!\"}} answered Archie, staring with all his might at the dark-eyed young woman with the brilliant color and glossy black braids shining in the sun.\n\n{{\"Dear old Uncle! Doesn't it seem good to have him back?\"}}{{ was all Mac said, but he was not looking at \"dear old uncle\" as he made the fervent remark, for he saw only the slender blond girl nearby and stretched out his hands to meet hers, forgetful of the green water tumbling between them.}}\n\nDuring the confusion that reigned for a moment as the steamer settled to her moorings, Rose looked down into the four faces upturned to hers and seemed to read in them something that both pleased and pained her. {{It was only a glance, and her own eyes were full, but through the mist of happy tears she received the impression that Archie was about the same, that Mac had decidedly improved, and that something was amiss with Charlie.}} {{ There was no time for observation, however, for in a moment the shoreward rush began, and before she could grasp her traveling bag, Jamie was clinging to her like an ecstatic young bear.}} {{ She was with difficulty released from his embrace to fall into the gentler ones of the elder cousins, who took advantage of the general excitement to welcome both blooming girls with {{affectionate impartiality}}. }}Then the wanderers were borne ashore in a triumphal procession, while Jamie danced rapturous jigs before them even on the gangway.\n\nArchie remained to help his uncle get the luggage through the Custom House, and the others escorted the damsels home. {{No sooner were they shut up in a carriage, however, than a new and curious constraint seemed to fall upon the young people, for they realized, all at once, that their former playmates were men and women now.}}", - "footnotes": "", - "showLineNumbers": true + type: "passage", + alignment: "default", + static: false, + graded: true, + options: { + static: false, + passageTitle: "", + passageText: + 'Three young men stood together on a wharf one bright October day awaiting the arrival of an ocean steamer with an impatience which found a {{vent}} in lively skirmishes with a small lad, who pervaded the premises like a will-o\'-the-wisp and afforded much amusement to the other groups assembled there.\n\n{{"{{They are the Campbells, waiting for their cousin, who has been abroad several years with her uncle, the doctor,"}} whispered one lady to another as the handsomest of the young men touched his hat to her as he passed, lugging the boy, whom he had just rescued from a little expedition down among the piles.\n\n"Which is that?" asked the stranger.\n\n{{"Prince Charlie, as he\'s called a fine fellow, the most promising of the seven, but a little fast, people say," }}answered the first speaker with a shake of the head.\n"Are the others his brothers?"\n\n"No, cousins. {{The elder is Archie, a most exemplary young man. He has just gone into business with the merchant uncle and bids fair to be an honor to his family. }}The other, with the eyeglasses and no gloves, is Mac, the odd one, just out of college."\n\n"And the boy?"\n\n{{"Oh, he is Jamie, the youngest brother of Archibald, and the pet of the whole family. Mercy on us he\'ll be in if they don\'t hold on to him}}!"}}\n\nThe ladies\' chat came to a sudden end just there, for by the time Jamie had been fished out of a hogshead, the steamer hove in sight and everything else was forgotten. As it swung slowly around to enter the dock, a boyish voice shouted, "There she is! I see her and Uncle and Phebe! Hooray for Cousin Rose!" And three small cheers were given with a will by Jamie as he stood on a post waving his arms like a windmill while his brother held onto the tail of his jacket.\n\nYes, there they were, Uncle Alec swinging his hat like a boy, with Phebe smiling and nodding on one side and Rose kissing both hands delightedly on the other as she recognized familiar faces and heard familiar voices welcoming her home.\n\n"Bless her dear heart, she\'s bonnier than ever! Looks like a Madonna doesn\'t she? with that blue cloak round her, and her bright hair flying in the wind!" said Charlie excitedly as they watched the group upon the deck with eager eyes.\n\n{{"Madonnas don\'t wear hats like that. Rose hasn\'t changed much, but Phebe has. Why, she\'s a regular beauty!"}} answered Archie, staring with all his might at the dark-eyed young woman with the brilliant color and glossy black braids shining in the sun.\n\n{{"Dear old Uncle! Doesn\'t it seem good to have him back?"}}{{ was all Mac said, but he was not looking at "dear old uncle" as he made the fervent remark, for he saw only the slender blond girl nearby and stretched out his hands to meet hers, forgetful of the green water tumbling between them.}}\n\nDuring the confusion that reigned for a moment as the steamer settled to her moorings, Rose looked down into the four faces upturned to hers and seemed to read in them something that both pleased and pained her. {{It was only a glance, and her own eyes were full, but through the mist of happy tears she received the impression that Archie was about the same, that Mac had decidedly improved, and that something was amiss with Charlie.}} {{ There was no time for observation, however, for in a moment the shoreward rush began, and before she could grasp her traveling bag, Jamie was clinging to her like an ecstatic young bear.}} {{ She was with difficulty released from his embrace to fall into the gentler ones of the elder cousins, who took advantage of the general excitement to welcome both blooming girls with {{affectionate impartiality}}. }}Then the wanderers were borne ashore in a triumphal procession, while Jamie danced rapturous jigs before them even on the gangway.\n\nArchie remained to help his uncle get the luggage through the Custom House, and the others escorted the damsels home. {{No sooner were they shut up in a carriage, however, than a new and curious constraint seemed to fall upon the young people, for they realized, all at once, that their former playmates were men and women now.}}', + footnotes: "", + showLineNumbers: true, + }, + version: { + major: 0, + minor: 0, }, - "version": { - "major": 0, - "minor": 0 - } }, "group 1": { - "type": "group", - "alignment": "default", - "static": false, - "graded": true, - "options": { - "content": "Which choice best summarizes the passage?\n\n[[☃ radio 1]]", - "images": {}, - "widgets": { + type: "group", + alignment: "default", + static: false, + graded: true, + options: { + content: + "Which choice best summarizes the passage?\n\n[[☃ radio 1]]", + images: {}, + widgets: { "radio 1": { - "type": "radio", - "alignment": "default", - "static": false, - "graded": true, - "options": { - "choices": [ + type: "radio", + alignment: "default", + static: false, + graded: true, + options: { + choices: [ { - "content": "The passage provides an explanation of relationships within a family.\n", - "correct": false, - "clue": "Although the passage does discuss various members of the family, this isn't the main point of the passage." + content: + "The passage provides an explanation of relationships within a family.\n", + correct: false, + clue: "Although the passage does discuss various members of the family, this isn't the main point of the passage.", }, { - "content": "The passage presents a revelation about children growing older.\n", - "correct": true, - "clue": "This choice is the best answer. The passage describes the return of Rose and Phebe, and the changes that the young characters see in each other. In addition, the passage notes that the characters' \"former playmates were men and women now.\"" + content: + "The passage presents a revelation about children growing older.\n", + correct: true, + clue: 'This choice is the best answer. The passage describes the return of Rose and Phebe, and the changes that the young characters see in each other. In addition, the passage notes that the characters\' "former playmates were men and women now."', }, { - "content": "The passage captures a conversation regarding reuniting cousins.\n", - "correct": false, - "clue": "The passage does depict cousins reuniting; however, the focus of the brief dialogue is mostly the physical changes that the characters observe." + content: + "The passage captures a conversation regarding reuniting cousins.\n", + correct: false, + clue: "The passage does depict cousins reuniting; however, the focus of the brief dialogue is mostly the physical changes that the characters observe.", }, { - "content": "The passage describes an anecdote about traveling by ship.", - "correct": false, - "clue": "In the passage, the two young women are just returning from a journey by ship, but the passage does not depict the journey itself or relate an anecdote." - } + content: + "The passage describes an anecdote about traveling by ship.", + correct: false, + clue: "In the passage, the two young women are just returning from a journey by ship, but the passage does not depict the journey itself or relate an anecdote.", + }, ], - "randomize": false, - "multipleSelect": false, - "countChoices": false, - "displayCount": null, - "hasNoneOfTheAbove": false, - "deselectEnabled": false + randomize: false, + multipleSelect: false, + countChoices: false, + displayCount: null, + hasNoneOfTheAbove: false, + deselectEnabled: false, }, - "version": { - "major": 1, - "minor": 0 - } - } + version: { + major: 1, + minor: 0, + }, + }, }, - "metadata": [ + metadata: [ "ag5zfmtoYW4tYWNhZGVteXI2CxIRQXNzZXNzbWVudEl0ZW1UYWciATAMCxIRQXNzZXNzbWVudEl0ZW1UYWcYgICAoJ64pwoM", - "ag5zfmtoYW4tYWNhZGVteXI2CxIRQXNzZXNzbWVudEl0ZW1UYWciATAMCxIRQXNzZXNzbWVudEl0ZW1UYWcYgICAoO7zqwoM" - ] + "ag5zfmtoYW4tYWNhZGVteXI2CxIRQXNzZXNzbWVudEl0ZW1UYWciATAMCxIRQXNzZXNzbWVudEl0ZW1UYWcYgICAoO7zqwoM", + ], + }, + version: { + major: 0, + minor: 0, }, - "version": { - "major": 0, - "minor": 0 - } }, - } + }, }, - "answerArea": { - "calculator": false, - "chi2Table": false, - "periodicTable": false, - "tTable": false, - "zTable": false + answerArea: { + calculator: false, + chi2Table: false, + periodicTable: false, + tTable: false, + zTable: false, }, - "itemDataVersion": { - "major": 0, - "minor": 1 + itemDataVersion: { + major: 0, + minor: 1, }, - "hints": [{ - content: - "Consider the return of Rose and Phebe, and the changes that the young characters see in each other.", - images: {}, - replace: false, - widgets: {}, - }], + hints: [ + { + content: + "Consider the return of Rose and Phebe, and the changes that the young characters see in each other.", + images: {}, + replace: false, + widgets: {}, + }, + ], _multi: null, answer: null, -}; \ No newline at end of file +}; diff --git a/packages/perseus/src/renderer.tsx b/packages/perseus/src/renderer.tsx index fbf5308b01..62b82dd442 100644 --- a/packages/perseus/src/renderer.tsx +++ b/packages/perseus/src/renderer.tsx @@ -1330,13 +1330,17 @@ class Renderer extends React.Component { // things like this this._isTwoColumn = true; // but then render normally: - let columnsState = { + const columnsState = { ...state, renderColumn: this.getApiOptions().renderColumn, }; return ( - {PerseusMarkdown.ruleOutput(node, nestedOutput, columnsState)} + {PerseusMarkdown.ruleOutput( + node, + nestedOutput, + columnsState, + )} ); } diff --git a/packages/perseus/src/server-item-renderer.tsx b/packages/perseus/src/server-item-renderer.tsx index 201869f2f1..6c9c3e8915 100644 --- a/packages/perseus/src/server-item-renderer.tsx +++ b/packages/perseus/src/server-item-renderer.tsx @@ -433,21 +433,21 @@ export class ServerItemRenderer
{questionRenderer}
- {apiOptions.renderColumn !== "left" && -
- {hintsRenderer} -
- } + {apiOptions.renderColumn !== "left" && ( +
+ {hintsRenderer} +
+ )}
);