<commit_before>/**
 * @fileoverview Tests for no-extra-semi rule.
 * @author <NAME>
 */

"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

var rule = require("../../../lib/rules/no-extra-semi"),
    RuleTester = require("../../../lib/testers/rule-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var ruleTester = new RuleTester();
ruleTester.run("no-extra-semi", rule, {
    valid: [
        "var x = 5;",
        "function foo(){}",
        "for(;;);",
        "while(0);",
        "do;while(0);",
        "for(a in b);",
        { code: "for(a of b);", parserOptions: { ecmaVersion: 6 } },

        // Class body.
        {code: "class A { }", parserOptions: { ecmaVersion: 6 }},
        {code: "var A = class { };", parserOptions: { ecmaVersion: 6 }},
        {code: "class A { a() { this; } }", parserOptions: { ecmaVersion: 6 }},
        {code: "var A = class { a() { this; } };", parserOptions: { ecmaVersion: 6 }},
        {code: "class A { } a;", parserOptions: { ecmaVersion: 6 }}<commit_msg>Update: Add module tests to no-extra-semi (fixes #4915)<commit_after>/**
 * @fileoverview Tests for no-extra-semi rule.
 * @author <NAME>
 */

"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

var rule = require("../../../lib/rules/no-extra-semi"),
    RuleTester = require("../../../lib/testers/rule-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var ruleTester = new RuleTester();
ruleTester.run("no-extra-semi", rule, {
    valid: [
        "var x = 5;",
        "function foo(){}",
        "for(;;);",
        "while(0);",
        "do;while(0);",
        "for(a in b);",
        { code: "for(a of b);", parserOptions: { ecmaVersion: 6 } },

        // Class body.
        {code: "class A { }", parserOptions: { ecmaVersion: 6 }},
        {code: "var A = class { };", parserOptions: { ecmaVersion: 6 }},
        {code: "class A { a() { this; } }", parserOptions: { ecmaVersion: 6 }},
        {code: "var A = class { a() { this; } };", parserOptions: { ecmaVersion: 6 }},
        {code: "class A { } a;", parserOptions: { ecmaVersion: 6 }},

        // modules
        {code: "export const x = 42;", parserOptions: { sourceType: "module" }},
        {code: "export default 42;", parserOptions: { sourceType: "module" }}
{'fraction_non_alphanumeric': 0.39532374100719425, 'fraction_numerical': 0.00935251798561151, 'mean_word_length': 1.1846032992930087, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3809250', 'n_tokens_mistral': 786, 'n_tokens_neox': 755, 'n_words': 185}