chore: remove eslint-plugin-internal-playwright (#34510)
This commit is contained in:
parent
ab01dccf9d
commit
cea5dad686
|
@ -48,7 +48,6 @@
|
||||||
"electron": "^30.1.2",
|
"electron": "^30.1.2",
|
||||||
"esbuild": "^0.18.11",
|
"esbuild": "^0.18.11",
|
||||||
"eslint": "^8.55.0",
|
"eslint": "^8.55.0",
|
||||||
"eslint-plugin-internal-playwright": "file:utils/eslint-plugin-internal-playwright",
|
|
||||||
"eslint-plugin-notice": "^0.9.10",
|
"eslint-plugin-notice": "^0.9.10",
|
||||||
"eslint-plugin-react": "^7.35.0",
|
"eslint-plugin-react": "^7.35.0",
|
||||||
"eslint-plugin-react-hooks": "^4.6.2",
|
"eslint-plugin-react-hooks": "^4.6.2",
|
||||||
|
@ -3716,10 +3715,6 @@
|
||||||
"url": "https://opencollective.com/eslint"
|
"url": "https://opencollective.com/eslint"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint-plugin-internal-playwright": {
|
|
||||||
"resolved": "utils/eslint-plugin-internal-playwright",
|
|
||||||
"link": true
|
|
||||||
},
|
|
||||||
"node_modules/eslint-plugin-notice": {
|
"node_modules/eslint-plugin-notice": {
|
||||||
"version": "0.9.10",
|
"version": "0.9.10",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-notice/-/eslint-plugin-notice-0.9.10.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-notice/-/eslint-plugin-notice-0.9.10.tgz",
|
||||||
|
@ -8267,10 +8262,6 @@
|
||||||
"xterm": "^5.1.0",
|
"xterm": "^5.1.0",
|
||||||
"xterm-addon-fit": "^0.7.0"
|
"xterm-addon-fit": "^0.7.0"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"utils/eslint-plugin-internal-playwright": {
|
|
||||||
"version": "0.0.1",
|
|
||||||
"dev": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,6 @@
|
||||||
"electron": "^30.1.2",
|
"electron": "^30.1.2",
|
||||||
"esbuild": "^0.18.11",
|
"esbuild": "^0.18.11",
|
||||||
"eslint": "^8.55.0",
|
"eslint": "^8.55.0",
|
||||||
"eslint-plugin-internal-playwright": "file:utils/eslint-plugin-internal-playwright",
|
|
||||||
"eslint-plugin-notice": "^0.9.10",
|
"eslint-plugin-notice": "^0.9.10",
|
||||||
"eslint-plugin-react": "^7.35.0",
|
"eslint-plugin-react": "^7.35.0",
|
||||||
"eslint-plugin-react-hooks": "^4.6.2",
|
"eslint-plugin-react-hooks": "^4.6.2",
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
extends: '../../../.eslintrc.js',
|
|
||||||
plugins: ['internal-playwright'],
|
|
||||||
rules: {
|
|
||||||
'internal-playwright/await-promise-in-class-returns': 'error',
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -243,7 +243,6 @@ export class EventEmitter implements EventEmitterType {
|
||||||
if (options.behavior === 'wait') {
|
if (options.behavior === 'wait') {
|
||||||
const errors: Error[] = [];
|
const errors: Error[] = [];
|
||||||
this._rejectionHandler = error => errors.push(error);
|
this._rejectionHandler = error => errors.push(error);
|
||||||
// eslint-disable-next-line internal-playwright/await-promise-in-class-returns
|
|
||||||
return this._waitFor(type).then(() => {
|
return this._waitFor(type).then(() => {
|
||||||
if (errors.length)
|
if (errors.length)
|
||||||
throw errors[0];
|
throw errors[0];
|
||||||
|
@ -253,7 +252,6 @@ export class EventEmitter implements EventEmitterType {
|
||||||
if (options.behavior === 'ignoreErrors')
|
if (options.behavior === 'ignoreErrors')
|
||||||
this._rejectionHandler = () => {};
|
this._rejectionHandler = () => {};
|
||||||
|
|
||||||
// eslint-disable-next-line internal-playwright/await-promise-in-class-returns
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Microsoft Corporation.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
module.exports = {
|
|
||||||
rules: {
|
|
||||||
'await-promise-in-class-returns': require('./rules/await-promise-in-class-returns'),
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"name": "eslint-plugin-internal-playwright",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"main": "index.js"
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Microsoft Corporation.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
const { ESLintUtils } = require('@typescript-eslint/utils');
|
|
||||||
const tsutils = require('ts-api-utils');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
meta: {
|
|
||||||
type: 'problem',
|
|
||||||
docs: {
|
|
||||||
description: 'ensure that return statements in classes await their promises so we always have the full stack trace in channel owners/tracing apiName extraction',
|
|
||||||
category: 'Best Practices',
|
|
||||||
recommended: false,
|
|
||||||
},
|
|
||||||
schema: [],
|
|
||||||
fixable: 'code',
|
|
||||||
},
|
|
||||||
create(context) {
|
|
||||||
const parserServices = ESLintUtils.getParserServices(context);
|
|
||||||
return {
|
|
||||||
'ClassDeclaration MethodDefinition ReturnStatement': function (statement) {
|
|
||||||
if (statement.type === 'ReturnStatement' && statement.argument) {
|
|
||||||
if (tsutils.isThenableType(
|
|
||||||
parserServices.program.getTypeChecker(),
|
|
||||||
statement.argument,
|
|
||||||
parserServices.getTypeAtLocation(statement.argument)
|
|
||||||
)) {
|
|
||||||
context.report({
|
|
||||||
node: statement,
|
|
||||||
message: 'Return statement in a class should await a promise so we are able to extract the whole stack trace when reporting it to e.g. Trace Viewer',
|
|
||||||
fix(fixer) {
|
|
||||||
const sourceCode = context.getSourceCode();
|
|
||||||
const returnKeyword = sourceCode.getFirstToken(statement);
|
|
||||||
return fixer.insertTextAfter(returnKeyword, ' await');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
Loading…
Reference in New Issue