Skip to content

Commit 00b6150

Browse files
committed
cleaup
1 parent 4d5fafc commit 00b6150

File tree

101 files changed

+631
-274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+631
-274
lines changed

build-tools/eslint.config.base.mts

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
import eslint from "@eslint/js";
77
import eslintConfigPrettier from "eslint-config-prettier";
88
import chaiFriendly from "eslint-plugin-chai-friendly";
9+
import importX from "eslint-plugin-import-x";
910
import jsdoc from "eslint-plugin-jsdoc";
11+
import tsdoc from "eslint-plugin-tsdoc";
1012
import unicorn from "eslint-plugin-unicorn";
1113
import tseslint from "typescript-eslint";
1214

@@ -99,6 +101,39 @@ export const unicornConfig = [
99101
},
100102
];
101103

104+
/**
105+
* Import-x plugin configuration for import/export linting.
106+
* Uses the recommended and typescript configs from eslint-plugin-import-x.
107+
*/
108+
export const importXConfig = [
109+
importX.flatConfigs.recommended,
110+
importX.flatConfigs.typescript,
111+
{
112+
settings: {
113+
"import-x/resolver": {
114+
typescript: true,
115+
},
116+
},
117+
rules: {
118+
// Disable rules that are too strict for CLI tools
119+
"import-x/no-named-as-default-member": "off",
120+
"import-x/no-default-export": "off",
121+
},
122+
},
123+
];
124+
125+
/**
126+
* TSDoc plugin configuration for TypeScript documentation comments.
127+
*/
128+
export const tsdocConfig = {
129+
plugins: {
130+
tsdoc,
131+
},
132+
rules: {
133+
"tsdoc/syntax": "warn",
134+
},
135+
};
136+
102137
/**
103138
* Chai-friendly configuration for test files.
104139
*/
@@ -145,15 +180,28 @@ export function createConfig({
145180
additionalConfigs = [],
146181
jsdoc: includeJsdoc = false,
147182
unicorn: includeUnicorn = false,
183+
importX: includeImportX = false,
184+
tsdoc: includeTsdoc = true,
148185
} = {}) {
149186
return tseslint.config(
150187
ignores,
151188
...recommendedConfigs,
152189
...(includeJsdoc ? jsdocConfig : []),
153190
...(includeUnicorn ? unicornConfig : []),
191+
...(includeImportX ? importXConfig : []),
192+
...(includeTsdoc ? [tsdocConfig] : []),
154193
baseConfig(project),
155194
...additionalConfigs,
156195
);
157196
}
158197

159-
export { tseslint, eslint, eslintConfigPrettier, jsdoc, unicorn, chaiFriendly };
198+
export {
199+
tseslint,
200+
eslint,
201+
eslintConfigPrettier,
202+
jsdoc,
203+
unicorn,
204+
chaiFriendly,
205+
importX,
206+
tsdoc,
207+
};

build-tools/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@
9393
"jiti": "^2.6.1",
9494
"eslint-plugin-chai-friendly": "~1.1.0",
9595
"eslint-plugin-jsdoc": "~61.5.0",
96+
"eslint-import-resolver-typescript": "^4.4.4",
97+
"eslint-plugin-import-x": "~4.16.1",
98+
"eslint-plugin-tsdoc": "~0.5.0",
9699
"eslint-plugin-unicorn": "~56.0.1",
97100
"inquirer": "^9.3.7",
98101
"rimraf": "^6.1.2",

