Skip to content

Should disable @stylistic/curly-newline #351

@andersk

Description

@andersk

The @stylistic/curly-newline rule was introduced in eslint-stylistic@2.9.0, and conflicts with Prettier depending on configuration (such as the configuration enabled by eslint-config-xo).

Minimal test case:

eslint.config.mjs

import eslintConfigPrettier from "eslint-config-prettier/flat";
import stylistic from "@stylistic/eslint-plugin";

export default [
  {
    plugins: { "@stylistic": stylistic },
    rules: { "@stylistic/curly-newline": ["error", "always"] },
  },
  eslintConfigPrettier,
];

test.mjs

export const f = () => {};
$ npx eslint

/tmp/test/test.mjs
  1:24  error  Expected a line break after this opening brace   @stylistic/curly-newline
  1:25  error  Expected a line break before this closing brace  @stylistic/curly-newline

✖ 2 problems (2 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

$ npx eslint --fix
$ cat test.mjs
export const f = () => {
};
$ prettier -w test.mjs
test.mjs 17ms
$ cat test.mjs
export const f = () => {};

This PR was closed but the issue remains:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions