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.

fix: add new-for-builtins rule (#5116)

LongYinan68caf5027d30
diff --git a/.eslintrc.js b/.eslintrc.js
index 4e59b55aaf..a94e1e5012 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -214,6 +214,7 @@ const config = {
'unicorn/prefer-date-now': 'error',
'unicorn/no-typeof-undefined': 'error',
'unicorn/no-useless-promise-resolve-reject': 'error',
+ 'unicorn/new-for-builtins': 'error',
'sonarjs/no-all-duplicated-branches': 'error',
'sonarjs/no-element-overwrite': 'error',
'sonarjs/no-empty-collection': 'error',
diff --git a/packages/backend/server/tests/exception-logger.e2e.ts b/packages/backend/server/tests/exception-logger.e2e.ts
index 982225fdeb..12f00ee9eb 100644
--- a/packages/backend/server/tests/exception-logger.e2e.ts
+++ b/packages/backend/server/tests/exception-logger.e2e.ts
@@ -17,7 +17,7 @@ class FakePrisma {
get workspace() {
return {
async findUnique() {
- throw Error('exception from graphql');
+ throw new Error('exception from graphql');
},
};
}
diff --git a/packages/frontend/graphql/src/utils.ts b/packages/frontend/graphql/src/utils.ts
index fb9804c504..138a427bdd 100644
--- a/packages/frontend/graphql/src/utils.ts
+++ b/packages/frontend/graphql/src/utils.ts
@@ -3,7 +3,7 @@ export const TRACE_ID_BYTES = 16;
export const TRACE_VERSION = '00';
export const TRACE_FLAG = '01';
-const BytesBuffer = Array(32);
+const BytesBuffer = new Array(32);
type TraceSpan = {
name: string;