From 2723b66735e82276114003ba9a25662ea21cc308 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Sat, 20 Aug 2022 18:59:16 -0400 Subject: [PATCH] fix: ensure rules bail out early when no rule present --- lib/rules/meta-property-ordering.js | 5 +++- lib/rules/no-missing-message-ids.js | 3 +++ lib/rules/no-missing-placeholders.js | 4 +++ lib/rules/no-unused-message-ids.js | 3 +++ lib/rules/no-unused-placeholders.js | 3 +++ lib/rules/prefer-message-ids.js | 7 +++--- lib/rules/prefer-object-rule.js | 5 +++- lib/rules/report-message-format.js | 9 +++++-- lib/rules/require-meta-docs-description.js | 12 ++++----- lib/rules/require-meta-docs-url.js | 12 ++++----- lib/rules/require-meta-has-suggestions.js | 7 +++--- lib/rules/require-meta-schema.js | 2 +- lib/rules/require-meta-type.js | 12 ++++----- tests/lib/rules/consistent-output.js | 10 ++++++++ tests/lib/rules/fixer-return.js | 1 + tests/lib/rules/meta-property-ordering.js | 1 + .../rules/no-deprecated-context-methods.js | 3 ++- tests/lib/rules/no-deprecated-report-api.js | 1 + tests/lib/rules/no-identical-tests.js | 10 ++++++++ tests/lib/rules/no-missing-message-ids.js | 1 + tests/lib/rules/no-missing-placeholders.js | 1 + tests/lib/rules/no-only-tests.js | 10 ++++++++ tests/lib/rules/no-unused-message-ids.js | 1 + tests/lib/rules/no-unused-placeholders.js | 1 + tests/lib/rules/no-useless-token-range.js | 25 +++++++++++-------- tests/lib/rules/prefer-message-ids.js | 1 + tests/lib/rules/prefer-object-rule.js | 1 + tests/lib/rules/prefer-output-null.js | 10 ++++++++ tests/lib/rules/prefer-placeholders.js | 1 + tests/lib/rules/prefer-replace-text.js | 1 + tests/lib/rules/report-message-format.js | 1 + .../rules/require-meta-docs-description.js | 3 ++- tests/lib/rules/require-meta-docs-url.js | 3 ++- tests/lib/rules/require-meta-schema.js | 1 + tests/lib/rules/require-meta-type.js | 1 + .../lib/rules/test-case-property-ordering.js | 10 ++++++++ .../lib/rules/test-case-shorthand-strings.js | 10 ++++++++ 37 files changed, 147 insertions(+), 45 deletions(-) diff --git a/lib/rules/meta-property-ordering.js b/lib/rules/meta-property-ordering.js index 2b8b4640..306d3361 100644 --- a/lib/rules/meta-property-ordering.js +++ b/lib/rules/meta-property-ordering.js @@ -36,6 +36,9 @@ module.exports = { create(context) { const sourceCode = context.getSourceCode(); const info = getRuleInfo(sourceCode); + if (!info) { + return {}; + } const order = context.options[0] || [ 'type', @@ -50,7 +53,7 @@ module.exports = { return { Program() { - if (!info || !info.meta || info.meta.properties.length < 2) { + if (!info.meta || info.meta.properties.length < 2) { return; } diff --git a/lib/rules/no-missing-message-ids.js b/lib/rules/no-missing-message-ids.js index e23382fb..cf0a61cf 100644 --- a/lib/rules/no-missing-message-ids.js +++ b/lib/rules/no-missing-message-ids.js @@ -29,6 +29,9 @@ module.exports = { const sourceCode = context.getSourceCode(); const { scopeManager } = sourceCode; const ruleInfo = utils.getRuleInfo(sourceCode); + if (!ruleInfo) { + return {}; + } const messagesNode = utils.getMessagesNode(ruleInfo, scopeManager); diff --git a/lib/rules/no-missing-placeholders.js b/lib/rules/no-missing-placeholders.js index 78b40491..7a7ad298 100644 --- a/lib/rules/no-missing-placeholders.js +++ b/lib/rules/no-missing-placeholders.js @@ -37,6 +37,10 @@ module.exports = { let contextIdentifiers; const ruleInfo = utils.getRuleInfo(sourceCode); + if (!ruleInfo) { + return {}; + } + const messagesNode = utils.getMessagesNode(ruleInfo, scopeManager); return { diff --git a/lib/rules/no-unused-message-ids.js b/lib/rules/no-unused-message-ids.js index 01fc262c..82c7c8ed 100644 --- a/lib/rules/no-unused-message-ids.js +++ b/lib/rules/no-unused-message-ids.js @@ -27,6 +27,9 @@ module.exports = { const sourceCode = context.getSourceCode(); const { scopeManager } = sourceCode; const info = utils.getRuleInfo(sourceCode); + if (!info) { + return {}; + } const messageIdsUsed = new Set(); let contextIdentifiers; diff --git a/lib/rules/no-unused-placeholders.js b/lib/rules/no-unused-placeholders.js index 97a66312..115a45d0 100644 --- a/lib/rules/no-unused-placeholders.js +++ b/lib/rules/no-unused-placeholders.js @@ -37,6 +37,9 @@ module.exports = { let contextIdentifiers; const ruleInfo = utils.getRuleInfo(sourceCode); + if (!ruleInfo) { + return {}; + } const messagesNode = utils.getMessagesNode(ruleInfo, scopeManager); return { diff --git a/lib/rules/prefer-message-ids.js b/lib/rules/prefer-message-ids.js index 8d80860b..5c810e00 100644 --- a/lib/rules/prefer-message-ids.js +++ b/lib/rules/prefer-message-ids.js @@ -30,6 +30,9 @@ module.exports = { create(context) { const sourceCode = context.getSourceCode(); const info = utils.getRuleInfo(sourceCode); + if (!info) { + return {}; + } let contextIdentifiers; @@ -44,10 +47,6 @@ module.exports = { ast ); - if (info === null) { - return; - } - const metaNode = info.meta; const messagesNode = metaNode && diff --git a/lib/rules/prefer-object-rule.js b/lib/rules/prefer-object-rule.js index edcada1d..55b7491f 100644 --- a/lib/rules/prefer-object-rule.js +++ b/lib/rules/prefer-object-rule.js @@ -34,10 +34,13 @@ module.exports = { const sourceCode = context.getSourceCode(); const ruleInfo = utils.getRuleInfo(sourceCode); + if (!ruleInfo) { + return {}; + } return { Program() { - if (!ruleInfo || ruleInfo.isNewStyle) { + if (ruleInfo.isNewStyle) { return; } diff --git a/lib/rules/report-message-format.js b/lib/rules/report-message-format.js index f98b78c2..ca62c2b7 100644 --- a/lib/rules/report-message-format.js +++ b/lib/rules/report-message-format.js @@ -57,18 +57,23 @@ module.exports = { } } + const sourceCode = context.getSourceCode(); + const ruleInfo = utils.getRuleInfo(sourceCode); + if (!ruleInfo) { + return {}; + } + // ---------------------------------------------------------------------- // Public // ---------------------------------------------------------------------- return { Program(ast) { - const sourceCode = context.getSourceCode(); contextIdentifiers = utils.getContextIdentifiers( sourceCode.scopeManager, ast ); - const ruleInfo = utils.getRuleInfo(sourceCode); + const messagesObject = ruleInfo && ruleInfo.meta && diff --git a/lib/rules/require-meta-docs-description.js b/lib/rules/require-meta-docs-description.js index 226efa33..a94c42e0 100644 --- a/lib/rules/require-meta-docs-description.js +++ b/lib/rules/require-meta-docs-description.js @@ -42,15 +42,15 @@ module.exports = { }, create(context) { + const sourceCode = context.getSourceCode(); + const info = utils.getRuleInfo(sourceCode); + if (!info) { + return {}; + } + return { Program() { - const sourceCode = context.getSourceCode(); const { scopeManager } = sourceCode; - const info = utils.getRuleInfo(sourceCode); - - if (info === null) { - return; - } const pattern = context.options[0] && context.options[0].pattern diff --git a/lib/rules/require-meta-docs-url.js b/lib/rules/require-meta-docs-url.js index a1955030..f6fe69e5 100644 --- a/lib/rules/require-meta-docs-url.js +++ b/lib/rules/require-meta-docs-url.js @@ -72,16 +72,16 @@ module.exports = { ); } + const sourceCode = context.getSourceCode(); + const info = util.getRuleInfo(sourceCode); + if (!info) { + return {}; + } + return { Program() { - const sourceCode = context.getSourceCode(); const { scopeManager } = sourceCode; - const info = util.getRuleInfo(sourceCode); - if (info === null) { - return; - } - const metaNode = info.meta; const docsPropNode = util .evaluateObjectProperties(metaNode, scopeManager) diff --git a/lib/rules/require-meta-has-suggestions.js b/lib/rules/require-meta-has-suggestions.js index 4c8a0cf4..b7023366 100644 --- a/lib/rules/require-meta-has-suggestions.js +++ b/lib/rules/require-meta-has-suggestions.js @@ -32,6 +32,9 @@ module.exports = { const sourceCode = context.getSourceCode(); const { scopeManager } = sourceCode; const ruleInfo = utils.getRuleInfo(sourceCode); + if (!ruleInfo) { + return {}; + } let contextIdentifiers; let ruleReportsSuggestions; @@ -58,10 +61,6 @@ module.exports = { return false; } - if (!ruleInfo) { - return {}; - } - return { Program(ast) { contextIdentifiers = utils.getContextIdentifiers(scopeManager, ast); diff --git a/lib/rules/require-meta-schema.js b/lib/rules/require-meta-schema.js index 2d0d3000..f1f4225a 100644 --- a/lib/rules/require-meta-schema.js +++ b/lib/rules/require-meta-schema.js @@ -44,7 +44,7 @@ module.exports = { const sourceCode = context.getSourceCode(); const { scopeManager } = sourceCode; const info = utils.getRuleInfo(sourceCode); - if (info === null) { + if (!info) { return {}; } diff --git a/lib/rules/require-meta-type.js b/lib/rules/require-meta-type.js index d06e6d62..d4ba50b2 100644 --- a/lib/rules/require-meta-type.js +++ b/lib/rules/require-meta-type.js @@ -38,15 +38,15 @@ module.exports = { // Public // ---------------------------------------------------------------------- + const sourceCode = context.getSourceCode(); + const info = utils.getRuleInfo(sourceCode); + if (!info) { + return {}; + } + return { Program() { - const sourceCode = context.getSourceCode(); const { scopeManager } = sourceCode; - const info = utils.getRuleInfo(sourceCode); - - if (info === null) { - return; - } const metaNode = info.meta; const typeNode = utils diff --git a/tests/lib/rules/consistent-output.js b/tests/lib/rules/consistent-output.js index 535dd9cf..844fde15 100644 --- a/tests/lib/rules/consistent-output.js +++ b/tests/lib/rules/consistent-output.js @@ -68,6 +68,16 @@ ruleTester.run('consistent-output', rule, { `, options: ['always'], }, + ` + new NotRuleTester().run('foo', bar, { + valid: [], + invalid: [{code: 'foo', output: 'baz', errors: ['bar']},{code: 'foo', errors: ['bar']}] + });`, // Not RuleTester. + ` + new RuleTester().notRun('foo', bar, { + valid: [], + invalid: [{code: 'foo', output: 'baz', errors: ['bar']},{code: 'foo', errors: ['bar']}] + });`, // Not run() from RuleTester. ], invalid: [ diff --git a/tests/lib/rules/fixer-return.js b/tests/lib/rules/fixer-return.js index 76f833b2..62f66fb8 100644 --- a/tests/lib/rules/fixer-return.js +++ b/tests/lib/rules/fixer-return.js @@ -270,6 +270,7 @@ ruleTester.run('fixer-return', rule, { } }; `, + `module.exports = {};`, // Not a rule. ], invalid: [ diff --git a/tests/lib/rules/meta-property-ordering.js b/tests/lib/rules/meta-property-ordering.js index ac3510af..830371fd 100644 --- a/tests/lib/rules/meta-property-ordering.js +++ b/tests/lib/rules/meta-property-ordering.js @@ -72,6 +72,7 @@ ruleTester.run('test-case-property-ordering', rule, { create() {}, };`, 'module.exports = { create() {} };', // No `meta`. + 'module.exports = {};', // No rule; ], invalid: [ diff --git a/tests/lib/rules/no-deprecated-context-methods.js b/tests/lib/rules/no-deprecated-context-methods.js index 0e89963f..b325b9ae 100644 --- a/tests/lib/rules/no-deprecated-context-methods.js +++ b/tests/lib/rules/no-deprecated-context-methods.js @@ -32,7 +32,8 @@ ruleTester.run('no-deprecated-context-methods', rule, { sourceCode.getFirstToken(); return {}; } - `, + `, + `module.exports = {};`, // Not a rule. ], invalid: [ diff --git a/tests/lib/rules/no-deprecated-report-api.js b/tests/lib/rules/no-deprecated-report-api.js index 58319b89..e409b9a0 100644 --- a/tests/lib/rules/no-deprecated-report-api.js +++ b/tests/lib/rules/no-deprecated-report-api.js @@ -78,6 +78,7 @@ ruleTester.run('no-deprecated-report-api', rule, { } }; `, + `module.exports = {};`, // Not a rule. ], invalid: [ diff --git a/tests/lib/rules/no-identical-tests.js b/tests/lib/rules/no-identical-tests.js index 6aa76be2..0e15d1b4 100644 --- a/tests/lib/rules/no-identical-tests.js +++ b/tests/lib/rules/no-identical-tests.js @@ -67,6 +67,16 @@ ruleTester.run('no-identical-tests', rule, { invalid: [] }); `, + ` + new NotRuleTester().run('foo', bar, { + valid: [], + invalid: [{code: 'foo', output: 'baz', errors: ['bar']},{code: 'foo', output: 'baz', errors: ['bar']}] + });`, // Not RuleTester. + ` + new RuleTester().notRun('foo', bar, { + valid: [], + invalid: [{code: 'foo', output: 'baz', errors: ['bar']},{code: 'foo', output: 'baz', errors: ['bar']}] + });`, // Not run() from RuleTester. ], invalid: [ diff --git a/tests/lib/rules/no-missing-message-ids.js b/tests/lib/rules/no-missing-message-ids.js index 02cd8a05..6b43a7d6 100644 --- a/tests/lib/rules/no-missing-message-ids.js +++ b/tests/lib/rules/no-missing-message-ids.js @@ -238,6 +238,7 @@ ruleTester.run('no-missing-message-ids', rule, { } }; `, + 'module.exports = {};', // No rule. ], invalid: [ diff --git a/tests/lib/rules/no-missing-placeholders.js b/tests/lib/rules/no-missing-placeholders.js index 4a42b5ab..858fa232 100644 --- a/tests/lib/rules/no-missing-placeholders.js +++ b/tests/lib/rules/no-missing-placeholders.js @@ -222,6 +222,7 @@ ruleTester.run('no-missing-placeholders', rule, { } }; `, + `module.exports = {};`, // No rule. ], invalid: [ diff --git a/tests/lib/rules/no-only-tests.js b/tests/lib/rules/no-only-tests.js index 007491fd..24efa23d 100644 --- a/tests/lib/rules/no-only-tests.js +++ b/tests/lib/rules/no-only-tests.js @@ -43,6 +43,16 @@ ruleTester.run('no-only-tests', rule, { ] }); `, + ` + new NotRuleTester().run('foo', bar, { + valid: [{ code: 'foo', only: true },], + invalid: [] + });`, // Not RuleTester. + ` + new RuleTester().notRun('foo', bar, { + valid: [{ code: 'foo', only: true },], + invalid: [] + });`, // Not run() from RuleTester. ], invalid: [ diff --git a/tests/lib/rules/no-unused-message-ids.js b/tests/lib/rules/no-unused-message-ids.js index 52e3f80c..82f9df8f 100644 --- a/tests/lib/rules/no-unused-message-ids.js +++ b/tests/lib/rules/no-unused-message-ids.js @@ -271,6 +271,7 @@ ruleTester.run('no-unused-message-ids', rule, { } }; `, + 'module.exports = {};', // No rule. ], invalid: [ diff --git a/tests/lib/rules/no-unused-placeholders.js b/tests/lib/rules/no-unused-placeholders.js index a3c0f6c5..a57a4274 100644 --- a/tests/lib/rules/no-unused-placeholders.js +++ b/tests/lib/rules/no-unused-placeholders.js @@ -197,6 +197,7 @@ ruleTester.run('no-unused-placeholders', rule, { } }; `, + 'module.exports = {};', // No rule. ], invalid: [ diff --git a/tests/lib/rules/no-useless-token-range.js b/tests/lib/rules/no-useless-token-range.js index 5b756606..1ef59734 100644 --- a/tests/lib/rules/no-useless-token-range.js +++ b/tests/lib/rules/no-useless-token-range.js @@ -81,17 +81,20 @@ const INVALID_CASES = [ const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); ruleTester.run('no-useless-token-range', rule, { valid: [ - 'sourceCode.getLastToken(foo).range[0]', - 'sourceCode.getFirstToken(foo).range[1]', - 'sourceCode.getLastToken(foo).start', - 'sourceCode.getFirstToken(foo).end', - 'sourceCode.getSomethingElse(foo).range[0]', - 'notSourceCode.getFirstToken(foo).range[0]', - 'sourceCode.getFirstToken(foo, bar).range[0]', - 'sourceCode.getFirstToken(foo, { skip: 1 }).start', - 'sourceCode.getLastToken(foo, bar).range[1]', - 'sourceCode.getLastToken(foo, { skip: 1 }).end', - ].map(wrapRule), + ...[ + 'sourceCode.getLastToken(foo).range[0]', + 'sourceCode.getFirstToken(foo).range[1]', + 'sourceCode.getLastToken(foo).start', + 'sourceCode.getFirstToken(foo).end', + 'sourceCode.getSomethingElse(foo).range[0]', + 'notSourceCode.getFirstToken(foo).range[0]', + 'sourceCode.getFirstToken(foo, bar).range[0]', + 'sourceCode.getFirstToken(foo, { skip: 1 }).start', + 'sourceCode.getLastToken(foo, bar).range[1]', + 'sourceCode.getLastToken(foo, { skip: 1 }).end', + ].map(wrapRule), + 'module.exports = {};', // Not a rule. + ], invalid: [ ...INVALID_CASES, diff --git a/tests/lib/rules/prefer-message-ids.js b/tests/lib/rules/prefer-message-ids.js index 6372f00e..34a2ac23 100644 --- a/tests/lib/rules/prefer-message-ids.js +++ b/tests/lib/rules/prefer-message-ids.js @@ -122,6 +122,7 @@ ruleTester.run('prefer-message-ids', rule, { } }; `, + 'module.exports = {};', // No rule. ], invalid: [ diff --git a/tests/lib/rules/prefer-object-rule.js b/tests/lib/rules/prefer-object-rule.js index b3eb6336..4b7bd7de 100644 --- a/tests/lib/rules/prefer-object-rule.js +++ b/tests/lib/rules/prefer-object-rule.js @@ -79,6 +79,7 @@ ruleTester.run('prefer-object-rule', rule, { `, parserOptions: { sourceType: 'module' }, }, + 'module.exports = {};', // No rule. ], invalid: [ diff --git a/tests/lib/rules/prefer-output-null.js b/tests/lib/rules/prefer-output-null.js index dacb6155..4fd5014d 100644 --- a/tests/lib/rules/prefer-output-null.js +++ b/tests/lib/rules/prefer-output-null.js @@ -56,6 +56,16 @@ ruleTester.run('prefer-output-null', rule, { ] }); `, + ` + new NotRuleTester().run('foo', bar, { + valid: [], + invalid: [{ code: 'foo', output: 'foo' },] + });`, // Not RuleTester. + ` + new RuleTester().notRun('foo', bar, { + valid: [], + invalid: [{ code: 'foo', output: 'foo' },] + });`, // Not run() from RuleTester. ], invalid: [ diff --git a/tests/lib/rules/prefer-placeholders.js b/tests/lib/rules/prefer-placeholders.js index c9ef140b..a2a3ca4f 100644 --- a/tests/lib/rules/prefer-placeholders.js +++ b/tests/lib/rules/prefer-placeholders.js @@ -114,6 +114,7 @@ ruleTester.run('prefer-placeholders', rule, { } }; `, + `module.exports = {};`, // Not a rule. ], invalid: [ diff --git a/tests/lib/rules/prefer-replace-text.js b/tests/lib/rules/prefer-replace-text.js index b38aead8..08a779c8 100644 --- a/tests/lib/rules/prefer-replace-text.js +++ b/tests/lib/rules/prefer-replace-text.js @@ -67,6 +67,7 @@ ruleTester.run('prefer-placeholders', rule, { } }; `, + `module.exports = {};`, // Not a rule. ], invalid: [ diff --git a/tests/lib/rules/report-message-format.js b/tests/lib/rules/report-message-format.js index 1fed0869..5a5c2f0d 100644 --- a/tests/lib/rules/report-message-format.js +++ b/tests/lib/rules/report-message-format.js @@ -183,6 +183,7 @@ ruleTester.run('report-message-format', rule, { `, options: ['foo'], }, + 'module.exports = {};', // No rule. ], invalid: [ diff --git a/tests/lib/rules/require-meta-docs-description.js b/tests/lib/rules/require-meta-docs-description.js index 1b40d7e2..716eaa84 100644 --- a/tests/lib/rules/require-meta-docs-description.js +++ b/tests/lib/rules/require-meta-docs-description.js @@ -14,7 +14,8 @@ const RuleTester = require('eslint').RuleTester; const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 9 } }); ruleTester.run('require-meta-docs-description', rule, { valid: [ - 'foo()', + 'foo()', // No rule. + 'module.exports = {};', // No rule. ` module.exports = { meta: { docs: { description: 'disallow unused variables' } }, diff --git a/tests/lib/rules/require-meta-docs-url.js b/tests/lib/rules/require-meta-docs-url.js index 7aae0093..a6ba0f52 100644 --- a/tests/lib/rules/require-meta-docs-url.js +++ b/tests/lib/rules/require-meta-docs-url.js @@ -25,7 +25,8 @@ const tester = new RuleTester({ tester.run('require-meta-docs-url', rule, { valid: [ - 'foo()', + 'foo()', // No rule. + 'module.exports = {};', // No rule. ` module.exports.meta = {docs: {url: ""}} module.exports.create = function() {} diff --git a/tests/lib/rules/require-meta-schema.js b/tests/lib/rules/require-meta-schema.js index 8558c7d7..ca11074e 100644 --- a/tests/lib/rules/require-meta-schema.js +++ b/tests/lib/rules/require-meta-schema.js @@ -154,6 +154,7 @@ ruleTester.run('require-meta-schema', rule, { create(context) {} }; `, + 'module.exports = {};', // No rule. ], invalid: [ diff --git a/tests/lib/rules/require-meta-type.js b/tests/lib/rules/require-meta-type.js index e4bfbd71..67babf4c 100644 --- a/tests/lib/rules/require-meta-type.js +++ b/tests/lib/rules/require-meta-type.js @@ -84,6 +84,7 @@ ruleTester.run('require-meta-type', rule, { create(context) {} }; `, + 'module.exports = {};', // No rule. ], invalid: [ diff --git a/tests/lib/rules/test-case-property-ordering.js b/tests/lib/rules/test-case-property-ordering.js index 3ee1dee2..996df162 100644 --- a/tests/lib/rules/test-case-property-ordering.js +++ b/tests/lib/rules/test-case-property-ordering.js @@ -58,6 +58,16 @@ ruleTester.run('test-case-property-ordering', rule, { `, options: [['code', 'errors', 'options', 'output', 'parserOptions']], }, + ` + new NotRuleTester().run('foo', bar, { + valid: [{ code: "foo", options: ["baz"], output: "bar", }], + invalid: [] + });`, // Not RuleTester. + ` + new RuleTester().notRun('foo', bar, { + valid: [{ code: "foo", options: ["baz"], output: "bar", }], + invalid: [] + });`, // Not run() from RuleTester. ], invalid: [ diff --git a/tests/lib/rules/test-case-shorthand-strings.js b/tests/lib/rules/test-case-shorthand-strings.js index f97b75a2..c494480f 100644 --- a/tests/lib/rules/test-case-shorthand-strings.js +++ b/tests/lib/rules/test-case-shorthand-strings.js @@ -136,6 +136,16 @@ ruleTester.run('test-case-shorthand-strings', rule, { code: getTestCases(['"foo"', "'bar'", '`baz`']), options: ['consistent-as-needed'], }, + ` + new NotRuleTester().run('foo', bar, { + valid: [{ code: 'foo' }], + invalid: [] + });`, // Not RuleTester. + ` + new RuleTester().notRun('foo', bar, { + valid: [{ code: 'foo' }], + invalid: [] + });`, // Not run() from RuleTester. ], invalid: [