linted
This commit is contained in:
parent
e88363e450
commit
fdc721ebd0
|
@ -1,6 +1,7 @@
|
|||
node_modules
|
||||
public
|
||||
*.cjs
|
||||
src/graphql/schema/*.gen.ts
|
||||
dist/
|
||||
.vercel/
|
||||
src/graphql/client/*
|
||||
src/graphql/schema/*
|
||||
|
|
150
.eslintrc.cjs
150
.eslintrc.cjs
|
@ -1,106 +1,108 @@
|
|||
module.exports = {
|
||||
plugins: ["@typescript-eslint", "import", "sonarjs", "unicorn", "promise", "solid", "jest"],
|
||||
plugins: ['@typescript-eslint', 'import', 'sonarjs', 'unicorn', 'promise', 'solid', 'jest'],
|
||||
extends: [
|
||||
"eslint:recommended",
|
||||
"plugin:import/recommended",
|
||||
"plugin:import/typescript",
|
||||
"prettier",
|
||||
"plugin:sonarjs/recommended",
|
||||
"plugin:unicorn/recommended",
|
||||
"plugin:promise/recommended",
|
||||
"plugin:solid/recommended",
|
||||
"plugin:jest/recommended"
|
||||
'eslint:recommended',
|
||||
'plugin:import/recommended',
|
||||
'plugin:import/typescript',
|
||||
'prettier',
|
||||
'plugin:sonarjs/recommended',
|
||||
'plugin:unicorn/recommended',
|
||||
'plugin:promise/recommended',
|
||||
'plugin:solid/recommended',
|
||||
'plugin:jest/recommended',
|
||||
],
|
||||
overrides: [
|
||||
{
|
||||
files: ["**/*.ts", "**/*.tsx"],
|
||||
parser: "@typescript-eslint/parser",
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 2021,
|
||||
ecmaFeatures: { jsx: true },
|
||||
sourceType: "module",
|
||||
project: "./tsconfig.json"
|
||||
sourceType: 'module',
|
||||
project: './tsconfig.json',
|
||||
},
|
||||
extends: [
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
// Maybe one day...
|
||||
// 'plugin:@typescript-eslint/recommended-requiring-type-checking'
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
// 'plugin:@typescript-eslint/recommended-requiring-type-checking', // 23-01-2024 896 problems
|
||||
],
|
||||
rules: {
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'warn',
|
||||
{
|
||||
argsIgnorePattern: "^_"
|
||||
}
|
||||
argsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-non-null-assertion": "error",
|
||||
// TODO: Remove any usage and enable
|
||||
"@typescript-eslint/no-explicit-any": "off"
|
||||
}
|
||||
}
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'warn',
|
||||
},
|
||||
},
|
||||
],
|
||||
env: {
|
||||
browser: true,
|
||||
node: true,
|
||||
mocha: true
|
||||
mocha: true,
|
||||
},
|
||||
globals: {},
|
||||
rules: {
|
||||
// Solid
|
||||
"solid/reactivity": "off", // FIXME
|
||||
"solid/no-innerhtml": "off",
|
||||
'solid/reactivity': 'off', // too many 'should be used within JSX'
|
||||
'solid/no-innerhtml': 'off',
|
||||
|
||||
/** Unicorn **/
|
||||
"unicorn/no-null": "off",
|
||||
"unicorn/filename-case": "off",
|
||||
"unicorn/no-array-for-each": "off",
|
||||
"unicorn/no-array-reduce": "off",
|
||||
"unicorn/prefer-string-replace-all": "warn",
|
||||
"unicorn/prevent-abbreviations": "off",
|
||||
"unicorn/prefer-module": "off",
|
||||
"unicorn/import-style": "off",
|
||||
"unicorn/numeric-separators-style": "off",
|
||||
"unicorn/prefer-node-protocol": "off",
|
||||
"unicorn/prefer-dom-node-append": "off", // FIXME
|
||||
"unicorn/prefer-top-level-await": "warn",
|
||||
"unicorn/consistent-function-scoping": "warn",
|
||||
"unicorn/no-array-callback-reference": "warn",
|
||||
"unicorn/no-array-method-this-argument": "warn",
|
||||
"unicorn/no-for-loop": "off",
|
||||
'unicorn/no-null': 'off',
|
||||
'unicorn/filename-case': 'off',
|
||||
'unicorn/no-array-for-each': 'off',
|
||||
'unicorn/no-array-reduce': 'off',
|
||||
'unicorn/prefer-string-replace-all': 'warn',
|
||||
'unicorn/prevent-abbreviations': 'off',
|
||||
'unicorn/prefer-module': 'off',
|
||||
'unicorn/import-style': 'off',
|
||||
'unicorn/numeric-separators-style': 'off',
|
||||
'unicorn/prefer-node-protocol': 'off',
|
||||
'unicorn/prefer-dom-node-append': 'off', // FIXME
|
||||
'unicorn/prefer-top-level-await': 'warn',
|
||||
'unicorn/consistent-function-scoping': 'warn',
|
||||
'unicorn/no-array-callback-reference': 'warn',
|
||||
'unicorn/no-array-method-this-argument': 'warn',
|
||||
'unicorn/no-for-loop': 'off',
|
||||
|
||||
"sonarjs/no-duplicate-string": ["warn", { threshold: 5 }],
|
||||
'sonarjs/no-duplicate-string': ['warn', { threshold: 5 }],
|
||||
'sonarjs/prefer-immediate-return': 'warn',
|
||||
|
||||
// Promise
|
||||
// 'promise/catch-or-return': 'off', // Should be enabled
|
||||
"promise/always-return": "off",
|
||||
'promise/catch-or-return': 'off',
|
||||
'promise/always-return': 'off',
|
||||
|
||||
eqeqeq: "error",
|
||||
"no-param-reassign": "error",
|
||||
"no-nested-ternary": "error",
|
||||
"no-shadow": "error",
|
||||
eqeqeq: 'error',
|
||||
'no-param-reassign': 'error',
|
||||
'no-nested-ternary': 'error',
|
||||
'no-shadow': 'error',
|
||||
|
||||
"import/order": ["warn", {
|
||||
groups: ["type", "builtin", "external", "internal", "parent", "sibling", "index"],
|
||||
distinctGroup: false,
|
||||
pathGroups: [
|
||||
{
|
||||
pattern: "*.scss",
|
||||
patternOptions: { matchBase: true },
|
||||
group: "index",
|
||||
position: "after"
|
||||
}
|
||||
],
|
||||
"newlines-between": "always",
|
||||
alphabetize: {
|
||||
order: "asc",
|
||||
caseInsensitive: true
|
||||
}
|
||||
}]
|
||||
'import/order': [
|
||||
'warn',
|
||||
{
|
||||
groups: ['type', 'builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
||||
distinctGroup: false,
|
||||
pathGroups: [
|
||||
{
|
||||
pattern: '*.scss',
|
||||
patternOptions: { matchBase: true },
|
||||
group: 'index',
|
||||
position: 'after',
|
||||
},
|
||||
],
|
||||
'newlines-between': 'always',
|
||||
alphabetize: {
|
||||
order: 'asc',
|
||||
caseInsensitive: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
settings: {
|
||||
"import/resolver": {
|
||||
'import/resolver': {
|
||||
typescript: true,
|
||||
node: true
|
||||
}
|
||||
}
|
||||
};
|
||||
node: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
"stylelint-scss"
|
||||
],
|
||||
"rules": {
|
||||
"keyframes-name-pattern": null,
|
||||
"declaration-block-no-redundant-longhand-properties": null,
|
||||
"selector-class-pattern": null,
|
||||
"no-descending-specificity": null,
|
||||
"scss/function-no-unknown": null,
|
||||
|
|
|
@ -300,8 +300,8 @@ export const FullArticle = (props: Props) => {
|
|||
const originalWidth = iframe.getAttribute('width') || style.width.replace('px', '')
|
||||
const originalHeight = iframe.getAttribute('height') || style.height.replace('px', '')
|
||||
|
||||
const width = Number(originalWidth)
|
||||
const height = Number(originalHeight)
|
||||
const width: IframeSize['width'] = Number(originalWidth)
|
||||
const height: IframeSize['height'] = Number(originalHeight)
|
||||
|
||||
if (containerWidth < width) {
|
||||
const aspectRatio = width / height
|
||||
|
|
|
@ -12,11 +12,7 @@ type Props = {
|
|||
}
|
||||
|
||||
export const AuthGuard = (props: Props) => {
|
||||
const {
|
||||
isAuthenticated,
|
||||
isSessionLoaded,
|
||||
actions: { loadSession },
|
||||
} = useSession()
|
||||
const { isAuthenticated, isSessionLoaded } = useSession()
|
||||
const { changeSearchParams } = useRouter<RootSearchParams & AuthModalSearchParams>()
|
||||
|
||||
createEffect(async () => {
|
||||
|
|
|
@ -30,9 +30,7 @@ export const Donate = () => {
|
|||
|
||||
const initiated = () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const {
|
||||
cp: { CloudPayments },
|
||||
} = window as any // Checkout(cpOptions)
|
||||
const CloudPayments = window['cp'] // Checkout(cpOptions)
|
||||
setWidget(new CloudPayments())
|
||||
console.log('[donate] payments initiated')
|
||||
setCustomerReciept({
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Node } from '@tiptap/core'
|
|||
export interface IframeOptions {
|
||||
allowFullscreen: boolean
|
||||
HTMLAttributes: {
|
||||
[key: string]: any
|
||||
[key: string]: string | number
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export const ToggleTextWrap = Extension.create({
|
|||
return {
|
||||
addTextWrap:
|
||||
(attributes) =>
|
||||
({ commands, state }) => {
|
||||
({ commands, state: _s }) => {
|
||||
return commands.setMark('span', attributes)
|
||||
},
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { PopupProps } from '../../_shared/Popup'
|
||||
|
||||
import { clsx } from 'clsx'
|
||||
import { createEffect, createSignal, onMount, Show } from 'solid-js'
|
||||
import { createSignal, Show } from 'solid-js'
|
||||
|
||||
import { useLocalize } from '../../../context/localize'
|
||||
import { Popup } from '../../_shared/Popup'
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
margin-right: 1.2rem;
|
||||
}
|
||||
|
||||
.userpic {
|
||||
margin-right: 1.2rem;
|
||||
}
|
||||
|
||||
.selected {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
|
|
@ -38,12 +38,14 @@
|
|||
a {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.facebook,
|
||||
.google,
|
||||
.vk,
|
||||
.telegram {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.github:hover {
|
||||
img {
|
||||
filter: invert(1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@mixin searchFilterControl {
|
||||
@mixin search-filter-control {
|
||||
background: rgb(64 64 64 / 50%);
|
||||
border-radius: 10rem;
|
||||
color: #fff;
|
||||
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
|
||||
.topTopic {
|
||||
@include searchFilterControl;
|
||||
@include search-filter-control;
|
||||
}
|
||||
|
||||
.filterSwitcher {
|
||||
|
@ -99,5 +99,5 @@
|
|||
}
|
||||
|
||||
.filterResultsControl {
|
||||
@include searchFilterControl;
|
||||
@include search-filter-control;
|
||||
}
|
||||
|
|
|
@ -93,12 +93,10 @@
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 10001;
|
||||
|
||||
font-size: 1.2rem;
|
||||
border-radius: 6px;
|
||||
background-color: rgb(0 0 0 / 80%);
|
||||
color: #fff;
|
||||
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
}
|
||||
|
||||
.thumbs {
|
||||
//overflow: hidden;
|
||||
// overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
|
@ -87,6 +87,7 @@
|
|||
&.mobileView {
|
||||
.container {
|
||||
padding: 0;
|
||||
|
||||
.thumbs {
|
||||
& swiper-slide {
|
||||
// bind to html element <swiper-slide/>
|
||||
|
@ -228,7 +229,7 @@
|
|||
margin-top: 24px;
|
||||
|
||||
* {
|
||||
color: var(--default-color-invert) !important; //Force fix migration errors with inline styles
|
||||
color: var(--default-color-invert) !important; // Force fix migration errors with inline styles
|
||||
}
|
||||
|
||||
@include media-breakpoint-up(md) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { useLocalize } from '../../../context/localize'
|
|||
import styles from './TimeAgo.module.scss'
|
||||
|
||||
type Props = {
|
||||
date: any
|
||||
date: string | number | Date
|
||||
class?: string
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@ export interface SSEMessage {
|
|||
id: string
|
||||
entity: string // follower | shout | reaction
|
||||
action: string // create | delete | update | join | follow | seen
|
||||
payload: any // Author | Shout | Reaction | Message
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
payload: any // Author Shout Message Reaction Chat
|
||||
created_at?: number // unixtime x1000
|
||||
seen?: boolean
|
||||
}
|
||||
|
|
|
@ -43,10 +43,13 @@ export const ReactionsProvider = (props: { children: JSX.Element }) => {
|
|||
offset?: number
|
||||
}): Promise<Reaction[]> => {
|
||||
const reactions = await apiClient.getReactionsBy({ by, limit, offset })
|
||||
const newReactionEntities = reactions.reduce((acc, reaction) => {
|
||||
acc[reaction.id] = reaction
|
||||
return acc
|
||||
}, {})
|
||||
const newReactionEntities = reactions.reduce(
|
||||
(acc: { [reaction_id: number]: Reaction }, reaction: Reaction) => {
|
||||
acc[reaction.id] = reaction
|
||||
return acc
|
||||
},
|
||||
{},
|
||||
)
|
||||
setReactionEntities(newReactionEntities)
|
||||
return reactions
|
||||
}
|
||||
|
@ -79,9 +82,9 @@ export const ReactionsProvider = (props: { children: JSX.Element }) => {
|
|||
}
|
||||
|
||||
const deleteReaction = async (reaction_id: number): Promise<void> => {
|
||||
const _reaction = await apiClient.destroyReaction(reaction_id)
|
||||
const r = await apiClient.destroyReaction(reaction_id)
|
||||
setReactionEntities({
|
||||
[reaction_id]: undefined,
|
||||
[r.id]: undefined,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ const EMPTY_SUBSCRIPTIONS = {
|
|||
}
|
||||
|
||||
export const SessionProvider = (props: {
|
||||
onStateChangeCallback(state: any): unknown
|
||||
onStateChangeCallback(state: AuthToken): unknown
|
||||
children: JSX.Element
|
||||
}) => {
|
||||
const { t } = useLocalize()
|
||||
|
|
|
@ -7,8 +7,7 @@ export type PageContext = PageContextBuiltInClientWithClientRouting & {
|
|||
Page: (pageProps: PageProps) => Component
|
||||
pageProps: PageProps
|
||||
lng: string
|
||||
// FIXME typing
|
||||
cookies: any
|
||||
cookies: { [key: string]: string | number | undefined } | null
|
||||
documentProps?: {
|
||||
title?: string
|
||||
description?: string
|
||||
|
|
|
@ -595,7 +595,9 @@ figure {
|
|||
figure {
|
||||
figcaption {
|
||||
color: rgb(0 0 0 / 60%);
|
||||
|
||||
@include font-size(1.2rem);
|
||||
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const pageLoadManager: {
|
||||
promise: Promise<any>
|
||||
promise: Promise<void>
|
||||
} = { promise: Promise.resolve() }
|
||||
|
||||
export const getPageLoadManagerPromise = () => {
|
||||
return pageLoadManager.promise
|
||||
}
|
||||
export const setPageLoadManagerPromise = (promise: Promise<any>) => {
|
||||
export const setPageLoadManagerPromise = (promise: Promise<void>) => {
|
||||
pageLoadManager.promise = promise
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user