Open illright opened 2 months ago
Code for the test case:
import fsd, { type FSDConfigObject } from '@feature-sliced/steiger-plugin'
import { createConfigs, createPlugin, enableAllRules, type ConfigObjectOf } from '@steiger/toolkit'
const sda = createPlugin({
meta: {
name: 'sda',
version: '1.0.0',
},
ruleDefinitions: [
{
name: "a-rule",
check(root, ruleOptions: { foo?: "bar" | "baz" }) {
return {
diagnostics: [],
}
},
}
]
})
const sdaConfigs = createConfigs({
all: enableAllRules(sda),
handpicked: [
sda,
{
rules: {
"a-rule": "off"
},
}
]
})
export default [
...fsd.configs.recommended,
{
rules: {
"fsd/no-public-api-sidestep": "off",
}
} satisfies FSDConfigObject,
sda,
...sdaConfigs.handpicked,
{
rules: {
"a-rule": ["error", { foo: "baz" }]
}
} satisfies ConfigObjectOf<typeof sda>
]
Config
,ConfigObject
,Plugin
,Severity
) are exportedimport { createPlugin, enableAllRules, type ConfigObjectOf } from '@steiger/toolkit'
createConfigs
similarly tocreatePlugin
Test cases:
FSDConfigObject
and usesatisfies
to gain autocompletion for the available rulescreatePlugin
function to get auto-completion for plugin fields and obtain a highly typed plugin object in the endall
and a hand-picked custom config with thecreateConfigs
function and get auto-completion on the rule namesConfigObjectOf
to export a type object for their plugin