chore: forbid importing src/common/Events.ts (#6183)

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.
This commit is contained in:
Jack Franklin 2020-07-08 16:03:16 +01:00 committed by GitHub
parent 0e938803ef
commit 19f188a852
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -84,7 +84,11 @@ module.exports = {
"mocha/no-exclusive-tests": "error", "mocha/no-exclusive-tests": "error",
// enforce the variable in a catch block is named 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": [ "overrides": [
{ {

View File

@ -16,7 +16,6 @@
import { assert } from './assert'; import { assert } from './assert';
import { helper, PuppeteerEventListener } from './helper'; import { helper, PuppeteerEventListener } from './helper';
import { Events } from './Events';
import { TimeoutError } from './Errors'; import { TimeoutError } from './Errors';
import { FrameManager, Frame, FrameManagerEmittedEvents } from './FrameManager'; import { FrameManager, Frame, FrameManagerEmittedEvents } from './FrameManager';
import { HTTPRequest } from './HTTPRequest'; import { HTTPRequest } from './HTTPRequest';

View File

@ -18,7 +18,6 @@ import * as fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import { EventEmitter } from './EventEmitter'; import { EventEmitter } from './EventEmitter';
import * as mime from 'mime'; import * as mime from 'mime';
import { Events } from './Events';
import { Connection, CDPSession, CDPSessionEmittedEvents } from './Connection'; import { Connection, CDPSession, CDPSessionEmittedEvents } from './Connection';
import { Dialog } from './Dialog'; import { Dialog } from './Dialog';
import { EmulationManager } from './EmulationManager'; import { EmulationManager } from './EmulationManager';