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 strict option to NuxtESLintConfigOptions for enforcing typescript-eslint strict rules #362

Closed
3 of 4 tasks
chadwickellis opened this issue Mar 25, 2024 · 1 comment
Closed
3 of 4 tasks

Comments

@chadwickellis
Copy link
Contributor

Describe the feature

To enhance the TypeScript development experience within Nuxt projects, I propose adding a strict option to the NuxtESLintConfigOptions. This new option will enable the enforcement of typescript-eslint strict rules, ensuring stricter type checks and promoting best coding practices. Currently, developers can enable typescript-eslint strict rules manually by modifying the ESLint configuration as follows:

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

export default defineFlatConfigs(
  createConfigForNuxt().then((configs) => {
    return configs.map((config) => {
      return config.name === 'nuxt:typescript'
        ? {
            ...config,
            rules: {
              ...config.rules,
              ...pluginTs.configs.strict.rules,
            },
          }
        : config
    })
  }),
)

However, this process is not straightforward and can be cumbersome, especially for new developers or larger projects. Implementing a dedicated strict option would simplify this configuration process, improve code quality, and help developers adhere to TypeScript's strictest standards. This enhancement aligns with the ongoing efforts to strengthen type safety and code consistency in Nuxt applications.

Additional information

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

Final checks

@antfu
Copy link
Member

antfu commented Mar 29, 2024

We enabled it by default now, with an option to disable it: ae2d78a

Thanks for bringing this up

@antfu antfu closed this as completed Mar 29, 2024
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