build-tools/packages/build-cli/eslint.config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default createConfig({
99
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
1010
jsdoc: true,
1111
unicorn: true,
12+
importX: true,
1213
additionalConfigs: [
1314
// Ignore test data files and test fixtures that aren't in tsconfig
1415
{

build-tools/packages/build-cli/src/args.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { MonoRepo, Package } from "@fluidframework/build-tools";
77
import { Args } from "@oclif/core";
88
import { PackageName } from "@rushstack/node-core-library";
99
import * as semver from "semver";
10-
// eslint-disable-next-line import-x/no-deprecated
10+
1111
import { type Context, isMonoRepoKind } from "./library/index.js";
1212

1313
/**
@@ -28,7 +28,6 @@ export const findPackageOrReleaseGroup = (
2828
name: string,
2929
context: Context,
3030
): Package | MonoRepo | undefined => {
31-
// eslint-disable-next-line import-x/no-deprecated
3231
if (isMonoRepoKind(name)) {
3332
return context.repo.releaseGroups.get(name);
3433
}

build-tools/packages/build-cli/src/codeCoverage/getCommentForCodeCoverage.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export function getCommentForCodeCoverageDiff(
6161
const getSummaryFooter = (baselineBuildInfo: IBuildMetrics): string => {
6262
return `<hr><p>Baseline commit: ${
6363
baselineBuildInfo.build.sourceVersion
64-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
6564
} <br>Baseline build: <a target="_blank" href=${baselineBuildInfo.build._links?.web.href as string}> ${
6665
baselineBuildInfo.build.id
6766
} </a><br> Happy Coding!!</p>`;

build-tools/packages/build-cli/src/codeCoverage/getCoverageMetrics.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const getCoverageMetricsFromArtifact = async (
6565
logger?: CommandLogger,
6666
): Promise<Map<string, CoverageMetric>> => {
6767
const coverageReportsFiles: string[] = [];
68-
// eslint-disable-next-line unicorn/no-array-for-each -- required as JSZip does not implement [Symbol.iterator]() which is required by for...of
68+
6969
artifactZip.forEach((filePath) => {
7070
if (filePath.endsWith("cobertura-coverage-patched.xml"))
7171
coverageReportsFiles.push(filePath);
@@ -85,7 +85,6 @@ export const getCoverageMetricsFromArtifact = async (
8585
);
8686
}
8787

88-
// eslint-disable-next-line no-await-in-loop -- Since we only need 1 report file, it is easier to run it serially rather than extracting all jsZipObjects and then awaiting promises in parallel
8988
const coverageReportXML = await jsZipObject?.async("nodebuffer");
9089
if (coverageReportXML !== undefined) {
9190
xmlParser.parseString(

build-tools/packages/build-cli/src/commands/bump.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,7 @@ export default class BumpCommand extends BaseCommand<typeof BumpCommand> {
203203
packageOrReleaseGroup = releasePackage;
204204
}
205205

206-
const newVersion =
207-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
208-
exactVersion ?? bumpVersionScheme(repoVersion, bumpType!, scheme);
206+
const newVersion = exactVersion ?? bumpVersionScheme(repoVersion, bumpType!, scheme);
209207

210208
let bumpArg: VersionChangeType;
211209
if (bumpType === undefined) {

build-tools/packages/build-cli/src/commands/bump/deps.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ import {
2121
} from "../../flags.js";
2222
import {
2323
BaseCommand,
24-
// eslint-disable-next-line import-x/no-deprecated
2524
MonoRepoKind,
2625
generateBumpDepsBranchName,
2726
generateBumpDepsCommitMessage,
2827
indentString,
2928
isDependencyUpdateType,
3029
npmCheckUpdates,
3130
} from "../../library/index.js";
32-
// eslint-disable-next-line import-x/no-internal-modules
31+
3332
import { npmCheckUpdatesHomegrown } from "../../library/package.js";
3433
import type { ReleaseGroup } from "../../releaseGroups.js";
3534

@@ -140,9 +139,7 @@ export default class DepsCommand extends BaseCommand<typeof DepsCommand> {
140139
const gitRepo = await context.getGitRepository();
141140
const branchName = await gitRepo.getCurrentBranchName();
142141

143-
// eslint-disable-next-line import-x/no-deprecated
144142
if (args.package_or_release_group === MonoRepoKind.Server && branchName !== "next") {
145-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
146143
const { confirmed } = await prompts({
147144
type: "confirm",
148145
name: "confirmed",
@@ -152,7 +149,6 @@ export default class DepsCommand extends BaseCommand<typeof DepsCommand> {
152149
initial: false,
153150
// eslint-disable-next-line @typescript-eslint/no-explicit-any
154151
onState: (state: any) => {
155-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions, @typescript-eslint/no-unsafe-member-access
156152
if (state.aborted) {
157153
process.nextTick(() => this.exit(0));
158154
}
@@ -249,7 +245,7 @@ export default class DepsCommand extends BaseCommand<typeof DepsCommand> {
249245
...new Set(
250246
updatedPackages
251247
.filter((p) => p.monoRepo !== undefined)
252-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
248+
253249
.map((p) => p.monoRepo!.releaseGroup),
254250
),
255251
];

build-tools/packages/build-cli/src/commands/check/layers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import path from "node:path";
99
import { Flags } from "@oclif/core";
1010

1111
import { BaseCommand, LayerGraph } from "../../library/index.js";
12-
// eslint-disable-next-line import-x/no-internal-modules -- AB#8118 tracks removing the barrel files and importing directly from the submodules, including disabling this rule.
12+
1313
import { writeFileWithLineFeeds } from "../../library/text.js";
1414

1515
const packagesMdFileName = "PACKAGES.md";

build-tools/packages/build-cli/src/commands/check/policy.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ export class CheckPolicy extends BaseCommand<typeof CheckPolicy> {
207207
): Promise<void> {
208208
try {
209209
for (const pathToCheck of pathsToCheck) {
210-
// eslint-disable-next-line no-await-in-loop
211210
await this.checkOrExcludeFile(pathToCheck, commandContext);
212211
}
213212
} finally {
@@ -263,7 +262,7 @@ export class CheckPolicy extends BaseCommand<typeof CheckPolicy> {
263262
if (this.flags.fix && resolver) {
264263
output += `${newline}attempting to resolve: ${relPath}`;
265264
// Resolvers are expected to be run serially to avoid any conflicts.
266-
// eslint-disable-next-line no-await-in-loop
265+
267266
const resolveResult = await runWithPerf(handler.name, "resolve", async () =>
268267
// Pass the resolver the absolute file path and the absolute path to the git root
269268
resolver(file, gitRoot),
@@ -367,9 +366,8 @@ async function runFinalHandlers(
367366
for (const h of handlers) {
368367
const { final } = h;
369368
if (final) {
370-
// eslint-disable-next-line no-await-in-loop
371369
const result = await runWithPerf(h.name, "final", async () => final(gitRoot, fix));
372-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
370+
373371
if (result?.error) {
374372
throw new Error(result.error);
375373
}

0 commit comments

Comments
 (0)