Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

style: add sonarjs/no-gratuitous-expressions rule (#9360)

Brooooooklyn706b6140069c
diff --git a/.prettierignore b/.prettierignore
index 5d782d85d9..d883ecd156 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -34,3 +34,4 @@ packages/frontend/graphql/src/schema.ts
packages/frontend/apps/android/App/app/build/**
blocksuite/tests-legacy/snapshots
**/.storybook
+**/.coverage
diff --git a/blocksuite/blocks/src/root-block/widgets/edgeless-auto-connect/edgeless-auto-connect.ts b/blocksuite/blocks/src/root-block/widgets/edgeless-auto-connect/edgeless-auto-connect.ts
index 23a666430a..303b6ac01c 100644
--- a/blocksuite/blocks/src/root-block/widgets/edgeless-auto-connect/edgeless-auto-connect.ts
+++ b/blocksuite/blocks/src/root-block/widgets/edgeless-auto-connect/edgeless-auto-connect.ts
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/no-non-null-assertion */
import {
AutoConnectLeftIcon,
AutoConnectRightIcon,
@@ -48,7 +47,7 @@ function calculatePosition(gap: number, count: number, iconWidth: number) {
for (let j = 0; j < count; j++) {
let left = 10;
if (isEven) {
- if (Math.abs(j - middleIndex) < 1 && isEven) {
+ if (Math.abs(j - middleIndex) < 1) {
left = 10 + middleOffset * getSign(j);
} else {
left =
diff --git a/blocksuite/tests-legacy/utils/playwright.ts b/blocksuite/tests-legacy/utils/playwright.ts
index bd7f2f4cf4..9355ed6900 100644
--- a/blocksuite/tests-legacy/utils/playwright.ts
+++ b/blocksuite/tests-legacy/utils/playwright.ts
@@ -61,7 +61,7 @@ export const test = baseTest.extend<{}>({
});
if (scope) {
test.beforeEach(async ({ browser }, testInfo) => {
- if (scope && !testInfo.title.startsWith(scope)) {
+ if (!testInfo.title.startsWith(scope!)) {
testInfo.fn = () => {
testInfo.skip();
};
@@ -76,9 +76,9 @@ if (scope) {
page = await browser.newPage();
});
- // eslint-disable-next-line no-empty-pattern
+ // oxlint-disable-next-line no-empty-pattern
test.afterAll(async ({}, testInfo) => {
- if (!scope || !testInfo.title.startsWith(scope)) {
+ if (!testInfo.title.startsWith(scope!)) {
return;
}
const focusInSecondEditor = await page.evaluate(
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 47b14599f2..f456783944 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -192,6 +192,7 @@ export default tseslint.config(
'sonarjs/no-duplicated-branches': 'error',
'sonarjs/no-collection-size-mischeck': 'error',
'sonarjs/no-identical-functions': 'error',
+ 'sonarjs/no-gratuitous-expressions': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',