Skip to content

Commit

Permalink
new-log-viewer: Fix lint errors introduced in #59. (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
junhaoliao authored Sep 12, 2024
1 parent cfa9274 commit 2f653eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion new-log-viewer/src/components/MenuBar/PageNumInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const PageNumInput = () => {
return;
}
inputRef.current.style.width = "0";
inputRef.current.style.width = `${inputRef.current.scrollWidth + PAGE_NUM_INPUT_FIT_EXTRA_WIDTH}px`;
inputRef.current.style.width =
`${inputRef.current.scrollWidth + PAGE_NUM_INPUT_FIT_EXTRA_WIDTH}px`;
};

const handleInputChange = () => {
Expand Down
9 changes: 6 additions & 3 deletions new-log-viewer/src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const CONFIG_DEFAULT: ConfigMap = Object.freeze({
* @param props.key
* @param props.value
* @return `null` if the value is valid, or an error message otherwise.
* @throws {Error} If the config item cannot be managed by these config utilities.
*/
const testConfig = ({key, value}: ConfigUpdate): Nullable<string> => {
let result = null;
Expand All @@ -41,7 +42,7 @@ const testConfig = ({key, value}: ConfigUpdate): Nullable<string> => {
}
break;
case CONFIG_KEY.THEME:
throw new Error(`${key} should be handled by JoyUI instead.`);
throw new Error(`"${key}" cannot be managed using these utilities.`);
case CONFIG_KEY.PAGE_SIZE:
if (0 >= value || MAX_PAGE_SIZE < value) {
result = `Page size must be greater than 0 and less than ${MAX_PAGE_SIZE + 1}.`;
Expand All @@ -61,6 +62,7 @@ const testConfig = ({key, value}: ConfigUpdate): Nullable<string> => {
* @param props.key
* @param props.value
* @return `null` if the update succeeds, or an error message otherwise.
* @throws {Error} If the config item cannot be managed by these config utilities.
*/
const setConfig = ({key, value}: ConfigUpdate): Nullable<string> => {
const error = testConfig({key, value} as ConfigUpdate);
Expand All @@ -86,7 +88,7 @@ const setConfig = ({key, value}: ConfigUpdate): Nullable<string> => {
);
break;
case CONFIG_KEY.THEME:
throw new Error(`${key} should be handled by JoyUI instead.`);
throw new Error(`"${key}" cannot be managed using these utilities.`);
case CONFIG_KEY.PAGE_SIZE:
window.localStorage.setItem(LOCAL_STORAGE_KEY.PAGE_SIZE, value.toString());
break;
Expand All @@ -101,6 +103,7 @@ const setConfig = ({key, value}: ConfigUpdate): Nullable<string> => {
*
* @param key
* @return The value.
* @throws {Error} If the config item cannot be managed by these config utilities.
*/
const getConfig = <T extends CONFIG_KEY>(key: T): ConfigMap[T] => {
let value = null;
Expand All @@ -121,7 +124,7 @@ const getConfig = <T extends CONFIG_KEY>(key: T): ConfigMap[T] => {
} as DecoderOptionsType;
break;
case CONFIG_KEY.THEME:
throw new Error(`${key} should be handled by JoyUI instead.`);
throw new Error(`"${key}" cannot be managed using these utilities.`);
case CONFIG_KEY.PAGE_SIZE:
value = window.localStorage.getItem(LOCAL_STORAGE_KEY.PAGE_SIZE);
break;
Expand Down

0 comments on commit 2f653eb

Please sign in to comment.