Skip to content

Commit f360257

Browse files
authored
build: replace custom lint rule with compiler option (#27833)
We currently have a lint rule that prevents dotted access in `SimpleChanges` objects, because it will break with property minification. These changes replace the rule with the built-in `noPropertyAccessFromIndexSignature` compiler option which has the same effect with the added benefit of aligning us closer with g3 and reducing the amount of code we need to maintain.
1 parent fbc7bdd commit f360257

30 files changed

+71
-142
lines changed

integration/mdc-migration/verify-golden.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const TEST_DIRECTORY = CURRENT_WORKING_DIRECTORY;
1717
const GOLDEN_DIRECTORY = path.join(CURRENT_WORKING_DIRECTORY, process.argv[3]);
1818
const IGNORED_FILES = new Set(process.argv.slice(5));
1919

20-
if (SHOULD_APPROVE && !process.env.BUILD_WORKSPACE_DIRECTORY) {
20+
if (SHOULD_APPROVE && !process.env['BUILD_WORKSPACE_DIRECTORY']) {
2121
console.error('Approval command must be run with `bazel run`.');
2222
process.exit(1);
2323
}
@@ -197,7 +197,7 @@ async function deleteFiles(file: string, ignoredFiles: Set<string>) {
197197
if (diffs.length) {
198198
if (SHOULD_APPROVE) {
199199
const APPROVED_GOLDEN_DIRECTORY = path.join(
200-
process.env.BUILD_WORKSPACE_DIRECTORY!,
200+
process.env['BUILD_WORKSPACE_DIRECTORY']!,
201201
process.argv[4],
202202
);
203203
await deleteFiles(

integration/size-test/check-size.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ if (deviatedByPercentage) {
7777
/** Prints the command for approving the current test. */
7878
function printApproveCommand() {
7979
console.info(chalk.yellow('You can approve the golden by running the following command:'));
80-
console.info(chalk.yellow(` bazel run ${process.env.BAZEL_TARGET}.approve`));
80+
console.info(chalk.yellow(` bazel run ${process.env['BAZEL_TARGET']}.approve`));
8181
}
8282

8383
/** Gets the lexicographically sorted size-test golden. */

scripts/build-docs-content.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const distDir = join(projectDir, 'dist/');
2121
const outputDir = join(distDir, 'docs-content-pkg');
2222

2323
/** Command that runs Bazel. */
24-
const bazelCmd = process.env.BAZEL || `yarn -s bazel`;
24+
const bazelCmd = process.env['BAZEL'] || `yarn -s bazel`;
2525

2626
/**
2727
* Builds the docs content NPM package in snapshot mode.

scripts/build-packages-dist.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const releaseTargetTag = 'release-package';
2020
const projectDir = join(dirname(fileURLToPath(import.meta.url)), '../');
2121

2222
/** Command that runs Bazel. */
23-
const bazelCmd = process.env.BAZEL || `yarn -s bazel`;
23+
const bazelCmd = process.env['BAZEL'] || `yarn -s bazel`;
2424

2525
/** Command that queries Bazel for all release package targets. */
2626
const queryPackagesCmd =

scripts/caretaking/resync-caretaker-app-prs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Octokit} from '@octokit/rest';
22
import * as fetch from 'node-fetch';
33

44
const apiBaseUrl = 'https://test-jperrott.firebaseio.com/pulls';
5-
const github = new Octokit({auth: process.env.TOKEN});
5+
const github = new Octokit({auth: process.env['TOKEN']});
66

77
async function resync() {
88
const pulls: any[] = [];

scripts/circleci/notify-slack-job-failure.mts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
import sh from 'shelljs';
99
import {isVersionBranch, getConfig, assertValidGithubConfig} from '@angular/ng-dev';
1010

11-
if (process.env.CIRCLE_PR_NUMBER !== undefined) {
11+
if (process.env['CIRCLE_PR_NUMBER'] !== undefined) {
1212
console.info('Skipping notifications for pull requests.');
1313
process.exit(0);
1414
}
1515

16-
const jobName = process.env.CIRCLE_JOB!;
17-
const branchName = process.env.CIRCLE_BRANCH!;
18-
const jobUrl = process.env.CIRCLE_BUILD_URL!;
19-
const webhookUrl = process.env.SLACK_COMPONENTS_CI_FAILURES_WEBHOOK_URL!;
16+
const jobName = process.env['CIRCLE_JOB']!;
17+
const branchName = process.env['CIRCLE_BRANCH']!;
18+
const jobUrl = process.env['CIRCLE_BUILD_URL']!;
19+
const webhookUrl = process.env['SLACK_COMPONENTS_CI_FAILURES_WEBHOOK_URL']!;
2020

2121
const {github} = await getConfig([assertValidGithubConfig]);
2222
const isPublishBranch = isVersionBranch(branchName) || branchName === github.mainBranchName;

scripts/docs-deploy/deploy-ci-push.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ import {getReleaseRepoWithApi} from './github-versioning.mjs';
1313
import {updateVersionsFile} from './update-versions-file.mjs';
1414

1515
async function main() {
16-
if (process.env.CIRCLE_PR_NUMBER !== undefined) {
16+
if (process.env['CIRCLE_PR_NUMBER'] !== undefined) {
1717
console.log('Skipping deployment for pull request build.');
1818
return;
1919
}
2020

21-
const branchName = process.env.CIRCLE_BRANCH;
21+
const branchName = process.env['CIRCLE_BRANCH'];
2222
if (branchName === undefined) {
2323
throw new Error('Deployment script is unable to determine CI branch.');
2424
}
2525

2626
const repo = await getReleaseRepoWithApi();
2727
const active = await ActiveReleaseTrains.fetch(repo);
28-
const description = `${branchName} - ${process.env.CIRCLE_SHA1!}`;
28+
const description = `${branchName} - ${process.env['CIRCLE_SHA1']!}`;
2929
const {projectId, serviceKey} = firebaseConfig;
3030

3131
if (branchName === active.next.branchName) {

scripts/docs-deploy/deploy-to-site.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function deployToSite(
4545
// Setup GCP service key for the docs-app deployment.
4646
// https://firebase.google.com/docs/admin/setup.
4747
await fs.promises.writeFile(gcpServiceKeyTmpFile, firebaseServiceKey);
48-
process.env.GOOGLE_APPLICATION_CREDENTIALS = gcpServiceKeyTmpFile;
48+
process.env['GOOGLE_APPLICATION_CREDENTIALS'] = gcpServiceKeyTmpFile;
4949

5050
await firebase('use', info.projectId);
5151
await firebase('target:clear', 'hosting', 'mat-aio');

scripts/docs-deploy/utils.mts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ export const projectDir = path.join(path.dirname(fileURLToPath(import.meta.url))
1111

1212
/** Interface describing a site target for the docs-app. */
1313
export class SiteTarget {
14-
constructor(public firebaseSiteId: string, public remoteUrl: string) {}
14+
constructor(
15+
public firebaseSiteId: string,
16+
public remoteUrl: string,
17+
) {}
1518
}
1619

1720
/** Object capturing all site targets for the docs-app. */
@@ -25,12 +28,12 @@ export const sites = {
2528
};
2629

2730
/** Optional Github access token. Can be used for querying the active release trains. */
28-
export const githubAccessToken: string | undefined = process.env.DOCS_DEPLOY_GITHUB_TOKEN;
31+
export const githubAccessToken: string | undefined = process.env['DOCS_DEPLOY_GITHUB_TOKEN'];
2932

3033
/** Configuration describing the Firebase project that we deploy to. */
3134
export const firebaseConfig = {
3235
projectId: 'material-angular-io',
33-
serviceKey: process.env.DOCS_SITE_GCP_SERVICE_KEY!,
36+
serviceKey: process.env['DOCS_SITE_GCP_SERVICE_KEY']!,
3437
};
3538

3639
/** Finds and parsed the `package.json` of the specified project directory. */

scripts/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"types": ["node"],
88
"strict": true,
99
"noEmit": true,
10+
"noPropertyAccessFromIndexSignature": true,
1011
"skipLibCheck": true,
1112
"downlevelIteration": true,
1213
"esModuleInterop": true

0 commit comments

Comments
 (0)