mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-22 09:13:18 +03:00
fix: add eqeqeq lint rule (#5106)
This commit is contained in:
parent
a843dcd851
commit
923844f302
@ -127,6 +127,7 @@ const config = {
|
|||||||
'no-constant-binary-expression': 'error',
|
'no-constant-binary-expression': 'error',
|
||||||
'no-constructor-return': 'error',
|
'no-constructor-return': 'error',
|
||||||
'no-self-compare': 'error',
|
'no-self-compare': 'error',
|
||||||
|
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
||||||
'react/prop-types': 'off',
|
'react/prop-types': 'off',
|
||||||
'react/jsx-no-useless-fragment': 'error',
|
'react/jsx-no-useless-fragment': 'error',
|
||||||
'@typescript-eslint/consistent-type-imports': 'error',
|
'@typescript-eslint/consistent-type-imports': 'error',
|
||||||
|
@ -42,7 +42,7 @@ function compare(yBinary: Buffer, jwstBinary: Buffer, strict = false): boolean {
|
|||||||
|
|
||||||
function isEmptyBuffer(buf: Buffer): boolean {
|
function isEmptyBuffer(buf: Buffer): boolean {
|
||||||
return (
|
return (
|
||||||
buf.length == 0 ||
|
buf.length === 0 ||
|
||||||
// 0x0000
|
// 0x0000
|
||||||
(buf.length === 2 && buf[0] === 0 && buf[1] === 0)
|
(buf.length === 2 && buf[0] === 0 && buf[1] === 0)
|
||||||
);
|
);
|
||||||
|
@ -50,7 +50,7 @@ function migrateDatabase(data: YMap<unknown>) {
|
|||||||
update: (cell: { id: string; value: unknown }) => void
|
update: (cell: { id: string; value: unknown }) => void
|
||||||
) => {
|
) => {
|
||||||
Object.values(cells).forEach(row => {
|
Object.values(cells).forEach(row => {
|
||||||
if (row[id] != null) {
|
if (row[id] !== null && row[id] !== undefined) {
|
||||||
update(row[id]);
|
update(row[id]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -195,7 +195,7 @@ export class Typesystem {
|
|||||||
): boolean {
|
): boolean {
|
||||||
if (superType.type === 'typeRef') {
|
if (superType.type === 'typeRef') {
|
||||||
// TODO both are ref
|
// TODO both are ref
|
||||||
if (context && sub.type != 'typeRef') {
|
if (context && sub.type !== 'typeRef') {
|
||||||
context[superType.name] = sub;
|
context[superType.name] = sub;
|
||||||
}
|
}
|
||||||
// TODO bound
|
// TODO bound
|
||||||
|
@ -141,7 +141,7 @@ filterMatcher.register(
|
|||||||
name: 'is',
|
name: 'is',
|
||||||
defaultArgs: () => [true],
|
defaultArgs: () => [true],
|
||||||
impl: (value, target) => {
|
impl: (value, target) => {
|
||||||
return value == target;
|
return value === target;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -209,7 +209,7 @@ filterMatcher.register(
|
|||||||
defaultArgs: () => [],
|
defaultArgs: () => [],
|
||||||
impl: tags => {
|
impl: tags => {
|
||||||
const safeTags = safeArray(tags);
|
const safeTags = safeArray(tags);
|
||||||
return safeTags.length == 0;
|
return safeTags.length === 0;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -10,9 +10,9 @@ import * as styles from './page-list.css';
|
|||||||
export function isToday(date: Date): boolean {
|
export function isToday(date: Date): boolean {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
return (
|
return (
|
||||||
date.getDate() == today.getDate() &&
|
date.getDate() === today.getDate() &&
|
||||||
date.getMonth() == today.getMonth() &&
|
date.getMonth() === today.getMonth() &&
|
||||||
date.getFullYear() == today.getFullYear()
|
date.getFullYear() === today.getFullYear()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ export const PlanCard = (props: PlanCardProps) => {
|
|||||||
{detail.benefits.map((content, i) => (
|
{detail.benefits.map((content, i) => (
|
||||||
<div key={i} className={styles.planBenefit}>
|
<div key={i} className={styles.planBenefit}>
|
||||||
<div className={styles.planBenefitIcon}>
|
<div className={styles.planBenefitIcon}>
|
||||||
{detail.type == 'dynamic' ? (
|
{detail.type === 'dynamic' ? (
|
||||||
<BulledListIcon color="var(--affine-processing-color)" />
|
<BulledListIcon color="var(--affine-processing-color)" />
|
||||||
) : (
|
) : (
|
||||||
<DoneIcon
|
<DoneIcon
|
||||||
|
@ -85,7 +85,7 @@ const CollectionRenderer = ({
|
|||||||
async (id: string) => {
|
async (id: string) => {
|
||||||
await setting.updateCollection({
|
await setting.updateCollection({
|
||||||
...collection,
|
...collection,
|
||||||
allowList: collection.allowList?.filter(v => v != id),
|
allowList: collection.allowList?.filter(v => v !== id),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[collection, setting]
|
[collection, setting]
|
||||||
|
@ -194,7 +194,8 @@ export const WorkspaceLayoutInner = ({
|
|||||||
const blockVersions = meta.get('blockVersions');
|
const blockVersions = meta.get('blockVersions');
|
||||||
if (
|
if (
|
||||||
!(blockVersions instanceof YMap) &&
|
!(blockVersions instanceof YMap) &&
|
||||||
blockVersions != null &&
|
blockVersions !== null &&
|
||||||
|
blockVersions !== undefined &&
|
||||||
typeof blockVersions === 'object'
|
typeof blockVersions === 'object'
|
||||||
) {
|
) {
|
||||||
meta.set(
|
meta.set(
|
||||||
|
@ -105,7 +105,7 @@ export class CustomGitHubProvider extends BaseGitHubProvider<GithubUpdateInfo> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == null) {
|
if (tag === null || tag === undefined) {
|
||||||
throw newError(
|
throw newError(
|
||||||
`No published versions on GitHub`,
|
`No published versions on GitHub`,
|
||||||
'ERR_UPDATER_NO_PUBLISHED_VERSIONS'
|
'ERR_UPDATER_NO_PUBLISHED_VERSIONS'
|
||||||
@ -154,7 +154,7 @@ export class CustomGitHubProvider extends BaseGitHubProvider<GithubUpdateInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = parseUpdateInfo(rawData, channelFile, channelFileUrl);
|
const result = parseUpdateInfo(rawData, channelFile, channelFileUrl);
|
||||||
if (result.releaseName == null) {
|
if (result.releaseName === null) {
|
||||||
result.releaseName = latestRelease.elementValueOrEmpty('title');
|
result.releaseName = latestRelease.elementValueOrEmpty('title');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,13 +186,13 @@ export class SyncEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForSynced(abort?: AbortSignal) {
|
async waitForSynced(abort?: AbortSignal) {
|
||||||
if (this.status.step == SyncEngineStep.Synced) {
|
if (this.status.step === SyncEngineStep.Synced) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
return Promise.race([
|
return Promise.race([
|
||||||
new Promise<void>(resolve => {
|
new Promise<void>(resolve => {
|
||||||
this.onStatusChange.on(status => {
|
this.onStatusChange.on(status => {
|
||||||
if (status.step == SyncEngineStep.Synced) {
|
if (status.step === SyncEngineStep.Synced) {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -65,7 +65,7 @@ async function waitForScrollToFinish(page: Page) {
|
|||||||
let lastScrollTop: number;
|
let lastScrollTop: number;
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
const { scrollTop } = document.documentElement;
|
const { scrollTop } = document.documentElement;
|
||||||
if (scrollTop != lastScrollTop) {
|
if (scrollTop !== lastScrollTop) {
|
||||||
lastScrollTop = scrollTop;
|
lastScrollTop = scrollTop;
|
||||||
} else {
|
} else {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
|
Loading…
Reference in New Issue
Block a user