Skip to content

Commit 9af1e62

Browse files
committed
no __promote
1 parent 809c5ad commit 9af1e62

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/generators/jsx-ast/constants.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,5 @@ export const TYPES_WITH_METHOD_SIGNATURES = [
150150
'method',
151151
'classMethod',
152152
];
153+
154+
export const TRIMMABLE_PADDING_REGEX = /^[\s:]+/;

src/generators/jsx-ast/utils/buildPropertyTable.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { h as createElement } from 'hastscript';
22

33
import createQueries from '../../../utils/queries/index.mjs';
4+
import { TRIMMABLE_PADDING_REGEX } from '../constants.mjs';
45

56
/**
67
* Determines if a node looks like part of a type annotation.
@@ -124,7 +125,10 @@ export const parseListIntoProperties = node => {
124125

125126
// Clean up leading whitespace in remaining description
126127
if (children[0]?.type === 'text') {
127-
children[0].value = children[0].value.replace(/^[\s:]+/, '');
128+
children[0].value = children[0].value.replace(
129+
TRIMMABLE_PADDING_REGEX,
130+
''
131+
);
128132
}
129133

130134
properties.push({

src/generators/legacy-json/utils/buildSection.mjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,7 @@ export const createSectionBuilder = () => {
157157
* @param {import('../types.d.ts').Section} parent - The parent section.
158158
*/
159159
const addToParent = (section, parent) => {
160-
const key =
161-
SECTION_TYPE_PLURALS[section.__promote ?? section.type] || 'miscs';
162-
163-
delete section.__promote;
160+
const key = SECTION_TYPE_PLURALS[section.type] || 'properties';
164161

165162
parent[key] ??= [];
166163
parent[key].push(section);

src/generators/legacy-json/utils/parseList.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ export function parseList(section, nodes) {
115115
delete values[0].name;
116116

117117
Object.assign(section, values[0]);
118-
119-
// TODO(@avivkeller): There is probably a better way to do this.
120-
section.__promote = 'property';
121118
}
122119
break;
123120

0 commit comments

Comments
 (0)