Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61260 |
|
commit: |
| ? [F & (((...args: any) => any) | string | object)] | ||
| : T & (((...args: any) => any) | string | object); | ||
|
|
||
| export function defineConfig< |
There was a problem hiding this comment.
Can we move the implementation to ./config/validation/declare-config.ts and re-export it here?
I suggest we rename it to declareConfig to align with declarePreset.
Aside: maybe we can also add an alias of declarePlugin in helper-plugin-utils to declare, and somehow we should have declarePreset providing the same typing hints as declareConfig.
There was a problem hiding this comment.
The name defineConfig is inspired by eslint. I've also noticed that similar functions to tsup and vite are called defineConfig.
There was a problem hiding this comment.
Understood. However we don't have to choose the same name as other projects, as different naming could also benefit users, for example, think of a @babel/eslint-parser user using eslint.config.ts:
import { defineConfig } from "@eslint/config"
import { declareConfig } from "@babel/core"
import babelEslintParser from "@babel/eslint-parser"
export default defineConfig([{
languageOptions: {
parser: babelEslintParser,
parserOptions: {
babelOptions: declareConfig({
plugins: [ ... ],
}),
requireConfigFile: false,
},
},
}])A different export name reduces the possibility that people misused exports from @babel/core to eslint or vice. Since both defineConfig and declareConfig are merely typing helpers, such usage may still work if users do not run tsc on the config files.
Fixes #1, Fixes #2This allows users to more easily configure plugin and preset options.