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

feat: add a defineConfig utility function and use it in examples #117

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

haoqunjiang
Copy link
Member

@haoqunjiang haoqunjiang commented Dec 14, 2024

This commit also exports the createConfig as a named export for consistency in import styles.
I feel that though the name is descriptive enough, it's not a suitable name to be used directly in the defineConfig arguments, so I used import aliases in all examples.

typescript-eslint 8.15 added support for infinitely deep array nesting in the config helper, so I removed all the spread patterns in the examples. typescript-eslint/typescript-eslint#10333

As discussed in vuejs/create-eslint-config#37

/cc @segevfiner

This commit also exports the `createConfig` as a named export for
consistency.
@haoqunjiang
Copy link
Member Author

Gonna need it in my @vue/eslint-config-standard-with-typescript refactor so I'm merging it.

@haoqunjiang haoqunjiang merged commit 3c930e4 into main Dec 25, 2024
6 checks passed
@haoqunjiang
Copy link
Member Author

haoqunjiang commented Dec 25, 2024

I think the API is far from ideal - and would like to change it later. Hope I can finish it before New Year, otherwise the ugly API would need to stay for a bit longer.

Current:

import pluginVue from 'eslint-plugin-vue'
import {
  defineConfig,
  createConfig as vueTsEslintConfig,
} from '@vue/eslint-config-typescript'

export default defineConfig(
  pluginVue.configs['flat/essential'],
  vueTsEslintConfig({ extends: 'recommendedTypeChecked', 'stylisticTypeChecked' }),
)

I'm thinking about:

import pluginVue from 'eslint-plugin-vue'
import { defineConfig, configs } from '@vue/eslint-config-typescript'
import standardTypeChecked from '@vue/eslint-config-standard-with-typescript/type-checked'

export default defineConfig(
  pluginVue.configs['flat/essential'],
  configs.recommendedTypeChecked,
  configs.stylisticTypeChecked,
  standardTypeChecked,
)

It'll make defineConfig implementation much more complicated, and may encounter a few edge cases, but the result is much more readable.

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

Successfully merging this pull request may close these issues.

1 participant