UNPKG

eslint-plugin-ember

Version:
46 lines (38 loc) 1.15 kB
'use strict'; const types = require('../utils/types'); const emberUtils = require('../utils/ember'); const ERROR_MESSAGE = 'Use `await` instead of `andThen` test wait helper.'; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ /** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { type: 'suggestion', docs: { description: 'disallow usage of the `andThen` test wait helper', category: 'Testing', recommended: true, url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-test-and-then.md', }, fixable: null, schema: [], }, ERROR_MESSAGE, create(context) { if (!emberUtils.isTestFile(context.getFilename())) { return {}; } return { CallExpression(node) { const callee = node.callee; if (types.isIdentifier(callee) && callee.name === 'andThen') { context.report({ node, message: ERROR_MESSAGE, }); } }, }; }, };