ronantakizawa/codereview-bench huggingface dataset:
Repository: eslint/eslint
File: tests/lib/rules/no-fallthrough.js (JavaScript)

Code before:
    case 1:
        doSomething();
        break;
    // falls through
    case 2: doSomething();
}`,
            options: [{ reportUnusedFallthroughComment: true }],
            errors: [
                {
                    line: 6,
                    messageId: "unusedFallthroughComment"
                }
            ]
        }, {
            code: `
function f() {
    switch(foo){
        case 1:
            if (a) {
                throw new Error();
            } else if (b) {
                break;
            } else {
                return;
            }
        // falls through
        case 2:
            break;
    }
}`,
            options: [{ reportUnusedFallthroughComment: true }],
            errors: [
                {
                    line: 12,
                    messageId: "unusedFallthroughComment"
                }
            ]
        }
    ]
});


Review comment (suggestion):
Can you also add a test where a fallthrough comment in a block is reported, for example:

```js
        {
            code: `
switch (foo) {
    case 0: {
        a();
        break;
        // falls through
    }
    case 1:
        b();
}`,
            options: [{ reportUnusedFallthroughComment: true }],
            errors: [
                {
                    line: 6,
                    messageId: "unusedFallthroughComment"
                }
            ]
        },
```

Code after:
}`,
            options: [{ reportUnusedFallthroughComment: true }],
            errors: [
                {
                    line: 6,
                    messageId: "unusedFallthroughComment"
                }
            ]
        },
        {
            code: `
switch(foo){
    case 1:
        doSomething();
        break;
    // falls through
    case 2: doSomething();
}`,
            options: [{ reportUnusedFallthroughComment: true }],
            errors: [
                {
                    line: 6,
                    messageId: "unusedFallthroughComment"
                }
            ]
        }, {
            code: `
function f() {
    switch(foo){
        case 1:
            if (a) {
                throw new Error();
            } else if (b) {
                break;
            } else {
                return;
            }
        // falls through
        case 2:
            break;
    }
}`,
            options: [{ reportUnusedFallthroughComment: true }],
            errors: [
                {
                    line: 12,
                    messageId: "unusedFallthroughComment"
                }
            ]
        },
        {
Repository: eslint/eslint
File: tests/lib/rules/no-fallthrough.js (JavaScript)

Code before:
            code: "switch(foo) { case 0: while (a) { break; } default: b() }",
            errors: errorsDefault
        },
        {
            code: "switch(foo) { case 0: do { break; } while (a); default: b() }",
            errors: errorsDefault
        },
        {
            code: "switch(foo) { case 0:\n\n default: b() }",
            errors: errorsDefault
        },
        {
            code: "switch(foo) { case 0: {} default: b() }",
            errors: errorsDefault
        },
        {
            code: "switch(foo) { case 0: a(); { /* falls through */ } default: b() }",
            errors: errorsDefault
        },
        {
            code: "switch(foo) { case 0: { /* falls through */ } a(); default: b() }",
            errors: errorsDefault
        },
        {
            code: "switch(foo) { case 0: if (a) { /* falls through */ } default: b() }",
            errors: errorsDefault
        },
        {
            code: "switch(foo) { case 0: { { /* falls through */ } } default: b() }",
            errors: errorsDefault
        },
        {
            code: "switch(foo) { case 0: { /* comment */ } default: b() }",
            errors: errorsDefault
        },
        {
            code: "switch(foo) { case 0:\n // comment\n default: b() }",
            errors: errorsDefault
        },
        {
            code: "switch(foo) { case 0: a(); /* falling through */ default: b() }",
            errors: errorsDefault
        },
        {
            code: "switch(foo) { case 0: a();\n/* no break */\ncase 1: b(); }",
            options: [{
                commentPattern: "break omitted"
            }],
            errors: [
                {
                    messageId: "case",

Review comment (suggestion):
i think we should add this case in the docs `correct` section where `/* fallthrough */ comments are allowed to show they don't permit fallthrough over cases

Code after:
        break;
        // falls through
}
switch (bar) {
    case 1:
        b();
}
            `,
            options: [{ reportUnusedFallthroughComment: true }]
        },
        {
            code:
        `
switch (foo) {
    case 0:
        a();
        break;
        /* falls through */
}
switch (bar) {
    case 1:
        b();
}
            `,
            options: [{ reportUnusedFallthroughComment: true }]
        },
        {
            code: `
switch(foo){
    case 1:
        doSomething();
        break;
    // just a comment
    case 2: doSomething();
}
          `,
            options: [{ reportUnusedFallthroughComment: true }]

        },
        {
            code: `
switch(foo){
    case 1:
        doSomething();
        break;
}

function f() {
    switch(foo){
        // falls through comment should not false positive
        case 1:
Repository: eslint/eslint
File: tests/lib/options.js (JavaScript)

Code before:
    });

    describe("--no-warn-ignored", () => {
        it("should return false when --no-warn-ignored is passed", () => {
            const currentOptions = flatOptions.parse("--no-warn-ignored");

            assert.isFalse(currentOptions.warnIgnored);
        });

        it("should return true when --warn-ignored is passed", () => {
            const currentOptions = flatOptions.parse("--warn-ignored");

            assert.isTrue(currentOptions.warnIgnored);
        });
    });

    describe("--stats", () => {
        it("should return true --stats is passed", () => {
            const currentOptions = flatOptions.parse("--stats");

            assert.isTrue(currentOptions.stats);
        });
    });

    describe("--inspect-config", () => {
        it("should return true --inspect-config is passed", () => {
            const currentOptions = flatOptions.parse("--inspect-config");

            assert.isTrue(currentOptions.inspectConfig);
        });
    });

});


Review comment (suggestion):
```suggestion
        it("should return true when --inspect-config is passed", () => {
```

Code after:
    });

    describe("--no-warn-ignored", () => {
        it("should return false when --no-warn-ignored is passed", () => {
            const currentOptions = flatOptions.parse("--no-warn-ignored");

            assert.isFalse(currentOptions.warnIgnored);
        });

        it("should return true when --warn-ignored is passed", () => {
            const currentOptions = flatOptions.parse("--warn-ignored");

            assert.isTrue(currentOptions.warnIgnored);
        });
    });

    describe("--stats", () => {
        it("should return true --stats is passed", () => {
            const currentOptions = flatOptions.parse("--stats");

            assert.isTrue(currentOptions.stats);
        });
    });

    describe("--inspect-config", () => {
        it("should return true when --inspect-config is passed", () => {
            const currentOptions = flatOptions.parse("--inspect-config");

            assert.isTrue(currentOptions.inspectConfig);
        });
    });

});
Repository: eslint/eslint
File: lib/rules/object-shorthand.js (JavaScript)

Code before:
                            const lastKeyToken = sourceCode.getLastToken(node.key);

                            // x: /* */ x
                            if (sourceCode.commentsExistBetween(lastKeyToken, node.value)) {
                                return null;
                            }

                            return fixer.replaceText(node, node.value.name);
                        }
                    });
                } else if (node.value.type === "Identifier" && node.key.type === "Literal" && node.key.value === node.value.name && APPLY_TO_PROPS) {
                    if (AVOID_QUOTES) {
                        return;
                    }

                    // {"x": x} should be written as {x}
                    context.report({
                        node,
                        messageId: "expectedPropertyShorthand",
                        fix(fixer) {
                            const lastKeyToken = sourceCode.getLastToken(node.key);

                            // "x": /* */ x
                            if (sourceCode.commentsExistBetween(lastKeyToken, node.value)) {
                                return null;
                            }

                            return fixer.replaceText(node, node.value.name);
                        }
                    });
                }
            }
        };
    }
};


Review comment (suggestion):
```suggestion

                            // "x": /* */ x
                            if (sourceCode.commentsExistBetween(node.key, node.value)) {
                                return null;
                            }
```

Same here.

Code after:

                            // x: /* */ x
                            // x: (/* */ x)
                            if (sourceCode.getCommentsInside(node).length > 0) {
                                return null;
                            }

                            return fixer.replaceText(node, node.value.name);
                        }
                    });
                } else if (node.value.type === "Identifier" && node.key.type === "Literal" && node.key.value === node.value.name && APPLY_TO_PROPS) {
                    if (AVOID_QUOTES) {
                        return;
                    }

                    // {"x": x} should be written as {x}
                    context.report({
                        node,
                        messageId: "expectedPropertyShorthand",
                        fix(fixer) {

                            // "x": /* */ x
                            // "x": (/* */ x)
                            if (sourceCode.getCommentsInside(node).length > 0) {
                                return null;
                            }

                            return fixer.replaceText(node, node.value.name);
                        }
                    });
                }
            }
        };
    }
};
Repository: eslint/eslint
File: lib/rules/object-shorthand.js (JavaScript)

Code before:
                    context.report({
                        node,
                        messageId: "expectedPropertyShorthand",
                        fix(fixer) {

                            // x: /* */ x
                            if (sourceCode.commentsExistBetween(node.key, node.value)) {
                                return null;
                            }

                            return fixer.replaceText(node, node.value.name);
                        }
                    });
                } else if (node.value.type === "Identifier" && node.key.type === "Literal" && node.key.value === node.value.name && APPLY_TO_PROPS) {
                    if (AVOID_QUOTES) {
                        return;
                    }

                    // {"x": x} should be written as {x}
                    context.report({
                        node,
                        messageId: "expectedPropertyShorthand",
                        fix(fixer) {

                            // "x": /* */ x
                            if (sourceCode.commentsExistBetween(node.key, node.value)) {
                                return null;
                            }

                            return fixer.replaceText(node, node.value.name);
                        }
                    });
                }
            }
        };
    }
};


Review comment (suggestion):
```suggestion
                            if (sourceCode.getCommentsInside(node).length > 0) {
```

Same here.

Code after:
                    context.report({
                        node,
                        messageId: "expectedPropertyShorthand",
                        fix(fixer) {

                            // x: /* */ x
                            // x: (/* */ x)
                            if (sourceCode.getCommentsInside(node).length > 0) {
                                return null;
                            }

                            return fixer.replaceText(node, node.value.name);
                        }
                    });
                } else if (node.value.type === "Identifier" && node.key.type === "Literal" && node.key.value === node.value.name && APPLY_TO_PROPS) {
                    if (AVOID_QUOTES) {
                        return;
                    }

                    // {"x": x} should be written as {x}
                    context.report({
                        node,
                        messageId: "expectedPropertyShorthand",
                        fix(fixer) {

                            // "x": /* */ x
                            // "x": (/* */ x)
                            if (sourceCode.getCommentsInside(node).length > 0) {
                                return null;
                            }

                            return fixer.replaceText(node, node.value.name);
                        }
                    });
                }
            }
        };
    }
};
Repository: eslint/eslint
File: messages/all-matched-files-ignored.js (JavaScript)

Code before:
"use strict";

module.exports = function(it) {
    const { pattern } = it;

    return `
You are linting "${pattern}", but all of the files matching the glob pattern "${pattern}" are ignored.

If you don't want to lint these files, remove the pattern "${pattern}" from the list of arguments passed to ESLint.

If you do want to lint these files, explicitly list one or more of the files from this glob that you'd like to lint to see more details about why they are ignored.

  * If the file is ignored because of a matching ignore pattern, check global ignores in your config file.

    https://eslint.org/docs/latest/use/configure/ignore

  * If the file is ignored because no matching configuration was supplied, check file patterns in your config file.

    https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-with-arbitrary-extensions

  * If the file is ignored because outside of base path, change the location of your config file to be in a parent directory.
`.trimStart();
};


Review comment (suggestion):
I'd recommend removing the extra lines between the description and the URL, as I find it difficult to read with that much separation.
```suggestion
  * If the file is ignored because of a matching ignore pattern, check global ignores in your config file.
    https://eslint.org/docs/latest/use/configure/ignore

  * If the file is ignored because no matching configuration was supplied, check file patterns in your config file.
    https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-with-arbitrary-extensions
```

Code after:
"use strict";

module.exports = function(it) {
    const { pattern } = it;

    return `
You are linting "${pattern}", but all of the files matching the glob pattern "${pattern}" are ignored.

If you don't want to lint these files, remove the pattern "${pattern}" from the list of arguments passed to ESLint.

If you do want to lint these files, explicitly list one or more of the files from this glob that you'd like to lint to see more details about why they are ignored.

  * If the file is ignored because of a matching ignore pattern, check global ignores in your config file.
    https://eslint.org/docs/latest/use/configure/ignore

  * If the file is ignored because no matching configuration was supplied, check file patterns in your config file.
    https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-with-arbitrary-extensions

  * If the file is ignored because it is located outside of the base path, change the location of your config file to be in a parent directory.
`.trimStart();
};
Repository: eslint/eslint
File: messages/all-matched-files-ignored.js (JavaScript)

Code before:
"use strict";

module.exports = function(it) {
    const { pattern } = it;

    return `
You are linting "${pattern}", but all of the files matching the glob pattern "${pattern}" are ignored.

If you don't want to lint these files, remove the pattern "${pattern}" from the list of arguments passed to ESLint.

If you do want to lint these files, explicitly list one or more of the files from this glob that you'd like to lint to see more details about why they are ignored.

  * If the file is ignored because of a matching ignore pattern, check global ignores in your config file.
    https://eslint.org/docs/latest/use/configure/ignore

  * If the file is ignored because no matching configuration was supplied, check file patterns in your config file.
    https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-with-arbitrary-extensions

  * If the file is ignored because outside of base path, change the location of your config file to be in a parent directory.
`.trimStart();
};


Review comment (suggestion):
```suggestion
  * If the file is ignored because it is located outside of the base path, change the location of your config file to be in a parent directory.
```

Code after:
"use strict";

module.exports = function(it) {
    const { pattern } = it;

    return `
You are linting "${pattern}", but all of the files matching the glob pattern "${pattern}" are ignored.

If you don't want to lint these files, remove the pattern "${pattern}" from the list of arguments passed to ESLint.

If you do want to lint these files, explicitly list one or more of the files from this glob that you'd like to lint to see more details about why they are ignored.

  * If the file is ignored because of a matching ignore pattern, check global ignores in your config file.
    https://eslint.org/docs/latest/use/configure/ignore

  * If the file is ignored because no matching configuration was supplied, check file patterns in your config file.
    https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-with-arbitrary-extensions

  * If the file is ignored because it is located outside of the base path, change the location of your config file to be in a parent directory.
`.trimStart();
};
Repository: eslint/eslint
File: .trunk/configs/svgo.config.js (JavaScript)

Code before:
module.exports = {
    plugins: [
        {
            name: "preset-default",
            params: {
                overrides: {
                    removeViewBox: false, // https://github.com/svg/svgo/issues/1128
                    sortAttrs: true,
                    removeOffCanvasPaths: true,
                },
            },
        },
    ],
};


Review comment (suggestion):
https://github.com/svg/svgo/pull/1461 was merged, so is this `removeViewBox: false` still necessary?
* If it isn't, let's remove the line.
* If it is, then the comment link should point to whatever issue tracks bringing in the updated svgo

(unless I've misinterpreted?)

Code after:
"use strict";

module.exports = {
    plugins: [
        {
            name: "preset-default",
            params: {
                overrides: {
                    removeViewBox: false, // https://github.com/svg/svgo/issues/1128
                    sortAttrs: true,
                    removeOffCanvasPaths: true
                }
            }
        }
    ]
};
Repository: eslint/eslint
File: eslint.config.js (JavaScript)

Code before:
                    "errors"
                ]
            ],
            "eslint-plugin/test-case-shorthand-strings": "error"
        }
    },
    {
        name: "eslint/tests",
        files: ["tests/**/*.js"],
        languageOptions: {
            globals: {
                ...globals.mocha
            }
        },
        rules: {
            "no-restricted-syntax": ["error", {
                selector: "CallExpression[callee.object.name='assert'][callee.property.name='doesNotThrow']",
                message: "`assert.doesNotThrow()` should be replaced with a comment next to the code."
            }]
        }
    },

    // JSON files
    {
        name: "eslint/json",
        files: ["**/*.json"],
        ignores: ["**/package-lock.json"],
        language: "json/json",
        ...json.configs.recommended
    },

    // JSONC files
    {
        name: "eslint/json",
        files: [".vscode/*.json"],
        language: "json/jsonc"
    },

    // Restrict relative path imports
    {
        name: "eslint/lib",
        files: ["lib/*.js"],
        ignores: ["lib/unsupported-api.js"],
        rules: {
            "n/no-restricted-require": ["error", [
                ...createInternalFilesPatterns()
            ]]
        }
    },
    {
        name: "eslint/cli-engine",

Review comment (suggestion):
Maybe we can also lint .c8rc:

```suggestion
        files: ["**/*.json", ".c8rc"],
```

Code after:
                    "name",
                    "filename",
                    "code",
                    "output",
                    "options",
                    "languageOptions",
                    "errors"
                ]
            ],
            "eslint-plugin/test-case-shorthand-strings": "error"
        }
    },
    {
        name: "eslint/tests",
        files: ["tests/**/*.js"],
        languageOptions: {
            globals: {
                ...globals.mocha
            }
        },
        rules: {
            "no-restricted-syntax": ["error", {
                selector: "CallExpression[callee.object.name='assert'][callee.property.name='doesNotThrow']",
                message: "`assert.doesNotThrow()` should be replaced with a comment next to the code."
            }]
        }
    },

    // JSON files
    {
        name: "eslint/json",
        files: ["**/*.json", ".c8rc"],
        ignores: ["**/package-lock.json"],
        language: "json/json",
        ...json.configs.recommended
    },

    // JSONC files
    {
        name: "eslint/jsonc",
        files: ["knip.jsonc"],
        language: "json/jsonc",
        ...json.configs.recommended
    },

    // Restrict relative path imports
    {
        name: "eslint/lib",
        files: ["lib/*.js"],
        ignores: ["lib/unsupported-api.js"],
        rules: {