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

Add name field to @stylistic/eslint-plugin configuration #373

Closed
3 of 4 tasks
chadwickellis opened this issue Apr 2, 2024 · 0 comments
Closed
3 of 4 tasks

Add name field to @stylistic/eslint-plugin configuration #373

chadwickellis opened this issue Apr 2, 2024 · 0 comments

Comments

@chadwickellis
Copy link
Contributor

Describe the feature

I propose enhancing the @stylistic/eslint-plugin configuration by including a name field for more precise and intuitive configuration adjustments. The current approach, which requires inspecting the plugins array to conditionally modify rules based on the presence of @stylistic, introduces unnecessary complexity.

Currently, adjustments to ESLint rules within the configuration involve a process of filtering through configurations based on the plugins array, a method that lacks clarity and directness, as demonstrated below:

import { createConfigForNuxt, defineFlatConfigs } from '@nuxt/eslint-config/flat'

export default defineFlatConfigs(
  createConfigForNuxt().then((configs) => {
    return configs.map((config) => {
      return config?.plugins && '@stylistic' in config.plugins
        ? {
            ...config,
            rules: {
              ...config.rules,
              // Rule configuration here…
            },
          }
        : config;
    });
  }),
);

To simplify this process, I suggest adding a name field to the configuration. This field would facilitate direct and intuitive identification and modification of the configuration:

import { createConfigForNuxt, defineFlatConfigs } from '@nuxt/eslint-config/flat'

export default defineFlatConfigs(
  createConfigForNuxt().then((configs) => {
    return configs.map((config) => {
      return config.name === 'nuxt:stylistic'
        ? {
            ...config,
            rules: {
              ...config.rules,
              // Rule configuration here…
            },
          }
        : config;
    });
  }),
);

This enhancement, inspired by discussions and the expressed need for improved configuration clarity in related ESLint discussions (e.g., eslint/eslint#18231), aims to make ESLint configurations more accessible and easier to manage.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants