Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit ff0618a

Browse files
authored
Merge pull request #37 from storybookjs/fix/hierarchy-separator-remove-dot
hierarchy-separator: remove dot from checkings
2 parents 5f52252 + da46c74 commit ff0618a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/rules/hierarchy-separator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export = createStorybookRule({
4848
//@ts-ignore
4949
const metaTitle = titleNode.value.raw || ''
5050

51-
if (metaTitle.includes('|') || metaTitle.includes('.')) {
51+
if (metaTitle.includes('|')) {
5252
context.report({
5353
node: titleNode,
5454
messageId: 'deprecatedHierarchySeparator',
@@ -58,7 +58,7 @@ export = createStorybookRule({
5858
return fixer.replaceTextRange(
5959
//@ts-ignore
6060
titleNode.value.range,
61-
metaTitle.replace(/\||\./g, '/')
61+
metaTitle.replace(/\|/g, '/')
6262
)
6363
},
6464
suggest: [
@@ -68,7 +68,7 @@ export = createStorybookRule({
6868
return fixer.replaceTextRange(
6969
//@ts-ignore
7070
titleNode.value.range,
71-
metaTitle.replace(/\||\./g, '/')
71+
metaTitle.replace(/\|/g, '/')
7272
)
7373
},
7474
},

tests/lib/rules/hierarchy-separator.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ import ruleTester from '../../utils/rule-tester'
1919

2020
ruleTester.run('hierarchy-separator', rule, {
2121
valid: [
22+
"export default { title: 'Examples.Components' }",
2223
"export default { title: 'Examples/Components/Button' }",
2324
"export default { title: 'Examples/Components/Button' } as ComponentMeta<typeof Button>",
2425
],
2526

2627
invalid: [
2728
{
28-
code: "export default { title: 'Examples|Components|Button' }",
29+
code: "export default { title: 'Examples|Components/Button' }",
2930
output: "export default { title: 'Examples/Components/Button' }",
3031
errors: [
3132
{
@@ -41,7 +42,7 @@ ruleTester.run('hierarchy-separator', rule, {
4142
],
4243
},
4344
{
44-
code: "export default { title: 'Examples.Components.Button' }",
45+
code: "export default { title: 'Examples|Components/Button' }",
4546
output: "export default { title: 'Examples/Components/Button' }",
4647
errors: [
4748
{
@@ -58,7 +59,7 @@ ruleTester.run('hierarchy-separator', rule, {
5859
},
5960
{
6061
code: dedent`
61-
const meta = { title: 'Examples.Components.Button' }
62+
const meta = { title: 'Examples|Components/Button' }
6263
export default meta
6364
`,
6465
output: dedent`

0 commit comments

Comments
 (0)