2020-03-07 11:45:40 +08:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
value: true
|
|
|
|
});
|
|
|
|
exports.default = void 0;
|
|
|
|
|
|
|
|
var _utils = require("./utils");
|
|
|
|
|
|
|
|
var _default = (0, _utils.createRule)({
|
|
|
|
name: __filename,
|
|
|
|
meta: {
|
|
|
|
docs: {
|
|
|
|
category: 'Best Practices',
|
|
|
|
description: 'Disallow expect.resolves',
|
|
|
|
recommended: false
|
|
|
|
},
|
2020-05-24 22:59:46 +08:00
|
|
|
deprecated: true,
|
|
|
|
replacedBy: ['no-restricted-matchers'],
|
2020-03-07 11:45:40 +08:00
|
|
|
messages: {
|
|
|
|
expectResolves: 'Use `expect(await promise)` instead.'
|
|
|
|
},
|
|
|
|
schema: [],
|
|
|
|
type: 'suggestion'
|
|
|
|
},
|
|
|
|
defaultOptions: [],
|
|
|
|
create: context => ({
|
|
|
|
MemberExpression(node) {
|
2020-03-31 20:40:00 +08:00
|
|
|
if ((0, _utils.isExpectCall)(node.object) && (0, _utils.isSupportedAccessor)(node.property, _utils.ModifierName.resolves)) {
|
2020-03-07 11:45:40 +08:00
|
|
|
context.report({
|
|
|
|
node: node.property,
|
|
|
|
messageId: 'expectResolves'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
exports.default = _default;
|