mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-22 07:41:58 +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-constructor-return': 'error',
|
||||
'no-self-compare': 'error',
|
||||
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
||||
'react/prop-types': 'off',
|
||||
'react/jsx-no-useless-fragment': '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 {
|
||||
return (
|
||||
buf.length == 0 ||
|
||||
buf.length === 0 ||
|
||||
// 0x0000
|
||||
(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
|
||||
) => {
|
||||
Object.values(cells).forEach(row => {
|
||||
if (row[id] != null) {
|
||||
if (row[id] !== null && row[id] !== undefined) {
|
||||
update(row[id]);
|
||||
}
|
||||
});
|
||||
|
@ -195,7 +195,7 @@ export class Typesystem {
|
||||
): boolean {
|
||||
if (superType.type === 'typeRef') {
|
||||
// TODO both are ref
|
||||
if (context && sub.type != 'typeRef') {
|
||||
if (context && sub.type !== 'typeRef') {
|
||||
context[superType.name] = sub;
|
||||
}
|
||||
// TODO bound
|
||||
|
@ -141,7 +141,7 @@ filterMatcher.register(
|
||||
name: 'is',
|
||||
defaultArgs: () => [true],
|
||||
impl: (value, target) => {
|
||||
return value == target;
|
||||
return value === target;
|
||||
},
|
||||
}
|
||||
);
|
||||
@ -209,7 +209,7 @@ filterMatcher.register(
|
||||
defaultArgs: () => [],
|
||||
impl: 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 {
|
||||
const today = new Date();
|
||||
return (
|
||||
date.getDate() == today.getDate() &&
|
||||
date.getMonth() == today.getMonth() &&
|
||||
date.getFullYear() == today.getFullYear()
|
||||
date.getDate() === today.getDate() &&
|
||||
date.getMonth() === today.getMonth() &&
|
||||
date.getFullYear() === today.getFullYear()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ export const PlanCard = (props: PlanCardProps) => {
|
||||
{detail.benefits.map((content, i) => (
|
||||
<div key={i} className={styles.planBenefit}>
|
||||
<div className={styles.planBenefitIcon}>
|
||||
{detail.type == 'dynamic' ? (
|
||||
{detail.type === 'dynamic' ? (
|
||||
<BulledListIcon color="var(--affine-processing-color)" />
|
||||
) : (
|
||||
<DoneIcon
|
||||
|
@ -85,7 +85,7 @@ const CollectionRenderer = ({
|
||||
async (id: string) => {
|
||||
await setting.updateCollection({
|
||||
...collection,
|
||||
allowList: collection.allowList?.filter(v => v != id),
|
||||
allowList: collection.allowList?.filter(v => v !== id),
|
||||
});
|
||||
},
|
||||
[collection, setting]
|
||||
|
@ -194,7 +194,8 @@ export const WorkspaceLayoutInner = ({
|
||||
const blockVersions = meta.get('blockVersions');
|
||||
if (
|
||||
!(blockVersions instanceof YMap) &&
|
||||
blockVersions != null &&
|
||||
blockVersions !== null &&
|
||||
blockVersions !== undefined &&
|
||||
typeof blockVersions === 'object'
|
||||
) {
|
||||
meta.set(
|
||||
|
@ -105,7 +105,7 @@ export class CustomGitHubProvider extends BaseGitHubProvider<GithubUpdateInfo> {
|
||||
);
|
||||
}
|
||||
|
||||
if (tag == null) {
|
||||
if (tag === null || tag === undefined) {
|
||||
throw newError(
|
||||
`No published versions on GitHub`,
|
||||
'ERR_UPDATER_NO_PUBLISHED_VERSIONS'
|
||||
@ -154,7 +154,7 @@ export class CustomGitHubProvider extends BaseGitHubProvider<GithubUpdateInfo> {
|
||||
}
|
||||
|
||||
const result = parseUpdateInfo(rawData, channelFile, channelFileUrl);
|
||||
if (result.releaseName == null) {
|
||||
if (result.releaseName === null) {
|
||||
result.releaseName = latestRelease.elementValueOrEmpty('title');
|
||||
}
|
||||
|
||||
|
@ -186,13 +186,13 @@ export class SyncEngine {
|
||||
}
|
||||
|
||||
async waitForSynced(abort?: AbortSignal) {
|
||||
if (this.status.step == SyncEngineStep.Synced) {
|
||||
if (this.status.step === SyncEngineStep.Synced) {
|
||||
return;
|
||||
} else {
|
||||
return Promise.race([
|
||||
new Promise<void>(resolve => {
|
||||
this.onStatusChange.on(status => {
|
||||
if (status.step == SyncEngineStep.Synced) {
|
||||
if (status.step === SyncEngineStep.Synced) {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
|
@ -65,7 +65,7 @@ async function waitForScrollToFinish(page: Page) {
|
||||
let lastScrollTop: number;
|
||||
const interval = setInterval(() => {
|
||||
const { scrollTop } = document.documentElement;
|
||||
if (scrollTop != lastScrollTop) {
|
||||
if (scrollTop !== lastScrollTop) {
|
||||
lastScrollTop = scrollTop;
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
|
Loading…
Reference in New Issue
Block a user