Repository: eslint/eslint
File: tests/lib/rules/lines-around-comment.js (JavaScript)

Code before:
            code: "foo\n/* this is pragmatic */",
            options: [{ ignorePattern: "pragma" }]
        },
        {
            code: "foo\n/* this is pragmatic */",
            options: [{ applyDefaultIgnorePatterns: false, ignorePattern: "pragma" }]
        },

        // Hashbang comment
        {
            code: "#!comment\n\nvar a = 1;",
            options: [{ afterHashbangComment: true }]
        }
    ],

    invalid: [

        // default rules
        {
            code: "bar()\n/** block block block\n * block \n */\nvar a = 1;",
            output: "bar()\n\n/** block block block\n * block \n */\nvar a = 1;",
            errors: [{ messageId: "before", type: "Block" }]
        },

        // line comments
        {
            code: "baz()\n// A line comment with no empty line after\nvar a = 1;",
            output: "baz()\n// A line comment with no empty line after\n\nvar a = 1;",
            options: [{ afterLineComment: true }],
            errors: [{ messageId: "after", type: "Line" }]
        },
        {
            code: "baz()\n// A line comment with no empty line after\nvar a = 1;",
            output: "baz()\n\n// A line comment with no empty line after\nvar a = 1;",
            options: [{ beforeLineComment: true, afterLineComment: false }],
            errors: [{ messageId: "before", type: "Line" }]
        },
        {
            code: "// A line comment with no empty line after\nvar a = 1;",
            output: "// A line comment with no empty line after\n\nvar a = 1;",
            options: [{ beforeLineComment: true, afterLineComment: true }],
            errors: [{ messageId: "after", type: "Line", line: 1, column: 1 }]
        },
        {
            code: "baz()\n// A line comment with no empty line after\nvar a = 1;",
            output: "baz()\n\n// A line comment with no empty line after\n\nvar a = 1;",
            options: [{ beforeLineComment: true, afterLineComment: true }],
            errors: [{ messageId: "before", type: "Line", line: 2 }, { messageId: "after", type: "Line", line: 2 }]
        },

        // block comments

Review comment (suggestion):
```suggestion
        },
        "#!comment\nvar a = 1;",
        {
            code: "#!comment\nvar a = 1;",
            options: [{}]
        },
        {
            code: "#!comment\nvar a = 1;",
            options: [{ afterHashbangComment: false }]
        },
        {
            code: "#!comment\nvar a = 1;",
            options: [{ afterLineComment: true, afterBlockComment: true }]
        }
```

A few tests to ensure that the rule doesn't require line after hashbang if `afterHashbangComment` isn't set to `true`.

Code after:
            code: "foo\n/* this is pragmatic */",
            options: [{ ignorePattern: "pragma" }]
        },
        {
            code: "foo\n/* this is pragmatic */",
            options: [{ applyDefaultIgnorePatterns: false, ignorePattern: "pragma" }]
        },

        // Hashbang comment
        {
            code: "#!comment\n\nvar a = 1;",
            options: [{ afterHashbangComment: true }]
        },
        "#!comment\nvar a = 1;",
        {
            code: "#!comment\nvar a = 1;",
            options: [{}]
        },
        {
            code: "#!comment\nvar a = 1;",
            options: [{ afterHashbangComment: false }]
        },
        {
            code: "#!comment\nvar a = 1;",
            options: [{ afterLineComment: true, afterBlockComment: true }]
        }
    ],

    invalid: [

        // default rules
        {
            code: "bar()\n/** block block block\n * block \n */\nvar a = 1;",
            output: "bar()\n\n/** block block block\n * block \n */\nvar a = 1;",
            errors: [{ messageId: "before", type: "Block" }]
        },

        // line comments
        {
            code: "baz()\n// A line comment with no empty line after\nvar a = 1;",
            output: "baz()\n// A line comment with no empty line after\n\nvar a = 1;",
            options: [{ afterLineComment: true }],
            errors: [{ messageId: "after", type: "Line" }]
        },
        {
            code: "baz()\n// A line comment with no empty line after\nvar a = 1;",
            output: "baz()\n\n// A line comment with no empty line after\nvar a = 1;",
            options: [{ beforeLineComment: true, afterLineComment: false }],
            errors: [{ messageId: "before", type: "Line" }]
        },
        {