mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-04 08:38:34 +00:00
style: apply prefer-node-protocol lint rule (#5627)
it makes it perfectly clear that the package is a Node.js builtin module.
This commit is contained in:
@@ -217,6 +217,7 @@ const config = {
|
|||||||
'unicorn/no-useless-promise-resolve-reject': 'error',
|
'unicorn/no-useless-promise-resolve-reject': 'error',
|
||||||
'unicorn/no-new-array': 'error',
|
'unicorn/no-new-array': 'error',
|
||||||
'unicorn/new-for-builtins': 'error',
|
'unicorn/new-for-builtins': 'error',
|
||||||
|
'unicorn/prefer-node-protocol': 'error',
|
||||||
'sonarjs/no-all-duplicated-branches': 'error',
|
'sonarjs/no-all-duplicated-branches': 'error',
|
||||||
'sonarjs/no-element-overwrite': 'error',
|
'sonarjs/no-element-overwrite': 'error',
|
||||||
'sonarjs/no-empty-collection': 'error',
|
'sonarjs/no-empty-collection': 'error',
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
import { join } from 'node:path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import type { ApolloDriverConfig } from '@nestjs/apollo';
|
import type { ApolloDriverConfig } from '@nestjs/apollo';
|
||||||
import { ApolloDriver } from '@nestjs/apollo';
|
import { ApolloDriver } from '@nestjs/apollo';
|
||||||
import { Global, Module } from '@nestjs/common';
|
import { Global, Module } from '@nestjs/common';
|
||||||
import { GraphQLModule } from '@nestjs/graphql';
|
import { GraphQLModule } from '@nestjs/graphql';
|
||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
import { join } from 'path';
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
|
|
||||||
import { Config } from '../config';
|
import { Config } from '../config';
|
||||||
import { GQLLoggerPlugin } from './logger-plugin';
|
import { GQLLoggerPlugin } from './logger-plugin';
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import {
|
|||||||
writeFileSync,
|
writeFileSync,
|
||||||
} from 'node:fs';
|
} from 'node:fs';
|
||||||
import { join, parse, resolve } from 'node:path';
|
import { join, parse, resolve } from 'node:path';
|
||||||
|
import { Readable } from 'node:stream';
|
||||||
|
|
||||||
import { Logger } from '@nestjs/common';
|
import { Logger } from '@nestjs/common';
|
||||||
import { Readable } from 'stream';
|
|
||||||
|
|
||||||
import { FsStorageConfig } from '../../config/storage';
|
import { FsStorageConfig } from '../../config/storage';
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'node:fs';
|
||||||
import { dirname, resolve } from 'path';
|
import { dirname, resolve } from 'node:path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { describe, expect, test } from 'vitest';
|
import { describe, expect, test } from 'vitest';
|
||||||
import type { Array as YArray, Map as YMap } from 'yjs';
|
import type { Array as YArray, Map as YMap } from 'yjs';
|
||||||
import { applyUpdate, Doc } from 'yjs';
|
import { applyUpdate, Doc } from 'yjs';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import dts from 'vite-plugin-dts';
|
import dts from 'vite-plugin-dts';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import dts from 'vite-plugin-dts';
|
import dts from 'vite-plugin-dts';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import type { ChildProcessWithoutNullStreams } from 'node:child_process';
|
||||||
import { spawn } from 'node:child_process';
|
import { spawn } from 'node:child_process';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
|
|
||||||
import type { ChildProcessWithoutNullStreams } from 'child_process';
|
|
||||||
import type { BuildContext } from 'esbuild';
|
import type { BuildContext } from 'esbuild';
|
||||||
import * as esbuild from 'esbuild';
|
import * as esbuild from 'esbuild';
|
||||||
import kill from 'tree-kill';
|
import kill from 'tree-kill';
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
import path from 'node:path';
|
||||||
|
|
||||||
import type { Options as ElectronWinstallerOptions } from 'electron-winstaller';
|
import type { Options as ElectronWinstallerOptions } from 'electron-winstaller';
|
||||||
import { convertVersion, createWindowsInstaller } from 'electron-winstaller';
|
import { convertVersion, createWindowsInstaller } from 'electron-winstaller';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
arch,
|
arch,
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
import fs from 'node:fs';
|
||||||
|
import path from 'node:path';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AppConfigStorage,
|
AppConfigStorage,
|
||||||
defaultAppConfig,
|
defaultAppConfig,
|
||||||
} from '@toeverything/infra/app-config-storage';
|
} from '@toeverything/infra/app-config-storage';
|
||||||
import { app } from 'electron';
|
import { app } from 'electron';
|
||||||
import fs from 'fs';
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
const FILENAME = 'config.json';
|
const FILENAME = 'config.json';
|
||||||
const FILEPATH = path.join(app.getPath('userData'), FILENAME);
|
const FILEPATH = path.join(app.getPath('userData'), FILENAME);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import assert from 'node:assert';
|
import assert from 'node:assert';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
import { BrowserWindow, type CookiesSetDetails, nativeTheme } from 'electron';
|
import { BrowserWindow, type CookiesSetDetails, nativeTheme } from 'electron';
|
||||||
import electronWindowState from 'electron-window-state';
|
import electronWindowState from 'electron-window-state';
|
||||||
import { join } from 'path';
|
|
||||||
|
|
||||||
import { isMacOS, isWindows } from '../shared/utils';
|
import { isMacOS, isWindows } from '../shared/utils';
|
||||||
import { mainWindowOrigin } from './constants';
|
import { mainWindowOrigin } from './constants';
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
import { BrowserWindow, type Display, screen } from 'electron';
|
import { BrowserWindow, type Display, screen } from 'electron';
|
||||||
import { join } from 'path';
|
|
||||||
|
|
||||||
import { isMacOS } from '../shared/utils';
|
import { isMacOS } from '../shared/utils';
|
||||||
import { mainWindowOrigin } from './constants';
|
import { mainWindowOrigin } from './constants';
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
import { net, protocol, session } from 'electron';
|
import { net, protocol, session } from 'electron';
|
||||||
import { join } from 'path';
|
|
||||||
|
|
||||||
import { CLOUD_BASE_URL } from './config';
|
import { CLOUD_BASE_URL } from './config';
|
||||||
import { logger } from './logger';
|
import { logger } from './logger';
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import { parse } from 'node:url';
|
||||||
|
|
||||||
import { app, BrowserWindow, shell } from 'electron';
|
import { app, BrowserWindow, shell } from 'electron';
|
||||||
import { parse } from 'url';
|
|
||||||
|
|
||||||
import { logger } from '../logger';
|
import { logger } from '../logger';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import 'electron-updater'; // Prevent BaseUpdater is undefined.
|
import 'electron-updater'; // Prevent BaseUpdater is undefined.
|
||||||
|
|
||||||
|
import { randomBytes } from 'node:crypto';
|
||||||
|
|
||||||
import { type AllPublishOptions, UUID } from 'builder-util-runtime';
|
import { type AllPublishOptions, UUID } from 'builder-util-runtime';
|
||||||
import { randomBytes } from 'crypto';
|
|
||||||
import type { AppAdapter } from 'electron-updater/out/AppAdapter';
|
import type { AppAdapter } from 'electron-updater/out/AppAdapter';
|
||||||
import type { DownloadUpdateOptions } from 'electron-updater/out/AppUpdater';
|
import type { DownloadUpdateOptions } from 'electron-updater/out/AppUpdater';
|
||||||
import type { InstallOptions } from 'electron-updater/out/BaseUpdater';
|
import type { InstallOptions } from 'electron-updater/out/BaseUpdater';
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { runCli } from '@magic-works/i18n-codegen';
|
import { runCli } from '@magic-works/i18n-codegen';
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
|
|
||||||
runCli(
|
runCli(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { runCli } from '@magic-works/i18n-codegen';
|
import { runCli } from '@magic-works/i18n-codegen';
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
|
|
||||||
runCli(
|
runCli(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import fs from 'fs';
|
import fs from 'node:fs';
|
||||||
|
import path from 'node:path';
|
||||||
|
|
||||||
import * as glob from 'glob';
|
import * as glob from 'glob';
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
// purpose: bundle all json files into one json file in onboarding folder
|
// purpose: bundle all json files into one json file in onboarding folder
|
||||||
const __dirname = new URL('.', import.meta.url).pathname;
|
const __dirname = new URL('.', import.meta.url).pathname;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { resolve } from 'node:path';
|
||||||
|
|
||||||
import { skipOnboarding, test } from '@affine-test/kit/playwright';
|
import { skipOnboarding, test } from '@affine-test/kit/playwright';
|
||||||
import {
|
import {
|
||||||
addUserToWorkspace,
|
addUserToWorkspace,
|
||||||
@@ -16,7 +18,6 @@ import { clickUserInfoCard } from '@affine-test/kit/utils/setting';
|
|||||||
import { clickSideBarSettingButton } from '@affine-test/kit/utils/sidebar';
|
import { clickSideBarSettingButton } from '@affine-test/kit/utils/sidebar';
|
||||||
import { createLocalWorkspace } from '@affine-test/kit/utils/workspace';
|
import { createLocalWorkspace } from '@affine-test/kit/utils/workspace';
|
||||||
import { expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
import { resolve } from 'path';
|
|
||||||
|
|
||||||
let user: {
|
let user: {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
/* eslint-disable unicorn/prefer-dom-node-dataset */
|
/* eslint-disable unicorn/prefer-dom-node-dataset */
|
||||||
|
import fs from 'node:fs';
|
||||||
|
|
||||||
import { test } from '@affine-test/kit/playwright';
|
import { test } from '@affine-test/kit/playwright';
|
||||||
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
||||||
import {
|
import {
|
||||||
@@ -7,7 +9,6 @@ import {
|
|||||||
waitForEditorLoad,
|
waitForEditorLoad,
|
||||||
} from '@affine-test/kit/utils/page-logic';
|
} from '@affine-test/kit/utils/page-logic';
|
||||||
import { expect, type Page } from '@playwright/test';
|
import { expect, type Page } from '@playwright/test';
|
||||||
import fs from 'fs';
|
|
||||||
|
|
||||||
async function importImage(page: Page, url: string) {
|
async function importImage(page: Page, url: string) {
|
||||||
await page.evaluate(
|
await page.evaluate(
|
||||||
|
|||||||
Reference in New Issue
Block a user