Skip to content

Commit 61ea9d8

Browse files
committed
Update dev-dependencies
1 parent 151ce7a commit 61ea9d8

File tree

6 files changed

+139
-140
lines changed

6 files changed

+139
-140
lines changed

lib/handlers/element.js

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const tableCellElement = new Set(['td', 'th'])
4040
export function element(node, state) {
4141
const parentSchema = state.schema
4242
let schema = parentSchema
43-
const props = node.properties || {}
43+
const properties = node.properties || {}
4444

4545
if (parentSchema.space === 'html' && node.tagName.toLowerCase() === 'svg') {
4646
schema = svg
@@ -52,16 +52,16 @@ export function element(node, state) {
5252
/** @type {Array<JsxAttribute | JsxSpreadAttribute>} */
5353
const attributes = []
5454
/** @type {string} */
55-
let prop
55+
let property
5656
/** @type {string | undefined} */
5757
let alignValue
5858
/** @type {Array<Property> | undefined} */
5959
let styleProperties
6060

61-
for (prop in props) {
62-
if (own.call(props, prop)) {
63-
let value = props[prop]
64-
const info = find(schema, prop)
61+
for (property in properties) {
62+
if (own.call(properties, property)) {
63+
let value = properties[property]
64+
const info = find(schema, property)
6565
/** @type {JsxAttribute['value']} */
6666
let attributeValue
6767

@@ -77,18 +77,18 @@ export function element(node, state) {
7777
continue
7878
}
7979

80-
prop =
80+
property =
8181
state.elementAttributeNameCase === 'react' && info.space
8282
? hastToReact[info.property] || info.property
8383
: info.attribute
8484

8585
if (Array.isArray(value)) {
8686
// Accept `array`.
87-
// Most props are space-separated.
87+
// Most properties are space-separated.
8888
value = info.commaSeparated ? commas(value) : spaces(value)
8989
}
9090

91-
if (prop === 'style') {
91+
if (property === 'style') {
9292
let styleObject =
9393
typeof value === 'object'
9494
? value
@@ -101,20 +101,20 @@ export function element(node, state) {
101101
/** @type {Array<Property>} */
102102
const cssProperties = []
103103
/** @type {string} */
104-
let cssProp
104+
let cssProperty
105105

106-
for (cssProp in styleObject) {
106+
for (cssProperty in styleObject) {
107107
// eslint-disable-next-line max-depth
108-
if (own.call(styleObject, cssProp)) {
108+
if (own.call(styleObject, cssProperty)) {
109109
cssProperties.push({
110110
type: 'Property',
111111
method: false,
112112
shorthand: false,
113113
computed: false,
114-
key: identifierName(cssProp)
115-
? {type: 'Identifier', name: cssProp}
116-
: {type: 'Literal', value: cssProp},
117-
value: {type: 'Literal', value: String(styleObject[cssProp])},
114+
key: identifierName(cssProperty)
115+
? {type: 'Identifier', name: cssProperty}
116+
: {type: 'Literal', value: cssProperty},
117+
value: {type: 'Literal', value: String(styleObject[cssProperty])},
118118
kind: 'init'
119119
})
120120
}
@@ -130,18 +130,18 @@ export function element(node, state) {
130130
} else if (
131131
state.tableCellAlignToStyle &&
132132
tableCellElement.has(node.tagName) &&
133-
prop === 'align'
133+
property === 'align'
134134
) {
135135
alignValue = String(value)
136136
continue
137137
} else {
138138
attributeValue = {type: 'Literal', value: String(value)}
139139
}
140140

141-
if (identifierName(prop, {jsx: true})) {
141+
if (identifierName(property, {jsx: true})) {
142142
attributes.push({
143143
type: 'JSXAttribute',
144-
name: {type: 'JSXIdentifier', name: prop},
144+
name: {type: 'JSXIdentifier', name: property},
145145
value: attributeValue
146146
})
147147
} else {
@@ -155,7 +155,7 @@ export function element(node, state) {
155155
method: false,
156156
shorthand: false,
157157
computed: false,
158-
key: {type: 'Literal', value: String(prop)},
158+
key: {type: 'Literal', value: String(property)},
159159
// @ts-expect-error No need to worry about `style` (which has a
160160
// `JSXExpressionContainer` value) because that’s a valid identifier.
161161
value: attributeValue || {type: 'Literal', value: true},
@@ -181,7 +181,7 @@ export function element(node, state) {
181181
})
182182
}
183183

184-
const cssProp =
184+
const cssProperty =
185185
state.stylePropertyNameCase === 'css'
186186
? transformStyleToCssCasing('textAlign')
187187
: 'textAlign'
@@ -191,9 +191,9 @@ export function element(node, state) {
191191
method: false,
192192
shorthand: false,
193193
computed: false,
194-
key: identifierName(cssProp)
195-
? {type: 'Identifier', name: cssProp}
196-
: {type: 'Literal', value: cssProp},
194+
key: identifierName(cssProperty)
195+
? {type: 'Identifier', name: cssProperty}
196+
: {type: 'Literal', value: cssProperty},
197197
value: {type: 'Literal', value: alignValue},
198198
kind: 'init'
199199
})
@@ -232,13 +232,14 @@ export function element(node, state) {
232232
* @param {string} tagName
233233
* Element name.
234234
* @returns {Style}
235-
* Props.
235+
* Properties.
236236
*/
237237
function parseStyle(value, tagName) {
238238
/** @type {Style} */
239239
const result = {}
240240

241241
try {
242+
// @ts-expect-error: types are wrong.
242243
styleToObject(value, iterator)
243244
} catch (error) {
244245
const cause = /** @type {Error} */ (error)
@@ -252,7 +253,7 @@ function parseStyle(value, tagName) {
252253
return result
253254

254255
/**
255-
* Add `name`, as a CSS prop, to `result`.
256+
* Add `name`, as a CSS property, to `result`.
256257
*
257258
* @param {string} name
258259
* Key.
@@ -296,7 +297,7 @@ function transformStylesToCssCasing(domCasing) {
296297
}
297298

298299
/**
299-
* Transform a DOM casing style prop to a CSS casing style prop.
300+
* Transform a DOM casing style property to a CSS casing style property.
300301
*
301302
* @param {string} from
302303
* @returns {string}

lib/handlers/mdx-jsx-element.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {svg} from 'property-information'
2929
export function mdxJsxElement(node, state) {
3030
const parentSchema = state.schema
3131
let schema = parentSchema
32-
const attrs = node.attributes || []
32+
const attributes = node.attributes || []
3333
let index = -1
3434

3535
if (
@@ -43,15 +43,15 @@ export function mdxJsxElement(node, state) {
4343

4444
const children = state.all(node)
4545
/** @type {Array<JsxAttribute | JsxSpreadAttribute>} */
46-
const attributes = []
46+
const jsxAttributes = []
4747

48-
while (++index < attrs.length) {
49-
const attr = attrs[index]
50-
const value = attr.value
48+
while (++index < attributes.length) {
49+
const attribute = attributes[index]
50+
const value = attribute.value
5151
/** @type {JsxAttribute['value']} */
5252
let attributeValue
5353

54-
if (attr.type === 'mdxJsxAttribute') {
54+
if (attribute.type === 'mdxJsxAttribute') {
5555
if (value === null || value === undefined) {
5656
attributeValue = null
5757
// Empty.
@@ -87,18 +87,18 @@ export function mdxJsxElement(node, state) {
8787
}
8888

8989
/** @type {JsxAttribute} */
90-
const attribute = {
90+
const jsxAttribute = {
9191
type: 'JSXAttribute',
92-
name: state.createJsxAttributeName(attr.name),
92+
name: state.createJsxAttributeName(attribute.name),
9393
value: attributeValue
9494
}
9595

96-
state.inherit(attr, attribute)
97-
attributes.push(attribute)
96+
state.inherit(attribute, jsxAttribute)
97+
jsxAttributes.push(jsxAttribute)
9898
}
9999
// MdxJsxExpressionAttribute.
100100
else {
101-
const estree = attr.data && attr.data.estree
101+
const estree = attribute.data && attribute.data.estree
102102
const comments = (estree && estree.comments) || []
103103
/** @type {JsxSpreadAttribute['argument'] | undefined} */
104104
let argumentValue
@@ -121,12 +121,12 @@ export function mdxJsxElement(node, state) {
121121
}
122122

123123
/** @type {JsxSpreadAttribute} */
124-
const attribute = {
124+
const jsxAttribute = {
125125
type: 'JSXSpreadAttribute',
126126
argument: argumentValue || {type: 'ObjectExpression', properties: []}
127127
}
128-
state.inherit(attr, attribute)
129-
attributes.push(attribute)
128+
state.inherit(attribute, jsxAttribute)
129+
jsxAttributes.push(jsxAttribute)
130130
}
131131
}
132132

@@ -139,7 +139,7 @@ export function mdxJsxElement(node, state) {
139139
type: 'JSXElement',
140140
openingElement: {
141141
type: 'JSXOpeningElement',
142-
attributes,
142+
attributes: jsxAttributes,
143143
name: state.createJsxElementName(node.name),
144144
selfClosing: children.length === 0
145145
},

lib/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export function toEstree(tree, options) {
8484
}
8585

8686
/** @type {ExpressionStatement} */
87-
// @ts-expect-error: `estree` types don’t allow JSX.
8887
const statement = {type: 'ExpressionStatement', expression: result}
8988
state.patch(tree, statement)
9089
body.push(statement)

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,24 @@
5656
"zwitch": "^2.0.0"
5757
},
5858
"devDependencies": {
59-
"@types/node": "^20.0.0",
59+
"@types/node": "^22.0.0",
6060
"acorn-jsx": "^5.0.0",
61-
"c8": "^8.0.0",
61+
"c8": "^10.0.0",
6262
"esast-util-from-js": "^2.0.0",
6363
"estree-util-to-js": "^2.0.0",
6464
"estree-walker": "^3.0.0",
65-
"hastscript": "^8.0.0",
65+
"hastscript": "^9.0.0",
6666
"mdast-util-from-markdown": "^2.0.0",
6767
"mdast-util-mdx": "^3.0.0",
6868
"mdast-util-to-hast": "^13.0.0",
69-
"micromark-extension-mdxjs": "^2.0.0",
69+
"micromark-extension-mdxjs": "^3.0.0",
7070
"prettier": "^3.0.0",
71-
"remark-cli": "^11.0.0",
72-
"remark-preset-wooorm": "^9.0.0",
71+
"remark-cli": "^12.0.0",
72+
"remark-preset-wooorm": "^10.0.0",
7373
"type-coverage": "^2.0.0",
7474
"typescript": "^5.0.0",
7575
"unist-util-visit": "^5.0.0",
76-
"xo": "^0.56.0"
76+
"xo": "^0.60.0"
7777
},
7878
"scripts": {
7979
"prepack": "npm run build && npm run format",
@@ -110,6 +110,7 @@
110110
"xo": {
111111
"prettier": true,
112112
"rules": {
113+
"logical-assignment-operators": "off",
113114
"unicorn/prefer-code-point": "off",
114115
"unicorn/prefer-string-replace-all": "off"
115116
}

0 commit comments

Comments
 (0)