mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: fix RxJs import for BiDi (#11299)
This commit is contained in:
parent
9eeb796885
commit
619d9d0262
@ -157,6 +157,8 @@ module.exports = {
|
||||
'rulesdir/prettier-comments': 'error',
|
||||
// Enforces clean up of used resources.
|
||||
'rulesdir/use-using': 'error',
|
||||
// Enforces consistent file extension
|
||||
'rulesdir/extensions': 'error',
|
||||
// Brackets keep code readable.
|
||||
curly: ['error', 'all'],
|
||||
// Brackets keep code readable and `return` intentions clear.
|
||||
|
@ -19,10 +19,10 @@ import type {
|
||||
ObservableInput,
|
||||
ObservedValueOf,
|
||||
OperatorFunction,
|
||||
} from '../../third_party/rxjs/rxjs';
|
||||
import {catchError} from '../../third_party/rxjs/rxjs';
|
||||
import type {PuppeteerLifeCycleEvent} from '../cdp/LifecycleWatcher';
|
||||
import {ProtocolError, TimeoutError} from '../common/Errors';
|
||||
} from '../../third_party/rxjs/rxjs.js';
|
||||
import {catchError} from '../../third_party/rxjs/rxjs.js';
|
||||
import type {PuppeteerLifeCycleEvent} from '../cdp/LifecycleWatcher.js';
|
||||
import {ProtocolError, TimeoutError} from '../common/Errors.js';
|
||||
|
||||
export type BiDiNetworkIdle = Extract<
|
||||
PuppeteerLifeCycleEvent,
|
||||
|
@ -33,7 +33,6 @@
|
||||
* find the one closest to our Chrome revision.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/extensions
|
||||
import {execSync} from 'child_process';
|
||||
|
||||
import packageJson from '../package.json' assert {type: 'json'};
|
||||
|
58
tools/eslint/src/extensions.ts
Normal file
58
tools/eslint/src/extensions.ts
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Copyright 2023 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {ESLintUtils} from '@typescript-eslint/utils';
|
||||
|
||||
const createRule = ESLintUtils.RuleCreator(name => {
|
||||
return `https://github.com/puppeteer/puppeteer/tree/main/tools/eslint/${name}.js`;
|
||||
});
|
||||
|
||||
const enforceExtensionRule = createRule<[], 'extensionsRule'>({
|
||||
name: 'extensions',
|
||||
meta: {
|
||||
docs: {
|
||||
description: 'Requires `.js` for imports',
|
||||
requiresTypeChecking: false,
|
||||
},
|
||||
messages: {
|
||||
extensionsRule: 'Add `.js` to import.',
|
||||
},
|
||||
schema: [],
|
||||
fixable: 'code',
|
||||
type: 'problem',
|
||||
},
|
||||
defaultOptions: [],
|
||||
create(context) {
|
||||
return {
|
||||
ImportDeclaration(node): void {
|
||||
const file = node.source.value.split('/').pop();
|
||||
|
||||
if (!node.source.value.startsWith('.') || file?.includes('.')) {
|
||||
return;
|
||||
}
|
||||
context.report({
|
||||
node: node.source,
|
||||
messageId: 'extensionsRule',
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(node.source, `'${node.source.value}.js'`);
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export = enforceExtensionRule;
|
Loading…
Reference in New Issue
Block a user