chore: fix RxJS import (#11176)

This commit is contained in:
Nikolay Vitkov 2023-10-17 10:30:04 +02:00 committed by GitHub
parent e00b42879b
commit 443ee99a8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 14 deletions

View File

@ -1,6 +1,25 @@
const {readdirSync} = require('fs');
const {join} = require('path');
const rulesDirPlugin = require('eslint-plugin-rulesdir');
rulesDirPlugin.RULES_DIR = 'tools/eslint/lib';
function getThirdPartyPackages() {
return readdirSync(join(__dirname, 'packages/puppeteer-core/third_party'), {
withFileTypes: true,
})
.filter(dirent => {
return dirent.isDirectory();
})
.map(({name}) => {
return {
name,
message: `Import \`${name}\` from the vendored location: third_party/${name}/index.js`,
};
});
}
module.exports = {
root: true,
env: {
@ -104,19 +123,6 @@ module.exports = {
// ensure we don't have any it.only or describe.only in prod
'mocha/no-exclusive-tests': 'error',
'no-restricted-imports': [
'error',
{
patterns: ['*Events', '*.test.js'],
paths: [
{
name: 'mitt',
message:
'Import `mitt` from the vendored location: third_party/mitt/index.js',
},
],
},
],
'import/order': [
'error',
{
@ -234,6 +240,18 @@ module.exports = {
'@typescript-eslint/no-import-type-side-effects': 'error',
},
overrides: [
{
files: 'packages/puppeteer-core/src/**/*.ts',
rules: {
'no-restricted-imports': [
'error',
{
patterns: ['*Events', '*.test.js'],
paths: [...getThirdPartyPackages()],
},
],
},
},
{
files: [
'packages/puppeteer-core/src/**/*.test.ts',

View File

@ -18,8 +18,8 @@ import type {Readable} from 'stream';
import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
import type Protocol from 'devtools-protocol';
import {firstValueFrom, from, raceWith} from 'rxjs';
import {firstValueFrom, from, raceWith} from '../../third_party/rxjs/rxjs.js';
import type {CDPSession} from '../api/CDPSession.js';
import type {WaitForOptions} from '../api/Frame.js';
import {