diff --git a/tests/tools/internal-rules/consistent-docs-url.js b/tests/tools/internal-rules/consistent-docs-url.js index 3d95dac065a..cccbc95ac8f 100644 --- a/tests/tools/internal-rules/consistent-docs-url.js +++ b/tests/tools/internal-rules/consistent-docs-url.js @@ -43,6 +43,23 @@ ruleTester.run("consistent-docs-url", rule, { ].join("\n") ], invalid: [ + { + code: [ + "module.exports = {", + " meta: {", + " },", + + " create: function(context) {", + " return {};", + " }", + "};" + ].join("\n"), + errors: [{ + message: "Rule is missing a meta.docs property", + line: 2, + column: 5 + }] + }, { code: [ "module.exports = {", diff --git a/tools/internal-rules/consistent-docs-url.js b/tools/internal-rules/consistent-docs-url.js index ae7fe67d3d5..0082ecf7629 100644 --- a/tools/internal-rules/consistent-docs-url.js +++ b/tools/internal-rules/consistent-docs-url.js @@ -48,6 +48,14 @@ function checkMetaDocsUrl(context, exportsNode) { const metaDocs = metaProperty && getPropertyFromObject("docs", metaProperty.value); const metaDocsUrl = metaDocs && getPropertyFromObject("url", metaDocs.value); + if (!metaDocs) { + context.report({ + node: metaProperty, + message: "Rule is missing a meta.docs property" + }); + return; + } + if (!metaDocsUrl) { context.report({ node: metaDocs,