Skip to content

Commit

Permalink
chore: forbid importing src/common/Events.ts (#6183)
Browse files Browse the repository at this point in the history
This file is now deprecated and only used by the coverage tool and
DocLint - these tools will be updated to not rely on it in the future.

We now have events defined per class - e.g. all the events that `Page`
can emit are defined in the `PageEmittedEvents` enum, and similar. We
have to keep `Events.ts` around for the aforementioned tools, but don't
want its usage creeping back into our source code.
  • Loading branch information
jackfranklin committed Jul 8, 2020
1 parent 0e93880 commit 19f188a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.js
Expand Up @@ -84,7 +84,11 @@ module.exports = {
"mocha/no-exclusive-tests": "error",

// enforce the variable in a catch block is named error
"unicorn/catch-error-name": "error"
"unicorn/catch-error-name": "error",

"no-restricted-imports": ["error", {
patterns: ["*Events"],
}]
},
"overrides": [
{
Expand Down
1 change: 0 additions & 1 deletion src/common/LifecycleWatcher.ts
Expand Up @@ -16,7 +16,6 @@

import { assert } from './assert';
import { helper, PuppeteerEventListener } from './helper';
import { Events } from './Events';
import { TimeoutError } from './Errors';
import { FrameManager, Frame, FrameManagerEmittedEvents } from './FrameManager';
import { HTTPRequest } from './HTTPRequest';
Expand Down
1 change: 0 additions & 1 deletion src/common/Page.ts
Expand Up @@ -18,7 +18,6 @@ import * as fs from 'fs';
import { promisify } from 'util';
import { EventEmitter } from './EventEmitter';
import * as mime from 'mime';
import { Events } from './Events';
import { Connection, CDPSession, CDPSessionEmittedEvents } from './Connection';
import { Dialog } from './Dialog';
import { EmulationManager } from './EmulationManager';
Expand Down

0 comments on commit 19f188a

Please sign in to comment.