fix: add no-new-array rule (#5117)
This commit is contained in:
@@ -214,6 +214,7 @@ const config = {
|
||||
'unicorn/prefer-date-now': 'error',
|
||||
'unicorn/no-typeof-undefined': 'error',
|
||||
'unicorn/no-useless-promise-resolve-reject': 'error',
|
||||
'unicorn/no-new-array': 'error',
|
||||
'unicorn/new-for-builtins': 'error',
|
||||
'sonarjs/no-all-duplicated-branches': 'error',
|
||||
'sonarjs/no-element-overwrite': 'error',
|
||||
|
||||
@@ -183,7 +183,9 @@ test('should correctly list all history records', async t => {
|
||||
|
||||
// insert expired data
|
||||
await db.snapshotHistory.createMany({
|
||||
data: new Array(10).fill(0).map((_, i) => ({
|
||||
data: Array.from({ length: 10 })
|
||||
.fill(0)
|
||||
.map((_, i) => ({
|
||||
workspaceId: snapshot.workspaceId,
|
||||
id: snapshot.id,
|
||||
blob: snapshot.blob,
|
||||
@@ -195,7 +197,9 @@ test('should correctly list all history records', async t => {
|
||||
|
||||
// insert available data
|
||||
await db.snapshotHistory.createMany({
|
||||
data: new Array(10).fill(0).map((_, i) => ({
|
||||
data: Array.from({ length: 10 })
|
||||
.fill(0)
|
||||
.map((_, i) => ({
|
||||
workspaceId: snapshot.workspaceId,
|
||||
id: snapshot.id,
|
||||
blob: snapshot.blob,
|
||||
@@ -243,7 +247,9 @@ test('should be able to get last history record', async t => {
|
||||
|
||||
// insert available data
|
||||
await db.snapshotHistory.createMany({
|
||||
data: new Array(10).fill(0).map((_, i) => ({
|
||||
data: Array.from({ length: 10 })
|
||||
.fill(0)
|
||||
.map((_, i) => ({
|
||||
workspaceId: snapshot.workspaceId,
|
||||
id: snapshot.id,
|
||||
blob: snapshot.blob,
|
||||
@@ -299,7 +305,9 @@ test('should be able to cleanup expired history', async t => {
|
||||
|
||||
// insert expired data
|
||||
await db.snapshotHistory.createMany({
|
||||
data: new Array(10).fill(0).map((_, i) => ({
|
||||
data: Array.from({ length: 10 })
|
||||
.fill(0)
|
||||
.map((_, i) => ({
|
||||
workspaceId: snapshot.workspaceId,
|
||||
id: snapshot.id,
|
||||
blob: snapshot.blob,
|
||||
@@ -311,7 +319,9 @@ test('should be able to cleanup expired history', async t => {
|
||||
|
||||
// insert available data
|
||||
await db.snapshotHistory.createMany({
|
||||
data: new Array(10).fill(0).map((_, i) => ({
|
||||
data: Array.from({ length: 10 })
|
||||
.fill(0)
|
||||
.map((_, i) => ({
|
||||
workspaceId: snapshot.workspaceId,
|
||||
id: snapshot.id,
|
||||
blob: snapshot.blob,
|
||||
|
||||
@@ -8,7 +8,9 @@ export const WorkspaceDetailSkeleton = () => {
|
||||
<>
|
||||
<SettingHeader title={<Skeleton />} subtitle={<Skeleton />} />
|
||||
|
||||
{new Array(3).fill(0).map((_, index) => {
|
||||
{Array.from({ length: 3 })
|
||||
.fill(0)
|
||||
.map((_, index) => {
|
||||
return (
|
||||
<SettingWrapper title={<Skeleton />} key={index}>
|
||||
<SettingRow
|
||||
|
||||
@@ -26,7 +26,9 @@ export const WorkspaceListItemSkeleton = () => {
|
||||
export const WorkspaceListSkeleton = () => {
|
||||
return (
|
||||
<>
|
||||
{new Array(5).fill(0).map((_, index) => {
|
||||
{Array.from({ length: 5 })
|
||||
.fill(0)
|
||||
.map((_, index) => {
|
||||
return <WorkspaceListItemSkeleton key={index} />;
|
||||
})}
|
||||
</>
|
||||
|
||||
@@ -3,7 +3,7 @@ export const TRACE_ID_BYTES = 16;
|
||||
export const TRACE_VERSION = '00';
|
||||
export const TRACE_FLAG = '01';
|
||||
|
||||
const BytesBuffer = new Array(32);
|
||||
const BytesBuffer = Array.from<number>({ length: 32 });
|
||||
|
||||
type TraceSpan = {
|
||||
name: string;
|
||||
|
||||
@@ -265,7 +265,9 @@ test.describe('collaboration members', () => {
|
||||
await addUserToWorkspace(workspaceId, userB.id, 1 /* READ */);
|
||||
};
|
||||
await Promise.all(
|
||||
new Array(10).fill(1).map(() => createUserAndAddToWorkspace())
|
||||
Array.from({ length: 10 })
|
||||
.fill(1)
|
||||
.map(() => createUserAndAddToWorkspace())
|
||||
);
|
||||
|
||||
await openSettingModal(page);
|
||||
|
||||
Reference in New Issue
Block a user