Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multipleFileExtensions in unicorn/filename-case is not working correctly with eslint flat config #2306

Open
Geloosa opened this issue Apr 3, 2024 · 0 comments

Comments

@Geloosa
Copy link

Geloosa commented Apr 3, 2024

eslint 8.57.0
eslint-plugin-unicorn 51.0.1
rule unicorn/filename-case

When using a flat config, multipleFileExtensions option is not true by default and can't be set to true.

This config

{
  files: [
      "**/*.stories.js",
      "**/*.stories.ts",
      "**/*.view.test.js",
      "**/*.view.test.ts",
    ],
  rules: {
      "unicorn/filename-case": [
        "error",
        { case: "pascalCase" },
      ],
    },
}

outputs this error (though it should't)

/MobileMenu.stories.js
  1:1  error  Filename is not in pascal case. Rename it to `MobileMenu.Stories.js`  unicorn/filename-case

When trying to set multipleFileExtensions to true explicitly:

{
  files: [
      "**/*.stories.js",
      "**/*.stories.ts",
      "**/*.view.test.js",
      "**/*.view.test.ts",
    ],
  rules: {
      "unicorn/filename-case": [
        "error",
        { case: "pascalCase", multipleFileExtensions: true },
      ],
    },
}

eslint doesn't run throwing a config validation error:

Oops! Something went wrong! :(

Error: Key "rules": Key "unicorn/filename-case":        Value {"case":"pascalCase","multipleFileExtensions":true} should NOT have additional properties.
        Value {"case":"pascalCase","multipleFileExtensions":true} should NOT have additional properties.
        Value {"case":"pascalCase","multipleFileExtensions":true} should match exactly one schema in oneOf.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant