You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of #88 -> #95, config files can specify Addons. Which is great! I should theoretically be able to make a create.config.js in any of my repos that use create-typescript-app and run npx create typescript-app without clobbering over changes specified as Addons.
For example, to add some rules to an eslint.config.js the way CTA does:
// eslint.config.js// ...rules: {// These on-by-default rules work well for this repo if configured"@typescript-eslint/prefer-nullish-coalescing": ["error",{ignorePrimitives: true},],"@typescript-eslint/restrict-template-expressions": ["error",{allowBoolean: true,allowNullish: true,allowNumber: true},],// ...
...a create.config.js can specify those in the ESLint Block:
// create.config.jsimport{createConfig}from"create";import{presetEverything}from"create-typescript-app";exportdefaultcreateConfig(presetEverything,{addons: [blockESLint({rules: [{comment:
"These on-by-default rules work well for this repo if configured",entries: {"@typescript-eslint/prefer-nullish-coalescing": ["error",{ignorePrimitives: true},],"@typescript-eslint/restrict-template-expressions": ["error",{allowBoolean: true,allowNullish: true,allowNumber: true},],},},],}),],});
But, manually specifying Addons in a create.config.js is clunky. It means you have those changes specified in two places at once. I don't think most end-users would be happy with a system requiring that. I certainly wouldn't be.
I think the only way to get this right would be to make Addons _automatically inferable from files on disk. As in, that create.config.js should be able to not manually specify any Addons:
...and instead read the existing eslint.config.js to parse the addons from the text in the file:
{
"comment": "These on-by-default rules work well for this repo if configured",
"entries": {
"@typescript-eslint/prefer-nullish-coalescing": [
"error",
{ "ignorePrimitives": true }
],
"@typescript-eslint/restrict-template-expressions": [
"error",
{ "allowBoolean": true, "allowNullish": true, "allowNumber": true }
]
}
}
I'm very confident this is the right direction to take the engine, but I don't yet know how to do it. I don't know if Handlebars or Mustache can theoretically support such a reverse-mapping. There might be an existing third-party project but I wouldn't be surprised if not. If they can't theoretically support this, I might have to make some kind of more direct, less-featured custom templating engine. 😬
Additional Info
Marking as Blocked until at least the Blocks Launch milestone is done. This is pretty tricky and should probably come after the templating engine is made more pluggable per #76.
💝
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
main
branch of the repository.Overview
As of #88 -> #95, config files can specify Addons. Which is great! I should theoretically be able to make a
create.config.js
in any of my repos that use create-typescript-app and runnpx create typescript-app
without clobbering over changes specified as Addons.For example, to add some rules to an
eslint.config.js
the way CTA does:...a
create.config.js
can specify those in the ESLint Block:But, manually specifying Addons in a
create.config.js
is clunky. It means you have those changes specified in two places at once. I don't think most end-users would be happy with a system requiring that. I certainly wouldn't be.I think the only way to get this right would be to make Addons _automatically inferable from files on disk. As in, that
create.config.js
should be able to not manually specify any Addons:...and instead read the existing
eslint.config.js
to parse the addons from the text in the file:I'm very confident this is the right direction to take the engine, but I don't yet know how to do it. I don't know if Handlebars or Mustache can theoretically support such a reverse-mapping. There might be an existing third-party project but I wouldn't be surprised if not. If they can't theoretically support this, I might have to make some kind of more direct, less-featured custom templating engine. 😬
Additional Info
Marking as Blocked until at least the Blocks Launch milestone is done. This is pretty tricky and should probably come after the templating engine is made more pluggable per #76.
💝
The text was updated successfully, but these errors were encountered: