Update lint rules
This commit is contained in:
@@ -6,9 +6,9 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { Palette } from '@vibrant/color';
|
||||
import { FastAverageColorResult } from 'fast-average-color';
|
||||
import { AppTheme, AppThemes } from '@/features/theme/services/AppThemes.ts';
|
||||
import type { Palette } from '@vibrant/color';
|
||||
import type { FastAverageColorResult } from 'fast-average-color';
|
||||
import type { AppTheme, AppThemes } from '@/features/theme/services/AppThemes.ts';
|
||||
|
||||
export enum ThemeMode {
|
||||
SYSTEM = 'system',
|
||||
|
||||
@@ -6,11 +6,14 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import React, { ReactNode, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Direction, ThemeProvider } from '@mui/material/styles';
|
||||
import type { ReactNode } from 'react';
|
||||
import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
||||
import type { Direction } from '@mui/material/styles';
|
||||
import { ThemeProvider } from '@mui/material/styles';
|
||||
import { CacheProvider } from '@emotion/react';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { AppTheme, getTheme } from '@/features/theme/services/AppThemes.ts';
|
||||
import type { AppTheme } from '@/features/theme/services/AppThemes.ts';
|
||||
import { getTheme } from '@/features/theme/services/AppThemes.ts';
|
||||
import {
|
||||
createUpdateMetadataServerSettings,
|
||||
useMetadataServerSettings,
|
||||
@@ -23,7 +26,8 @@ import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
||||
import { createAndSetTheme } from '@/features/theme/services/ThemeCreator.ts';
|
||||
import { AppStorage } from '@/lib/storage/AppStorage.ts';
|
||||
import { DIRECTION_TO_CACHE } from '@/features/theme/ThemeDirectionCache.ts';
|
||||
import { TAppThemeContext, ThemeMode } from '@/features/theme/AppTheme.types.ts';
|
||||
import type { TAppThemeContext } from '@/features/theme/AppTheme.types.ts';
|
||||
import { ThemeMode } from '@/features/theme/AppTheme.types.ts';
|
||||
import { getLanguageReadingDirection } from '@/lib/ISOLanguageUtil.ts';
|
||||
import { loadCatalog } from '@/i18n';
|
||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { Direction } from '@mui/material/styles';
|
||||
import { EmotionCache } from '@emotion/react';
|
||||
import type { Direction } from '@mui/material/styles';
|
||||
import type { EmotionCache } from '@emotion/react';
|
||||
import createCache from '@emotion/cache';
|
||||
import { prefixer } from 'stylis';
|
||||
import rtlPlugin from 'stylis-plugin-rtl';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { CssVarsThemeOptions } from '@mui/material/styles';
|
||||
import type { CssVarsThemeOptions } from '@mui/material/styles';
|
||||
import { t } from '@lingui/core/macro';
|
||||
|
||||
export type TBaseTheme = {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { MessageDescriptor } from '@lingui/core';
|
||||
import type { MessageDescriptor } from '@lingui/core';
|
||||
import { useMemo, useState } from 'react';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import Stack from '@mui/material/Stack';
|
||||
@@ -18,11 +18,12 @@ import DialogActions from '@mui/material/DialogActions';
|
||||
import TextField from '@mui/material/TextField';
|
||||
import Link from '@mui/material/Link';
|
||||
import { jsonrepair } from 'jsonrepair';
|
||||
import { AwaitableComponentProps } from 'awaitable-component';
|
||||
import type { AwaitableComponentProps } from 'awaitable-component';
|
||||
import { Trans, useLingui } from '@lingui/react/macro';
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { getErrorMessage, jsonSaveParse } from '@/lib/HelperFunctions.ts';
|
||||
import { AppTheme, getTheme, isThemeNameUnique } from '@/features/theme/services/AppThemes.ts';
|
||||
import type { AppTheme } from '@/features/theme/services/AppThemes.ts';
|
||||
import { getTheme, isThemeNameUnique } from '@/features/theme/services/AppThemes.ts';
|
||||
import {
|
||||
createUpdateMetadataServerSettings,
|
||||
useMetadataServerSettings,
|
||||
@@ -31,7 +32,7 @@ import { makeToast } from '@/base/utils/Toast.ts';
|
||||
import { EmptyView } from '@/base/components/feedback/EmptyView.tsx';
|
||||
import { LoadingPlaceholder } from '@/base/components/feedback/LoadingPlaceholder.tsx';
|
||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||
import { MetadataThemeSettings } from '@/features/theme/AppTheme.types.ts';
|
||||
import type { MetadataThemeSettings } from '@/features/theme/AppTheme.types.ts';
|
||||
import { CheckboxInput } from '@/base/components/inputs/CheckboxInput.tsx';
|
||||
import { useAppThemeContext } from '@/features/theme/AppThemeContext.tsx';
|
||||
import { createAppColorTheme } from '@/features/theme/services/ThemeCreator.ts';
|
||||
|
||||
@@ -20,7 +20,7 @@ import { LoadingPlaceholder } from '@/base/components/feedback/LoadingPlaceholde
|
||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||
import { CreateThemeButton } from '@/features/theme/components/CreateThemeButton.tsx';
|
||||
import { ThemePreview } from '@/features/theme/components/ThemePreview.tsx';
|
||||
import { MetadataThemeSettings } from '@/features/theme/AppTheme.types.ts';
|
||||
import type { MetadataThemeSettings } from '@/features/theme/AppTheme.types.ts';
|
||||
import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
||||
|
||||
export const ThemeList = () => {
|
||||
|
||||
@@ -21,7 +21,7 @@ import Paper from '@mui/material/Paper';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { CustomTooltip } from '@/base/components/CustomTooltip.tsx';
|
||||
import { useAppThemeContext } from '@/features/theme/AppThemeContext.tsx';
|
||||
import { AppTheme } from '@/features/theme/services/AppThemes.ts';
|
||||
import type { AppTheme } from '@/features/theme/services/AppThemes.ts';
|
||||
import { createTheme } from '@/features/theme/services/ThemeCreator.ts';
|
||||
import { ThemeCreationDialog } from '@/features/theme/components/CreateThemeDialog.tsx';
|
||||
import { makeToast } from '@/base/utils/Toast.ts';
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { TBaseTheme, themes } from '@/features/theme/Themes.ts';
|
||||
import type { TBaseTheme } from '@/features/theme/Themes.ts';
|
||||
import { themes } from '@/features/theme/Themes.ts';
|
||||
|
||||
export type AppThemes = keyof typeof themes | string;
|
||||
|
||||
|
||||
@@ -6,24 +6,18 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import {
|
||||
createTheme as createMuiTheme,
|
||||
Direction,
|
||||
PaletteBackgroundChannel,
|
||||
responsiveFontSizes,
|
||||
Theme,
|
||||
TypeBackground,
|
||||
useTheme,
|
||||
} from '@mui/material/styles';
|
||||
import type { Direction, PaletteBackgroundChannel, Theme, TypeBackground } from '@mui/material/styles';
|
||||
import { createTheme as createMuiTheme, responsiveFontSizes, useTheme } from '@mui/material/styles';
|
||||
import { useCallback } from 'react';
|
||||
// oxlint-disable-next-line no-restricted-imports
|
||||
import { deepmerge } from '@mui/utils';
|
||||
import { complement, hsl, parseToHsl } from 'polished';
|
||||
import { HslaColor, HslColor } from 'polished/lib/types/color';
|
||||
import { AppTheme } from '@/features/theme/services/AppThemes.ts';
|
||||
import type { HslaColor, HslColor } from 'polished/lib/types/color';
|
||||
import type { AppTheme } from '@/features/theme/services/AppThemes.ts';
|
||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||
import { applyStyles } from '@/base/utils/ApplyStyles.ts';
|
||||
import { TAppThemeContext, ThemeMode } from '@/features/theme/AppTheme.types.ts';
|
||||
import type { TAppThemeContext } from '@/features/theme/AppTheme.types.ts';
|
||||
import { ThemeMode } from '@/features/theme/AppTheme.types.ts';
|
||||
import { ThemeFontLoader } from '@/features/theme/services/ThemeFontLoader.ts';
|
||||
import { coerceIn } from '@/lib/HelperFunctions.ts';
|
||||
import { MediaQuery } from '@/base/utils/MediaQuery.tsx';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import WebFont from 'webfontloader';
|
||||
import { CssVarsThemeOptions } from '@mui/material/styles';
|
||||
import type { CssVarsThemeOptions } from '@mui/material/styles';
|
||||
import { ControlledPromise } from '@/lib/ControlledPromise.ts';
|
||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||
|
||||
@@ -36,11 +36,15 @@ export class ThemeFontLoader {
|
||||
}
|
||||
|
||||
private static parseWeight(value: any): number | null {
|
||||
if (typeof value === 'number') return value;
|
||||
if (typeof value === 'number') {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (typeof value === 'string') {
|
||||
const parsed = Number(value);
|
||||
if (!Number.isNaN(parsed)) return parsed;
|
||||
if (!Number.isNaN(parsed)) {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
// Handle CSS keywords
|
||||
switch (value.toLowerCase()) {
|
||||
@@ -79,7 +83,7 @@ export class ThemeFontLoader {
|
||||
const isValidFontProperty = propertyName === 'fontFamily' && propertyType === 'string';
|
||||
if (isValidFontProperty) {
|
||||
const detectedFonts = propertyValue.split(',') as string[];
|
||||
const normalizedFonts = detectedFonts.map((detectedFont) => detectedFont.replace(/"/g, '').trim());
|
||||
const normalizedFonts = detectedFonts.map((detectedFont) => detectedFont.replaceAll('"', '').trim());
|
||||
|
||||
const weights = this.extractWeights(obj);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user