Skip to content

Commit

Permalink
Suppress no-console rule violations.
Browse files Browse the repository at this point in the history
  • Loading branch information
iclanton committed Sep 26, 2023
1 parent 366ff93 commit 4709ffe
Show file tree
Hide file tree
Showing 138 changed files with 492 additions and 18 deletions.
11 changes: 10 additions & 1 deletion apps/api-documenter/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,14 @@ require('eslint-config-local/patch/modern-module-resolution');

module.exports = {
extends: ['eslint-config-local/profile/node-trusted-tool', 'eslint-config-local/mixins/friendly-locals'],
parserOptions: { tsconfigRootDir: __dirname }
parserOptions: { tsconfigRootDir: __dirname },

overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'no-console': 'off'
}
}
]
};
11 changes: 10 additions & 1 deletion apps/api-extractor/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,14 @@ require('eslint-config-local/patch/modern-module-resolution');

module.exports = {
extends: ['eslint-config-local/profile/node-trusted-tool', 'eslint-config-local/mixins/friendly-locals'],
parserOptions: { tsconfigRootDir: __dirname }
parserOptions: { tsconfigRootDir: __dirname },

overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'no-console': 'off'
}
}
]
};
2 changes: 2 additions & 0 deletions apps/heft/src/startWithVersionSelector.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

/* eslint-disable no-console */

// NOTE: Since startWithVersionSelector.ts is loaded in the same process as start.ts, any dependencies that
// we import here may become side-by-side versions. We want to minimize any dependencies.
import * as path from 'path';
Expand Down
1 change: 1 addition & 0 deletions apps/lockfile-explorer-web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const App = (): JSX.Element => {
dispatch(loadEntries(lockfile));
}
loadLockfileAsync().catch((e) => {
// eslint-disable-next-line no-console
console.log(`Failed to read lockfile: ${e}`);
});
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const ConnectionModal = (): JSX.Element | ReactNull => {
setManualChecked(true);
keepAliveAsync().catch((e) => {
// Keep alive cannot fail
// eslint-disable-next-line no-console
console.error(`Unexpected exception: ${e}`);
});
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const LockfileEntryDetailsView = (): JSX.Element | ReactNull => {
}

loadPackageJson(selectedEntry?.referrers || []).catch((e) => {
// eslint-disable-next-line no-console
console.error(`Failed to load referrers package.json: ${e}`);
});
if (selectedEntry) {
Expand All @@ -73,6 +74,7 @@ export const LockfileEntryDetailsView = (): JSX.Element | ReactNull => {
logDiagnosticInfo('No resolved entry for dependency:', dependencyToTrace);
}
} else if (selectedEntry) {
// eslint-disable-next-line no-console
console.log('dependency to trace: ', dependencyToTrace);
setInspectDependency(dependencyToTrace);

Expand Down Expand Up @@ -110,6 +112,7 @@ export const LockfileEntryDetailsView = (): JSX.Element | ReactNull => {
// YAML file. If not, either something is wrong with our algorithm, or else
// something has changed about how PNPM manages its "transitivePeerDependencies"
// field.
// eslint-disable-next-line no-console
console.error(
'Error analyzing influencers: A referrer appears to be missing its "transitivePeerDependencies" field in the YAML file: ',
dependencyToTrace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const PackageJsonViewer = (): JSX.Element => {
setPnpmfile(pnpmfile);
}
loadPnpmFileAsync().catch((e) => {
// eslint-disable-next-line no-console
console.error(`Failed to load project's pnpm file: ${e}`);
});
}, []);
Expand All @@ -60,10 +61,12 @@ export const PackageJsonViewer = (): JSX.Element => {
if (selectedEntry) {
if (selectedEntry.entryPackageName) {
loadPackageDetailsAsync(selectedEntry.packageJsonFolderPath).catch((e) => {
// eslint-disable-next-line no-console
console.error(`Failed to load project information: ${e}`);
});
} else {
// This is used to develop the lockfile explorer application in case there is a mistake in our logic
// eslint-disable-next-line no-console
console.log('The selected entry has no entry name: ', selectedEntry.entryPackageName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// problems with the algorithm.
export const logDiagnosticInfo = (...args: string[]): void => {
if (window.appContext.debugMode) {
// eslint-disable-next-line no-console
console.log('Diagnostic: ', ...args);
}
};
2 changes: 2 additions & 0 deletions apps/lockfile-explorer-web/src/parsing/LockfileDependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class LockfileDependency {
new Path(containingEntry.packageJsonFolderPath).concat(relativePath)
);
if (!rootRelativePath) {
// eslint-disable-next-line no-console
console.error('No root relative path for dependency!', name);
return;
}
Expand All @@ -89,6 +90,7 @@ export class LockfileDependency {
};
this.entryId = 'Peer: ' + this.name;
} else {
// eslint-disable-next-line no-console
console.error('Peer dependencies info missing!', node);
}
} else {
Expand Down
1 change: 1 addition & 0 deletions apps/lockfile-explorer-web/src/parsing/LockfileEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class LockfileEntry {
const packageName = new Path(rawEntryId).basename();

if (!packageJsonFolderPath || !packageName) {
// eslint-disable-next-line no-console
console.error('Could not construct path for entry: ', rawEntryId);
return;
}
Expand Down
3 changes: 3 additions & 0 deletions apps/lockfile-explorer-web/src/parsing/getPackageFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export async function readPnpmfileAsync(): Promise<string> {
const response = await fetch(`${apiPath}/pnpmfile`);
return await response.text();
} catch (e) {
// eslint-disable-next-line no-console
console.error('Could not load cjs file: ', e);
return 'Missing CJS';
}
Expand All @@ -42,6 +43,7 @@ export async function readPackageJsonAsync(projectPath: string): Promise<IPackag
});
return await response.json();
} catch (e) {
// eslint-disable-next-line no-console
console.error('Could not load package json file: ', e);
return undefined;
}
Expand All @@ -60,6 +62,7 @@ export async function readPackageSpecAsync(projectPath: string): Promise<IPackag
});
return await response.json();
} catch (e) {
// eslint-disable-next-line no-console
console.error('Could not load cjs file: ', e);
return undefined;
}
Expand Down
1 change: 1 addition & 0 deletions apps/lockfile-explorer-web/src/parsing/readLockfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ export function generateLockfileGraph(lockfile: ILockfilePackageType): LockfileE
matchedEntry.referrers.push(entry);
} else {
// Local package
// eslint-disable-next-line no-console
console.error('Could not resolve dependency entryId: ', dependency.entryId, dependency);
}
}
Expand Down
1 change: 1 addition & 0 deletions apps/lockfile-explorer-web/src/stub/initappcontext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// from Webpack dev server. In a production release, a generated script is served by the
// Node.js service with the live context object.

