Sha256: 8b204c0b0ecabfa6b36a779623e5e520560933a728f984220ec6b5b0978e0210

Contents?: true

Size: 1.4 KB

Versions: 43

Compression:

Stored size: 1.4 KB

Contents

/**
 * @author Toru Nagashima
 * See LICENSE file in root directory for full license.
 */
"use strict"

const checkExistence = require("../util/check-existence")
const getAllowModules = require("../util/get-allow-modules")
const getRequireTargets = require("../util/get-require-targets")
const getResolvePaths = require("../util/get-resolve-paths")
const getTryExtensions = require("../util/get-try-extensions")

module.exports = {
    meta: {
        docs: {
            description: "disallow `require()` expressions of missing files",
            category: "Possible Errors",
            recommended: true,
            url:
                "https://github.com/mysticatea/eslint-plugin-node/blob/v7.0.1/docs/rules/no-missing-require.md",
        },
        fixable: null,
        schema: [
            {
                type: "object",
                properties: {
                    allowModules: getAllowModules.schema,
                    tryExtensions: getTryExtensions.schema,
                    resolvePaths: getResolvePaths.schema,
                },
                additionalProperties: false,
            },
        ],
    },
    create(context) {
        const filePath = context.getFilename()
        if (filePath === "<input>") {
            return {}
        }

        return {
            "Program:exit"() {
                checkExistence(context, getRequireTargets(context))
            },
        }
    },
}

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
govuk_publishing_components-18.0.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.21.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.20.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.19.1 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.19.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.18.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.17.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.16.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.15.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.14.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.13.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.12.2 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.12.1 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.12.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.11.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.10.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.9.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.8.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.7.0 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js
govuk_publishing_components-17.6.1 node_modules/eslint-plugin-node/lib/rules/no-missing-require.js