diff --git a/.eslintrc.js b/.eslintrc.js index c0284d22..13d10867 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -34,10 +34,8 @@ module.exports = { varsIgnorePattern: '^log$' } ], - // TODO: Remove any usage and enable - '@typescript-eslint/no-explicit-any': 'off', - // TODO: Fix errors and enable this rule - '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-non-null-assertion': 'warn', // solid-js fix 'import/no-unresolved': [2, { ignore: ['solid-js/'] }] @@ -58,8 +56,8 @@ module.exports = { // FIXME 'solid/reactivity': 'off', - // TODO: Should be enabled - 'promise/catch-or-return': 'off', + // Should be enabled + // 'promise/catch-or-return': 'off', 'solid/no-innerhtml': 'off', @@ -77,7 +75,8 @@ module.exports = { eqeqeq: 'error', 'no-param-reassign': 'error', - 'no-nested-ternary': 'error' + 'no-nested-ternary': 'error', + 'no-shadow': 'error' }, settings: { 'import/resolver': { diff --git a/package.json b/package.json index 45607736..c1707089 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "@nanostores/persistent": "^0.7.0", "@nanostores/router": "^0.7.0", "@nanostores/solid": "^0.3.0", + "@solid-primitives/memo": "^1.0.2", "axios": "^0.27.2", "google-translate-api-x": "^10.4.1", "loglevel": "^1.8.0", diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx index 317acc88..094d957e 100644 --- a/src/components/Article/FullArticle.tsx +++ b/src/components/Article/FullArticle.tsx @@ -7,8 +7,7 @@ import { createEffect, createMemo, createSignal, For, onMount, Show } from 'soli import type { Author, Reaction, Shout } from '../../graphql/types.gen' import { t } from '../../utils/intl' import { showModal } from '../../stores/ui' -import { useStore } from '@nanostores/solid' -import { session } from '../../stores/auth' +import { useAuthStore } from '../../stores/auth' import { incrementView } from '../../stores/zine/articles' import { renderMarkdown } from '@astrojs/markdown-remark' import { markdownOptions } from '../../../mdx.config' @@ -41,7 +40,7 @@ const formatDate = (date: Date) => { export const FullArticle = (props: ArticleProps) => { const [body, setBody] = createSignal(props.article.body?.startsWith('<') ? props.article.body : '') - const auth = useStore(session) + const { session } = useAuthStore() createEffect(() => { if (body() || !props.article.body) { @@ -51,7 +50,9 @@ export const FullArticle = (props: ArticleProps) => { if (props.article.body.startsWith('<')) { setBody(props.article.body) } else { - renderMarkdown(props.article.body, markdownOptions).then(({ code }) => setBody(code)) + renderMarkdown(props.article.body, markdownOptions) + .then(({ code }) => setBody(code)) + .catch(console.error) } }) @@ -180,12 +181,12 @@ export const FullArticle = (props: ArticleProps) => { )} - +
{t('To leave a comment you please')} {
- +