// eslint-disable-next-line no-console
console.log('Loaded stub/initappcontext.js');

window.appContext = {
Expand Down
11 changes: 10 additions & 1 deletion apps/lockfile-explorer/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,14 @@ require('eslint-config-local/patch/modern-module-resolution');

module.exports = {
extends: ['eslint-config-local/profile/node'],
parserOptions: { tsconfigRootDir: __dirname }
parserOptions: { tsconfigRootDir: __dirname },

overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'no-console': 'off'
}
}
]
};
11 changes: 10 additions & 1 deletion apps/rundown/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,14 @@ require('eslint-config-local/patch/modern-module-resolution');

module.exports = {
extends: ['eslint-config-local/profile/node-trusted-tool', 'eslint-config-local/mixins/friendly-locals'],
parserOptions: { tsconfigRootDir: __dirname }
parserOptions: { tsconfigRootDir: __dirname },

overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'no-console': 'off'
}
}
]
};
11 changes: 10 additions & 1 deletion apps/rush/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,14 @@ require('eslint-config-local/patch/modern-module-resolution');

module.exports = {
extends: ['eslint-config-local/profile/node-trusted-tool', 'eslint-config-local/mixins/friendly-locals'],
parserOptions: { tsconfigRootDir: __dirname }
parserOptions: { tsconfigRootDir: __dirname },

overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'no-console': 'off'
}
}
]
};
11 changes: 10 additions & 1 deletion apps/trace-import/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,14 @@ require('eslint-config-local/patch/modern-module-resolution');

module.exports = {
extends: ['eslint-config-local/profile/node-trusted-tool', 'eslint-config-local/mixins/friendly-locals'],
parserOptions: { tsconfigRootDir: __dirname }
parserOptions: { tsconfigRootDir: __dirname },

overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'no-console': 'off'
}
}
]
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export class SoundPlayer {
}

public playSoundFile(fileName: string): void {
// eslint-disable-next-line no-console
console.log('Playing sound file ' + fileName);
// eslint-disable-next-line no-console
console.log('Foo=' + this._foo);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export class SoundPlayer {
}

public playSoundFile(fileName: string): void {
// eslint-disable-next-line no-console
console.log('Playing sound file ' + fileName);
// eslint-disable-next-line no-console
console.log('Foo=' + this._foo);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class ExampleApp extends React.Component {
// is bound correctly. This form does not work with virtual/override inheritance, so use regular methods
// everywhere else.
private _onToggle = (sender: ToggleSwitch, args: IToggleEventArgs): void => {
// eslint-disable-next-line no-console
console.log('Toggle switch changed: ' + args.sliderPosition);
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class ExampleApp extends React.Component {
// is bound correctly. This form does not work with virtual/override inheritance, so use regular methods
// everywhere else.
private _onToggle = (sender: ToggleSwitch, args: IToggleEventArgs): void => {
// eslint-disable-next-line no-console
console.log('Toggle switch changed: ' + args.sliderPosition);
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class ExampleApp extends React.Component {
// is bound correctly. This form does not work with virtual/override inheritance, so use regular methods
// everywhere else.
private _onToggle = (sender: ToggleSwitch, args: IToggleEventArgs): void => {
// eslint-disable-next-line no-console
console.log('Toggle switch changed: ' + args.sliderPosition);
};
}
9 changes: 9 additions & 0 deletions build-tests/heft-fastify-test/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@

import { fastify, type FastifyInstance } from 'fastify';

// eslint-disable-next-line no-console
console.error('CHILD STARTING');
process.on('beforeExit', () => {
// eslint-disable-next-line no-console
console.error('CHILD BEFOREEXIT');
});
process.on('exit', () => {
// eslint-disable-next-line no-console
console.error('CHILD EXITED');
});
process.on('SIGINT', function () {
// eslint-disable-next-line no-console
console.error('CHILD SIGINT');
});
process.on('SIGTERM', function () {
// eslint-disable-next-line no-console
console.error('CHILD SIGTERM');
});

Expand All @@ -31,6 +36,7 @@ class MyApp {
return { hello: 'world' };
});

// eslint-disable-next-line no-console
console.log('Listening on http://localhost:3000');
await this.server.listen(3000);
}
Expand All @@ -41,9 +47,12 @@ class MyApp {
this.server.log.error(error);

if (error.stack) {
// eslint-disable-next-line no-console
console.error(error.stack);
// eslint-disable-next-line no-console
console.error();
}
// eslint-disable-next-line no-console
console.error('ERROR: ' + error.toString());
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,28 @@ module.exports = class CustomJestReporter implements Reporter {
public constructor(globalConfig: Config.GlobalConfig, options: unknown) {}

public onRunStart(results: AggregatedResult, options: ReporterOnStartOptions): void | Promise<void> {
// eslint-disable-next-line no-console
console.log();
// eslint-disable-next-line no-console
console.log(`################# Custom Jest reporter: Starting test run #################`);
}

public onTestStart(test: Test): void | Promise<void> {}

public onTestResult(test: Test, testResult: TestResult, results: AggregatedResult): void | Promise<void> {
// eslint-disable-next-line no-console
console.log('Custom Jest reporter: Reporting test result');

for (const result of testResult.testResults) {
// eslint-disable-next-line no-console
console.log(`${result.title}: ${result.status}`);
}
}

public onRunComplete(contexts: Set<TestContext>, results: AggregatedResult): void | Promise<void> {
// eslint-disable-next-line no-console
console.log('################# Completing test run #################');
// eslint-disable-next-line no-console
console.log();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

export class ChunkClass {
public doStuff(): void {
// eslint-disable-next-line no-console
console.log('CHUNK');
}

Expand Down
1 change: 1 addition & 0 deletions build-tests/heft-typescript-composite-test/src/indexB.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

// eslint-disable-next-line no-console
console.log('dostuff');

export {};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

export class ChunkClass {
public doStuff(): void {
// eslint-disable-next-line no-console
console.log('CHUNK');
}

Expand Down
1 change: 1 addition & 0 deletions build-tests/heft-webpack4-everything-test/src/indexB.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

// eslint-disable-next-line no-console
console.log('dostuff');

export {};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

export class ChunkClass {
public doStuff(): void {
// eslint-disable-next-line no-console
console.log('CHUNK');
}

Expand Down
Loading

0 comments on commit 4709ffe

Please sign in to comment.