Skip to content

Commit

Permalink
refactor: enforce node prefix (#11723)
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-lefebvre authored Aug 15, 2024
1 parent 3c2f93b commit 70945dd
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 22 deletions.
10 changes: 9 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@
"organizeImports": {
"enabled": true
},
"linter": { "enabled": false },
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"style": {
"useNodejsImportProtocol": "error"
}
}
},
"javascript": {
"formatter": {
"trailingCommas": "all",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"test:e2e:match": "cd packages/astro && pnpm playwright install chromium firefox && pnpm run test:e2e:match",
"test:e2e:hosts": "turbo run test:hosted",
"benchmark": "astro-benchmark",
"lint": "eslint . --report-unused-disable-directives",
"lint": "biome lint && eslint . --report-unused-disable-directives",
"version": "changeset version && node ./scripts/deps/update-example-versions.js && pnpm install --no-frozen-lockfile && pnpm run format",
"preinstall": "npx only-allow pnpm"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/endpoint/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
// @ts-expect-error
import { assetsDir, imageConfig, outDir } from 'astro:assets';
import { isRemotePath, removeQueryString } from '@astrojs/internal-helpers/path';
import { readFile } from 'fs/promises';
import { readFile } from 'node:fs/promises';
import * as mime from 'mrmime';
import type { APIRoute } from '../../@types/astro.js';
import { getConfiguredImageService } from '../internal.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/dev/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs, { existsSync } from 'node:fs';
import type http from 'node:http';
import type { AddressInfo } from 'node:net';
import { green } from 'kleur/colors';
import { performance } from 'perf_hooks';
import { performance } from 'node:perf_hooks';
import { gt, major, minor, patch } from 'semver';
import type * as vite from 'vite';
import type { AstroInlineConfig } from '../../@types/astro.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/logger/vite.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fileURLToPath } from 'url';
import { fileURLToPath } from 'node:url';
import stripAnsi from 'strip-ansi';
import type { LogLevel, Rollup, Logger as ViteLogger } from 'vite';
import { isAstroError } from '../errors/errors.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/preview/static-preview-server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type http from 'node:http';
import { fileURLToPath } from 'node:url';
import { performance } from 'perf_hooks';
import { performance } from 'node:perf_hooks';
import { type PreviewServer as VitePreviewServer, preview } from 'vite';
import type { AstroSettings } from '../../@types/astro.js';
import type { Logger } from '../logger/core.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/routing/manifest/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
} from '../../../@types/astro.js';
import type { Logger } from '../../logger/core.js';

import { createRequire } from 'module';
import { createRequire } from 'node:module';
import nodeFs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-astro-server/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type http from 'node:http';
import type { ErrorWithMetadata } from '../core/errors/index.js';
import type { ModuleLoader } from '../core/module-loader/index.js';

import { Readable } from 'stream';
import { Readable } from 'node:stream';
import { getSetCookiesFromResponse } from '../core/cookies/index.js';
import { getViteErrorPayload } from '../core/errors/dev/index.js';
import notFoundTemplate from '../template/4xx.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/test/build-readonly-file.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { after, before, describe, it } from 'node:test';
import { fileURLToPath } from 'url';
import { fileURLToPath } from 'node:url';
import testAdapter from './test-adapter.js';
import { loadFixture } from './test-utils.js';

Expand Down
8 changes: 4 additions & 4 deletions packages/db/src/core/integration/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { existsSync } from 'fs';
import { existsSync } from 'node:fs';
import { parseArgs } from 'node:util';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { type ManagedAppToken, getManagedAppTokenOrExit } from '@astrojs/studio';
import { LibsqlError } from '@libsql/client';
import type { AstroConfig, AstroIntegration } from 'astro';
import { mkdir, writeFile } from 'fs/promises';
import { mkdir, writeFile } from 'node:fs/promises';
import { blue, yellow } from 'kleur/colors';
import {
type HMRPayload,
Expand Down
4 changes: 2 additions & 2 deletions packages/db/test/local-prod.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import { relative } from 'path';
import { fileURLToPath } from 'url';
import { relative } from 'node:path';
import { fileURLToPath } from 'node:url';
import testAdapter from '../../astro/test/test-adapter.js';
import { loadFixture } from '../../astro/test/test-utils.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/node/src/standalone.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import https from 'https';
import https from 'node:https';
import fs from 'node:fs';
import http from 'node:http';
import type { PreviewServer } from 'astro';
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/partytown/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRequire } from 'module';
import { createRequire } from 'node:module';
import * as fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
Expand Down
10 changes: 5 additions & 5 deletions packages/integrations/sitemap/src/write-sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type WriteStream, createWriteStream } from 'fs';
import { normalize, resolve } from 'path';
import { Readable, pipeline } from 'stream';
import { promisify } from 'util';
import { mkdir } from 'fs/promises';
import { type WriteStream, createWriteStream } from 'node:fs';
import { normalize, resolve } from 'node:path';
import { Readable, pipeline } from 'node:stream';
import { promisify } from 'node:util';
import { mkdir } from 'node:fs/promises';
import replace from 'stream-replace-string';

import { SitemapAndIndexStream, SitemapStream } from 'sitemap';
Expand Down

0 comments on commit 70945dd

Please sign in to comment.