• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

platinumazure / eslint-plugin-qunit / 3824534865

pending completion
3824534865

Pull #293

github

GitHub
Merge a557e2907 into 1bbd682c0
Pull Request #293: Upgrade: Bump eslint from 8.30.0 to 8.31.0

653 of 653 branches covered (100.0%)

878 of 878 relevant lines covered (100.0%)

82.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/lib/rules/no-async-module-callbacks.js
1
/**
2
 * @fileoverview disallow async module callbacks
3
 * @author Raymond Cohen
4
 */
5
"use strict";
6

7
//------------------------------------------------------------------------------
8
// Requirements
9
//------------------------------------------------------------------------------
10

11
const utils = require("../utils");
1✔
12

13
//------------------------------------------------------------------------------
14
// Helpers
15
//------------------------------------------------------------------------------
16

17
function isAsyncFunctionExpression(node) {
18
    return ["ArrowFunctionExpression", "FunctionExpression"].includes(node.type) && node.async === true;
10✔
19
}
20

21
//------------------------------------------------------------------------------
22
// Rule Definition
23
//------------------------------------------------------------------------------
24

25
/** @type {import('eslint').Rule.RuleModule} */
26
module.exports = {
1✔
27
    meta: {
28
        type: "problem",
29
        docs: {
30
            description: "disallow async module callbacks",
31
            category: "Possible Errors",
32
            recommended: false,
33
            url: "https://github.com/platinumazure/eslint-plugin-qunit/blob/master/docs/rules/no-async-module-callbacks.md"
34
        },
35
        fixable: null,
36
        messages: {
37
            "noAsyncModuleCallbacks": "Do not call module with an async callback function."
38
        },
39
        schema: []
40
    },
41

42
    create: function (context) {
43
        return {
12✔
44
            "CallExpression": function (node) {
45
                if (utils.isModule(node.callee)) {
14✔
46
                    const callback = node.arguments[1];
12✔
47
                    if (callback && isAsyncFunctionExpression(callback)) {
12✔
48
                        context.report({
4✔
49
                            node: node,
50
                            messageId: "noAsyncModuleCallbacks",
51
                            data: {}
52
                        });
53
                    }
54
                }
55
            }
56
        };
57
    }
58
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc