Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new-log-viewer: Fix lint errors introduced in #59. #70

Merged
merged 4 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading