Skip to content

Commit 33631a8

Browse files
authored
Introduce an ESLint rule to coalesce imports. (#5414)
* Use the no-duplicate-imports rule. * fixup! Use the no-duplicate-imports rule. * fixup! Use the no-duplicate-imports rule. * Fix duplicate import issues. * Use the import/no-duplicates rule. * Manual fixes.
1 parent 382614b commit 33631a8

File tree

16 files changed

+78
-24
lines changed

16 files changed

+78
-24
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4-
import type * as RushLib from '@rushstack/rush-sdk';
54
import type { RushConfiguration } from '@rushstack/rush-sdk';
65

76
export const getRushConfiguration = async (): Promise<RushConfiguration> => {
87
// Since the MCP server is not always started from the directory of the Rush monorepo,
98
// it’s necessary to use dynamic import to load the Rush SDK.
10-
const Rush: typeof RushLib = await import('@rushstack/rush-sdk');
9+
const Rush: typeof import('@rushstack/rush-sdk') = await import('@rushstack/rush-sdk');
1110
const rushConfiguration: RushConfiguration = Rush.RushConfiguration.loadFromDefaultLocation();
1211
return rushConfiguration;
1312
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "",
5+
"type": "none",
6+
"packageName": "@microsoft/rush"
7+
}
8+
],
9+
"packageName": "@microsoft/rush",
10+
"email": "[email protected]"
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "",
5+
"type": "none",
6+
"packageName": "@rushstack/mcp-server"
7+
}
8+
],
9+
"packageName": "@rushstack/mcp-server",
10+
"email": "[email protected]"
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "",
5+
"type": "none",
6+
"packageName": "@rushstack/webpack-plugin-utilities"
7+
}
8+
],
9+
"packageName": "@rushstack/webpack-plugin-utilities",
10+
"email": "[email protected]"
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "",
5+
"type": "none",
6+
"packageName": "@rushstack/webpack5-module-minifier-plugin"
7+
}
8+
],
9+
"packageName": "@rushstack/webpack5-module-minifier-plugin",
10+
"email": "[email protected]"
11+
}

libraries/rush-lib/src/api/RushProjectConfiguration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { RushConstants } from '../logic/RushConstants';
1111
import type { IPhase } from './CommandLineConfiguration';
1212
import { OverlappingPathAnalyzer } from '../utilities/OverlappingPathAnalyzer';
1313
import schemaJson from '../schemas/rush-project.schema.json';
14-
import anythingSchemaJson from '../schemas/rush-project.schema.json';
14+
import anythingSchemaJson from '../schemas/anything.schema.json';
1515
import { HotlinkManager } from '../utilities/HotlinkManager';
1616
import type { RushConfiguration } from './RushConfiguration';
1717

libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import {
1616
ConsoleTerminalProvider,
1717
type ITerminal,
1818
type ITerminalProvider,
19-
Terminal
19+
Terminal,
20+
PrintUtilities
2021
} from '@rushstack/terminal';
21-
import { PrintUtilities } from '@rushstack/terminal';
2222

2323
import { RushConfiguration } from '../api/RushConfiguration';
2424
import { NodeJsCompatibility } from '../logic/NodeJsCompatibility';

libraries/rush-lib/src/logic/operations/CacheableOperationPlugin.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ import * as crypto from 'node:crypto';
55

66
import { InternalError, NewlineKind, Sort } from '@rushstack/node-core-library';
77
import { CollatedTerminal, type CollatedWriter } from '@rushstack/stream-collator';
8-
import { DiscardStdoutTransform, TextRewriterTransform } from '@rushstack/terminal';
9-
import { SplitterTransform, type TerminalWritable, type ITerminal, Terminal } from '@rushstack/terminal';
8+
import {
9+
DiscardStdoutTransform,
10+
TextRewriterTransform,
11+
SplitterTransform,
12+
type TerminalWritable,
13+
type ITerminal,
14+
Terminal
15+
} from '@rushstack/terminal';
1016

1117
import { CollatedTerminalProvider } from '../../utilities/CollatedTerminalProvider';
1218
import { OperationStatus } from './OperationStatus';

libraries/rush-lib/src/logic/operations/test/OperationExecutionManager.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ jest.mock('@rushstack/terminal', () => {
1616
};
1717
});
1818

19-
import { Terminal } from '@rushstack/terminal';
19+
import { Terminal, MockWritable, PrintUtilities } from '@rushstack/terminal';
2020
import { CollatedTerminal } from '@rushstack/stream-collator';
21-
import { MockWritable, PrintUtilities } from '@rushstack/terminal';
2221

2322
import type { IPhase } from '../../../api/CommandLineConfiguration';
2423
import type { RushConfigurationProject } from '../../../api/RushConfigurationProject';

libraries/rush-lib/src/utilities/WebClient.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
import * as os from 'node:os';
55
import * as process from 'node:process';
6-
import type * as http from 'node:http';
7-
import { request as httpRequest, type IncomingMessage } from 'node:http';
6+
import { request as httpRequest, type IncomingMessage, type Agent as HttpAgent } from 'node:http';
87
import { request as httpsRequest, type RequestOptions } from 'node:https';
98

109
import { Import, LegacyAdapters } from '@rushstack/node-core-library';
@@ -287,7 +286,7 @@ export class WebClient {
287286
break;
288287
}
289288

290-
let agent: http.Agent | undefined = undefined;
289+
let agent: HttpAgent | undefined = undefined;
291290
if (proxyUrl) {
292291
agent = createHttpsProxyAgent(proxyUrl);
293292
}

0 commit comments

Comments
 (0)