Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {

extends: ['@react-native'],

plugins: ['@react-native/monorepo', '@react-native/specs'],
plugins: ['@react-native/monorepo', '@react-native/specs', 'import'],

overrides: [
// overriding the JS config from @react-native/eslint-config to ensure
Expand Down Expand Up @@ -44,6 +44,7 @@ module.exports = {
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
rules: {
'@react-native/no-deep-imports': 'off',
'import/enforce-node-protocol-usage': ['warn', 'always'],
},
},
{
Expand All @@ -66,6 +67,9 @@ module.exports = {
rules: {
'@react-native/monorepo/valid-flow-typed-signature': 'error',
'ft-flow/require-valid-file-annotation': 'off',
// These libdefs are kept byte-identical across projects (see
// flow-typed-sync-test), so they must not be migrated independently.
'import/enforce-node-protocol-usage': 'off',
'no-shadow': 'off',
'no-unused-vars': 'off',
quotes: 'off',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-ft-flow": "^2.0.1",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jest": "^29.0.1",
"eslint-plugin-jsx-a11y": "^6.6.0",
"eslint-plugin-react": "^7.37.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-codegen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
let FlowParser, TypeScriptParser, RNCodegen;

const {cheap: traverseCheap} = require('@babel/traverse').default;
const {basename} = require('path');
const {basename} = require('node:path');

try {
FlowParser =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import getAssetDestPathAndroid from '../getAssetDestPathAndroid';

const path = require('path');
const path = require('node:path');

jest
.dontMock('../getAssetDestPathAndroid')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import getAssetDestPathIOS from '../getAssetDestPathIOS';

const path = require('path');
const path = require('node:path');

jest.dontMock('../getAssetDestPathIOS');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import type {AssetData} from 'metro';

import {getAndroidResourceIdentifier} from '@react-native/asset-utils';
import fs from 'fs';
import path from 'path';
import fs from 'node:fs';
import path from 'node:path';

export function cleanAssetCatalog(catalogDir: string): void {
const files = fs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import type {RunBuildOptions} from 'metro';
import loadMetroConfig from '../../utils/loadMetroConfig';
import parseKeyValueParamArray from '../../utils/parseKeyValueParamArray';
import saveAssets from './saveAssets';
import {promises as fs} from 'fs';
import {runBuild} from 'metro';
import path from 'path';
import {styleText} from 'util';
import {promises as fs} from 'node:fs';
import path from 'node:path';
import {styleText} from 'node:util';

type HydratedMetroConfig = Awaited<ReturnType<typeof loadMetroConfig>>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
drawableFileTypes,
getAndroidResourceIdentifier,
} from '@react-native/asset-utils';
import fs from 'fs';
import path from 'path';
import fs from 'node:fs';
import path from 'node:path';

async function createKeepFileAsync(
assets: ReadonlyArray<AssetData>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
getAndroidResourceFolderName,
getAndroidResourceIdentifier,
} from '@react-native/asset-utils';
import path from 'path';
import path from 'node:path';

function getAssetDestPathAndroid(asset: PackagerAsset, scale: number): string {
const androidFolder = getAndroidResourceFolderName(asset, scale);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import type {PackagerAsset} from '@react-native/asset-utils';

import path from 'path';
import path from 'node:path';

function getAssetDestPathIOS(asset: PackagerAsset, scale: number): string {
const suffix = scale === 1 ? '' : `@${scale}x`;
Expand Down
2 changes: 1 addition & 1 deletion packages/community-cli-plugin/src/commands/bundle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import type {Command} from '@react-native-community/cli-types';

import buildBundle from './buildBundle';
import path from 'path';
import path from 'node:path';

export type {BundleCommandArgs} from './buildBundle';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import createKeepFileAsync from './createKeepFileAsync';
import filterPlatformAssetScales from './filterPlatformAssetScales';
import getAssetDestPathAndroid from './getAssetDestPathAndroid';
import getAssetDestPathIOS from './getAssetDestPathIOS';
import fs from 'fs';
import path from 'path';
import {styleText} from 'util';
import fs from 'node:fs';
import path from 'node:path';
import {styleText} from 'node:util';

type CopiedFiles = {
[src: string]: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import type {TerminalReporter} from 'metro';

import {styleText} from 'util';
import {styleText} from 'node:util';

type PageDescription = Readonly<{
id: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import type {TerminalReporter} from 'metro';

import OpenDebuggerKeyboardHandler from './OpenDebuggerKeyboardHandler';
import invariant from 'invariant';
import readline from 'readline';
import {ReadStream} from 'tty';
import {styleText} from 'util';
import readline from 'node:readline';
import {ReadStream} from 'node:tty';
import {styleText} from 'node:util';

const CTRL_C = '\u0003';
const CTRL_D = '\u0004';
Expand Down
2 changes: 1 addition & 1 deletion packages/community-cli-plugin/src/commands/start/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import type {Command} from '@react-native-community/cli-types';

import runServer from './runServer';
import path from 'path';
import path from 'node:path';

export type {StartCommandArgs} from './runServer';

Expand Down
6 changes: 3 additions & 3 deletions packages/community-cli-plugin/src/commands/start/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import attachKeyHandlers from './attachKeyHandlers';
import {createDevServerMiddleware} from './middleware';
import {createDevMiddleware} from '@react-native/dev-middleware';
import * as Metro from 'metro';
import path from 'path';
import url from 'url';
import {styleText} from 'util';
import path from 'node:path';
import url from 'node:url';
import {styleText} from 'node:util';

export type StartCommandArgs = {
assetPlugins?: string[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @format
*/

import net from 'net';
import net from 'node:net';

/**
* Determine whether we can run the dev server.
Expand Down
2 changes: 1 addition & 1 deletion packages/community-cli-plugin/src/utils/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import type {Config} from '@react-native-community/cli-types';
import type {TerminalReporter} from 'metro';

import {styleText} from 'node:util';
import semver from 'semver';
import {styleText} from 'util';

const debug = require('debug')('ReactNative:CommunityCliPlugin');

Expand Down
2 changes: 1 addition & 1 deletion packages/debugger-frontend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @format
*/

const path = require('path');
const path = require('node:path');

let frontEndPath /*:string */ = path.join(
__dirname,
Expand Down
8 changes: 4 additions & 4 deletions packages/debugger-shell/__tests__/dotslash-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
const {
prepareDebuggerShellFromDotSlashFile,
} = require('../src/node/private/LaunchUtils');
const fs = require('fs').promises;
const http = require('http');
const os = require('os');
const path = require('path');
const fs = require('node:fs').promises;
const http = require('node:http');
const os = require('node:os');
const path = require('node:path');

// The implementation of prepareDebuggerShellFromDotSlashFile relies on
// details of DotSlash that are not guaranteed to be stable (support for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import {configureAppMenu} from './AppMenu.js';
import SettingsStore from './SettingsStore.js';

const path = require('path');
const util = require('util');
const path = require('node:path');
const util = require('node:util');

// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
const {BrowserWindow, app, shell, ipcMain} = require('electron') as any;
Expand Down
4 changes: 2 additions & 2 deletions packages/debugger-shell/src/electron/SettingsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
const {app} = require('electron') as any;
const fs = require('fs');
const path = require('path');
const fs = require('node:fs');
const path = require('node:path');

type Options = Readonly<{
name?: string,
Expand Down
2 changes: 1 addition & 1 deletion packages/debugger-shell/src/electron/index.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import buildInfo from './BuildInfo';

// $FlowFixMe[untyped-import] Flow doesn't infer JSON types
const pkg = require('../../package.json');
const util = require('util');
const util = require('node:util');
// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
const {app} = require('electron') as any;

Expand Down
2 changes: 1 addition & 1 deletion packages/debugger-shell/src/node/index.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {prepareDebuggerShellFromDotSlashFile} from './private/LaunchUtils';

const {spawn} = require('cross-spawn');
const debug = require('debug')('Metro:DebuggerShell');
const path = require('path');
const path = require('node:path');

// The 'prebuilt' flavor will use the prebuilt shell binary (and the JavaScript embedded in it).
// The 'dev' flavor will use a stock Electron binary and run the shell code from the `electron/` directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
serveStaticText,
withServerForEachTest,
} from './ServerUtils';
import {createHash} from 'crypto';
import {createHash} from 'node:crypto';

// WebSocket is unreliable when using fake timers.
jest.useRealTimers();
Expand Down
4 changes: 2 additions & 2 deletions packages/dev-middleware/src/__tests__/ServerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import type {HandleFunction} from 'connect';

import {createDevMiddleware} from '../';
import connect from 'connect';
import http from 'http';
import https from 'https';
import http from 'node:http';
import https from 'node:https';
import * as selfsigned from 'selfsigned';

type CreateDevMiddlewareOptions = Parameters<typeof createDevMiddleware>[0];
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-middleware/src/createDevMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import openDebuggerMiddleware from './middleware/openDebuggerMiddleware';
import DefaultToolLauncher from './utils/DefaultToolLauncher';
import reactNativeDebuggerFrontendPath from '@react-native/debugger-frontend';
import connect from 'connect';
import path from 'path';
import path from 'node:path';
import serveStaticMiddleware from 'serve-static';

type Options = Readonly<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
* @format
*/

// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
import type {Timeout} from 'timers';
import type {Timeout} from 'node:timers';

// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
import {setTimeout} from 'timers';
import util from 'util';
import {setTimeout} from 'node:timers';
import util from 'node:util';

const debug = require('debug')('Metro:InspectorProxy');
const debugCDPMessages = require('debug')('Metro:InspectorProxyCDPMessages');
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-middleware/src/inspector-proxy/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import type {

import CdpDebugLogging from './CdpDebugLogging';
import DeviceEventReporter from './DeviceEventReporter';
import crypto from 'crypto';
import invariant from 'invariant';
import crypto from 'node:crypto';
import WS from 'ws';

const debug = require('debug')('Metro:InspectorProxy');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
import type {DebuggerSessionIDs} from '../types/EventReporter';

// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
import {monitorEventLoopDelay, performance} from 'perf_hooks';
// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
import {setTimeout} from 'timers';
import {monitorEventLoopDelay, performance} from 'node:perf_hooks';
import {setTimeout} from 'node:timers';

export type EventLoopPerfTrackerArgs = {
perfMeasurementDuration: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type {
Page,
PageDescription,
} from './types';
import type {IncomingMessage, ServerResponse} from 'http';
import type {IncomingMessage, ServerResponse} from 'node:http';

import getBaseUrlFromRequest from '../utils/getBaseUrlFromRequest';
import getDevToolsFrontendUrl from '../utils/getDevToolsFrontendUrl';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
* @format
*/

// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
import type {Timeout} from 'timers';
import type {Timeout} from 'node:timers';

// Import these from node:timers to get the correct Flow types.
// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
import {clearTimeout, setTimeout} from 'timers';
import {clearTimeout, setTimeout} from 'node:timers';
import WS from 'ws';

export type HeartbeatTrackerArgs = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import type {Experiments} from '../types/Experiments';
import type {Logger} from '../types/Logger';
import type {ReadonlyURL} from '../types/ReadonlyURL';
import type {NextHandleFunction} from 'connect';
import type {IncomingMessage, ServerResponse} from 'http';
import type {IncomingMessage, ServerResponse} from 'node:http';

import getDevToolsFrontendUrl from '../utils/getDevToolsFrontendUrl';
import {createHash} from 'crypto';
import {createHash} from 'node:crypto';

const LEGACY_SYNTHETIC_PAGE_TITLE =
'React Native Experimental (Improved Chrome Reloads)';
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-middleware/src/utils/DefaultToolLauncher.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const {
unstable_prepareDebuggerShell,
unstable_spawnDebuggerShellWithArgs,
} = require('@react-native/debugger-shell');
const {spawn} = require('child_process');
const ChromeLauncher = require('chrome-launcher');
const {Launcher: EdgeLauncher} = require('chromium-edge-launcher');
const {spawn} = require('node:child_process');
const open = require('open');

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-specs/postpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @noflow
*/

const fs = require('fs');
const fs = require('node:fs');

/**
* script to prepare package for publish.
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-specs/prepack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @noflow
*/

const fs = require('fs');
const fs = require('node:fs');

/**
* script to prepare package for publish.
Expand Down
Loading
Loading