Skip to content

Commit

Permalink
chore: fix RxJS import (#11176)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade committed Oct 17, 2023
1 parent e00b428 commit 443ee99
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
44 changes: 31 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down Expand Up @@ -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',
{
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/bidi/Page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 443ee99

Please sign in to comment.