Sha256: 908c9ee4669578e19df1849c5983d8b8995f20642b570cf1d43c610595264af2

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

/**
 * @fileoverview disallow using an async function as a Promise executor
 * @author Teddy Katz
 */
"use strict";

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------

/** @type {import('../shared/types').Rule} */
module.exports = {
    meta: {
        type: "problem",

        docs: {
            description: "disallow using an async function as a Promise executor",
            recommended: true,
            url: "https://eslint.org/docs/rules/no-async-promise-executor"
        },

        fixable: null,
        schema: [],
        messages: {
            async: "Promise executor functions should not be async."
        }
    },

    create(context) {
        return {
            "NewExpression[callee.name='Promise'][arguments.0.async=true]"(node) {
                context.report({
                    node: context.getSourceCode().getFirstToken(node.arguments[0], token => token.value === "async"),
                    messageId: "async"
                });
            }
        };
    }
};

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-0.27.1 packages/webpacker/node_modules/eslint/lib/rules/no-async-promise-executor.js
decidim-0.26.4 packages/webpacker/node_modules/eslint/lib/rules/no-async-promise-executor.js
decidim-0.27.0 packages/webpacker/node_modules/eslint/lib/rules/no-async-promise-executor.js
decidim-0.26.3 packages/webpacker/node_modules/eslint/lib/rules/no-async-promise-executor.js
decidim-0.27.0.rc2 packages/webpacker/node_modules/eslint/lib/rules/no-async-promise-executor.js
decidim-0.27.0.rc1 packages/webpacker/node_modules/eslint/lib/rules/no-async-promise-executor.js