Skip to content

Commit

Permalink
chore: add @typescript-eslint/no-import-type-side-effects (#11040)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandolf committed Sep 26, 2023
1 parent e853e63 commit bd6c246
Show file tree
Hide file tree
Showing 139 changed files with 445 additions and 452 deletions.
12 changes: 5 additions & 7 deletions .eslintrc.js
Expand Up @@ -227,13 +227,11 @@ module.exports = {
// This is more performant; see https://v8.dev/blog/fast-async.
'@typescript-eslint/return-await': ['error', 'always'],
// This optimizes the dependency tracking for type-only files.
'@typescript-eslint/consistent-type-imports': [
'error',
{
disallowTypeAnnotations: false,
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/consistent-type-imports': 'error',
// So type-only exports get elided.
'@typescript-eslint/consistent-type-exports': 'error',
// Don't want to trigger unintended side-effects.
'@typescript-eslint/no-import-type-side-effects': 'error',
},
overrides: [
{
Expand Down
4 changes: 2 additions & 2 deletions packages/browsers/src/browser-data/browser-data.ts
Expand Up @@ -24,10 +24,10 @@ import {
BrowserPlatform,
BrowserTag,
ChromeReleaseChannel,
ProfileOptions,
type ProfileOptions,
} from './types.js';

export {ProfileOptions};
export type {ProfileOptions};

export const downloadUrls = {
[Browser.CHROMEDRIVER]: chromedriver.resolveDownloadUrl,
Expand Down
18 changes: 11 additions & 7 deletions packages/browsers/src/main.ts
Expand Up @@ -14,35 +14,39 @@
* limitations under the License.
*/

export type {
LaunchOptions,
ComputeExecutablePathOptions as Options,
SystemOptions,
} from './launch.js';
export {
launch,
computeExecutablePath,
computeSystemExecutablePath,
TimeoutError,
LaunchOptions,
ComputeExecutablePathOptions as Options,
SystemOptions,
CDP_WEBSOCKET_ENDPOINT_REGEX,
WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX,
Process,
} from './launch.js';
export type {
InstallOptions,
GetInstalledBrowsersOptions,
UninstallOptions,
} from './install.js';
export {
install,
getInstalledBrowsers,
canDownload,
uninstall,
InstallOptions,
GetInstalledBrowsersOptions,
UninstallOptions,
} from './install.js';
export {detectBrowserPlatform} from './detectPlatform.js';
export type {ProfileOptions} from './browser-data/browser-data.js';
export {
resolveBuildId,
Browser,
BrowserPlatform,
ChromeReleaseChannel,
createProfile,
ProfileOptions,
} from './browser-data/browser-data.js';
export {CLI, makeProgressCallback} from './CLI.js';
export {Cache, InstalledBrowser} from './Cache.js';
4 changes: 2 additions & 2 deletions packages/ng-schematics/src/builders/puppeteer/index.ts
Expand Up @@ -7,11 +7,11 @@ import {
targetFromTargetString,
type BuilderRun,
} from '@angular-devkit/architect';
import {type JsonObject} from '@angular-devkit/core';
import type {JsonObject} from '@angular-devkit/core';

import {TestRunner} from '../../schematics/utils/types.js';

import {type PuppeteerBuilderOptions} from './types.js';
import type {PuppeteerBuilderOptions} from './types.js';

const terminalStyles = {
cyan: '\u001b[36;1m',
Expand Down
4 changes: 2 additions & 2 deletions packages/ng-schematics/src/builders/puppeteer/types.ts
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

import {type JsonObject} from '@angular-devkit/core';
import type {JsonObject} from '@angular-devkit/core';

import {type TestRunner} from '../../schematics/utils/types.js';
import type {TestRunner} from '../../schematics/utils/types.js';

export interface PuppeteerBuilderOptions extends JsonObject {
testRunner: TestRunner;
Expand Down
2 changes: 1 addition & 1 deletion packages/ng-schematics/src/schematics/utils/files.ts
Expand Up @@ -28,7 +28,7 @@ import {
url,
} from '@angular-devkit/schematics';

import {type AngularProject, type TestRunner} from './types.js';
import type {AngularProject, TestRunner} from './types.js';

export interface FilesOptions {
options: {
Expand Down
2 changes: 1 addition & 1 deletion packages/ng-schematics/src/schematics/utils/packages.ts
Expand Up @@ -16,7 +16,7 @@

import {get} from 'https';

import {type Tree} from '@angular-devkit/schematics';
import type {Tree} from '@angular-devkit/schematics';

import {getNgCommandName} from './files.js';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/ng-schematics/test/src/utils.ts
@@ -1,7 +1,7 @@
import https from 'https';
import {join} from 'path';

import {type JsonObject} from '@angular-devkit/core';
import type {JsonObject} from '@angular-devkit/core';
import {
SchematicTestRunner,
type UnitTestTree,
Expand Down
4 changes: 2 additions & 2 deletions packages/puppeteer-core/src/api/Browser.ts
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

import {type ChildProcess} from 'child_process';
import type {ChildProcess} from 'child_process';

import {type Protocol} from 'devtools-protocol';
import type {Protocol} from 'devtools-protocol';

import {EventEmitter, type EventType} from '../common/EventEmitter.js';
import {debugError, waitWithTimeout} from '../common/util.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/api/BrowserContext.ts
Expand Up @@ -19,7 +19,7 @@ import {debugError} from '../common/util.js';
import {asyncDisposeSymbol, disposeSymbol} from '../util/disposable.js';

import type {Browser, Permission} from './Browser.js';
import {type Page} from './Page.js';
import type {Page} from './Page.js';
import type {Target} from './Target.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/api/Dialog.ts
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import {type Protocol} from 'devtools-protocol';
import type {Protocol} from 'devtools-protocol';

import {assert} from '../util/assert.js';

Expand Down
28 changes: 14 additions & 14 deletions packages/puppeteer-core/src/api/ElementHandle.ts
Expand Up @@ -14,31 +14,31 @@
* limitations under the License.
*/

import {type Protocol} from 'devtools-protocol';
import type {Protocol} from 'devtools-protocol';

import {type Frame} from '../api/Frame.js';
import type {Frame} from '../api/Frame.js';
import {getQueryHandlerAndSelector} from '../common/GetQueryHandler.js';
import {LazyArg} from '../common/LazyArg.js';
import {
type ElementFor,
type EvaluateFuncWith,
type HandleFor,
type HandleOr,
type NodeFor,
import type {
ElementFor,
EvaluateFuncWith,
HandleFor,
HandleOr,
NodeFor,
} from '../common/types.js';
import {type KeyInput} from '../common/USKeyboardLayout.js';
import type {KeyInput} from '../common/USKeyboardLayout.js';
import {isString, withSourcePuppeteerURLIfNone} from '../common/util.js';
import {assert} from '../util/assert.js';
import {AsyncIterableUtil} from '../util/AsyncIterableUtil.js';
import {throwIfDisposed} from '../util/decorators.js';

import {
type KeyboardTypeOptions,
type KeyPressOptions,
type MouseClickOptions,
import type {
KeyboardTypeOptions,
KeyPressOptions,
MouseClickOptions,
} from './Input.js';
import {JSHandle} from './JSHandle.js';
import {type ScreenshotOptions, type WaitForSelectorOptions} from './Page.js';
import type {ScreenshotOptions, WaitForSelectorOptions} from './Page.js';

/**
* @public
Expand Down
4 changes: 2 additions & 2 deletions packages/puppeteer-core/src/api/Environment.ts
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import {type CDPSession} from './CDPSession.js';
import {type Realm} from './Realm.js';
import type {CDPSession} from './CDPSession.js';
import type {Realm} from './Realm.js';

/**
* @internal
Expand Down
36 changes: 18 additions & 18 deletions packages/puppeteer-core/src/api/Frame.ts
Expand Up @@ -16,26 +16,26 @@

import type Protocol from 'devtools-protocol';

import {type ClickOptions, type ElementHandle} from '../api/ElementHandle.js';
import {type HTTPResponse} from '../api/HTTPResponse.js';
import {
type Page,
type WaitForSelectorOptions,
type WaitTimeoutOptions,
import type {ClickOptions, ElementHandle} from '../api/ElementHandle.js';
import type {HTTPResponse} from '../api/HTTPResponse.js';
import type {
Page,
WaitForSelectorOptions,
WaitTimeoutOptions,
} from '../api/Page.js';
import {type DeviceRequestPrompt} from '../cdp/DeviceRequestPrompt.js';
import {type IsolatedWorldChart} from '../cdp/IsolatedWorld.js';
import {type PuppeteerLifeCycleEvent} from '../cdp/LifecycleWatcher.js';
import type {DeviceRequestPrompt} from '../cdp/DeviceRequestPrompt.js';
import type {IsolatedWorldChart} from '../cdp/IsolatedWorld.js';
import type {PuppeteerLifeCycleEvent} from '../cdp/LifecycleWatcher.js';
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
import {getQueryHandlerAndSelector} from '../common/GetQueryHandler.js';
import {transposeIterableHandle} from '../common/HandleIterator.js';
import {LazyArg} from '../common/LazyArg.js';
import {
type Awaitable,
type EvaluateFunc,
type EvaluateFuncWith,
type HandleFor,
type NodeFor,
import type {
Awaitable,
EvaluateFunc,
EvaluateFuncWith,
HandleFor,
NodeFor,
} from '../common/types.js';
import {
getPageContent,
Expand All @@ -45,14 +45,14 @@ import {
import {assert} from '../util/assert.js';
import {throwIfDisposed} from '../util/decorators.js';

import {type CDPSession} from './CDPSession.js';
import {type KeyboardTypeOptions} from './Input.js';
import type {CDPSession} from './CDPSession.js';
import type {KeyboardTypeOptions} from './Input.js';
import {
FunctionLocator,
type Locator,
NodeLocator,
} from './locators/locators.js';
import {type Realm} from './Realm.js';
import type {Realm} from './Realm.js';

/**
* @public
Expand Down
8 changes: 4 additions & 4 deletions packages/puppeteer-core/src/api/HTTPRequest.ts
Expand Up @@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {type Protocol} from 'devtools-protocol';
import type {Protocol} from 'devtools-protocol';

import {type CDPSession} from './CDPSession.js';
import {type Frame} from './Frame.js';
import {type HTTPResponse} from './HTTPResponse.js';
import type {CDPSession} from './CDPSession.js';
import type {Frame} from './Frame.js';
import type {HTTPResponse} from './HTTPResponse.js';

/**
* @public
Expand Down
6 changes: 3 additions & 3 deletions packages/puppeteer-core/src/api/HTTPResponse.ts
Expand Up @@ -16,10 +16,10 @@

import type Protocol from 'devtools-protocol';

import {type SecurityDetails} from '../common/SecurityDetails.js';
import type {SecurityDetails} from '../common/SecurityDetails.js';

import {type Frame} from './Frame.js';
import {type HTTPRequest} from './HTTPRequest.js';
import type {Frame} from './Frame.js';
import type {HTTPRequest} from './HTTPRequest.js';

/**
* @public
Expand Down
6 changes: 3 additions & 3 deletions packages/puppeteer-core/src/api/Input.ts
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

import {type Protocol} from 'devtools-protocol';
import type {Protocol} from 'devtools-protocol';

import {type KeyInput} from '../common/USKeyboardLayout.js';
import type {KeyInput} from '../common/USKeyboardLayout.js';

import {type Point} from './ElementHandle.js';
import type {Point} from './ElementHandle.js';

/**
* @public
Expand Down
10 changes: 3 additions & 7 deletions packages/puppeteer-core/src/api/JSHandle.ts
Expand Up @@ -16,17 +16,13 @@

import type Protocol from 'devtools-protocol';

import {
type EvaluateFuncWith,
type HandleFor,
type HandleOr,
} from '../common/types.js';
import type {EvaluateFuncWith, HandleFor, HandleOr} from '../common/types.js';
import {debugError, withSourcePuppeteerURLIfNone} from '../common/util.js';
import {moveable, throwIfDisposed} from '../util/decorators.js';
import {disposeSymbol, asyncDisposeSymbol} from '../util/disposable.js';

import {type ElementHandle} from './ElementHandle.js';
import {type Realm} from './Realm.js';
import type {ElementHandle} from './ElementHandle.js';
import type {Realm} from './Realm.js';

/**
* Represents a reference to a JavaScript object. Instances can be created using
Expand Down

0 comments on commit bd6c246

Please sign in to comment.