Skip to content

Commit 14242bd

Browse files
style: replace "arrowParens" avoid with default in .prettierrc.json
1 parent 8614b12 commit 14242bd

File tree

9 files changed

+22
-23
lines changed

9 files changed

+22
-23
lines changed

.prettierrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"arrowParens": "avoid",
32
"trailingComma": "none",
43
"singleQuote": true
54
}

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ The `replace` callback's first argument is [domhandler](https://github.com/fb55/
155155

156156
```js
157157
parse('<br>', {
158-
replace: domNode => {
158+
replace: (domNode) => {
159159
console.dir(domNode, { depth: null });
160160
}
161161
});
@@ -186,7 +186,7 @@ The element is replaced if a **valid** React element is returned:
186186

187187
```jsx
188188
parse('<p id="replace">text</p>', {
189-
replace: domNode => {
189+
replace: (domNode) => {
190190
if (domNode.attribs && domNode.attribs.id === 'replace') {
191191
return <span>replaced</span>;
192192
}
@@ -202,7 +202,7 @@ For TypeScript projects, you may need to check that `domNode` is an instance of
202202
import { HTMLReactParserOptions, Element } from 'html-react-parser';
203203

204204
const options: HTMLReactParserOptions = {
205-
replace: domNode => {
205+
replace: (domNode) => {
206206
if (domNode instanceof Element && domNode.attribs) {
207207
// ...
208208
}
@@ -281,7 +281,7 @@ const html = `
281281
`;
282282

283283
const options = {
284-
replace: domNode => {
284+
replace: (domNode) => {
285285
if (domNode.attribs && domNode.name === 'main') {
286286
const props = attributesToProps(domNode.attribs);
287287
return <div {...props} />;
@@ -437,7 +437,7 @@ For the `replace` option, you may need to do the following:
437437
import { Element } from 'domhandler/lib/node';
438438

439439
parse('<br class="remove">', {
440-
replace: domNode => {
440+
replace: (domNode) => {
441441
if (domNode instanceof Element && domNode.attribs.class === 'remove') {
442442
return <></>;
443443
}

benchmark/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ suite
1414
.add('html-to-react - Complex', () => {
1515
Parser(data.html.complex);
1616
})
17-
.on('cycle', event => {
17+
.on('cycle', (event) => {
1818
process.stdout.write(String(event.target) + '\n');
1919
})
2020
.run({

test/attributes-to-props.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ it('returns empty object is argument is undefined', () => {
77

88
it.each(['input', 'select', 'textarea'])(
99
'converts uncontrolled component attributes',
10-
nodeName => {
10+
(nodeName) => {
1111
expect(
1212
attributesToProps({ value: 'foo', checked: false }, nodeName)
1313
).toEqual({
@@ -19,7 +19,7 @@ it.each(['input', 'select', 'textarea'])(
1919

2020
it.each(['button', 'data', 'li', 'meter', 'option', 'progress', 'param'])(
2121
'converts non-uncontrolled component attributes',
22-
nodeName => {
22+
(nodeName) => {
2323
expect(
2424
attributesToProps({ value: 'foo', checked: false }, nodeName)
2525
).toEqual({
@@ -264,7 +264,7 @@ describe('attributesToProps with SVG attribute', () => {
264264
describe('attributesToProps with style attribute', () => {
265265
const propsEmptyStyle = { style: {} };
266266

267-
it.each([undefined, null])('does not parse invalid value: %s', style => {
267+
it.each([undefined, null])('does not parse invalid value: %s', (style) => {
268268
expect(attributesToProps({ style })).toEqual({ style });
269269
});
270270

test/dom-to-react.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ describe('domToReact replace option', () => {
179179

180180
it("does not modify keys if they're already set", () => {
181181
const options = {
182-
replace: node => {
182+
replace: (node) => {
183183
if (node.name === 'p') {
184184
return React.createElement('p', {}, 'replaced foo');
185185
}

test/helpers/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ const { renderToStaticMarkup } = require('react-dom/server');
66
* @param {ReactElement} reactElement - React element.
77
* @returns {string} - HTML markup.
88
*/
9-
exports.render = reactElement => renderToStaticMarkup(reactElement);
9+
exports.render = (reactElement) => renderToStaticMarkup(reactElement);

test/index.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('module', () => {
2929
describe('domhandler', () => {
3030
it.each(['Comment', 'Element', 'ProcessingInstruction', 'Text'])(
3131
'exports %s',
32-
name => {
32+
(name) => {
3333
expect(parse[name]).toBeInstanceOf(Function);
3434
expect(parse[name]).toBe(domhandler[name]);
3535
}
@@ -40,7 +40,7 @@ describe('module', () => {
4040
describe('HTMLReactParser', () => {
4141
it.each([undefined, null, {}, [], true, false, 0, 1, () => {}, new Date()])(
4242
'throws error for value: %p',
43-
value => {
43+
(value) => {
4444
expect(() => {
4545
parse(value);
4646
}).toThrow(TypeError);
@@ -254,7 +254,7 @@ describe('HTMLReactParser', () => {
254254
describe('replace option', () => {
255255
it('replaces the element if a valid React element is returned', () => {
256256
const options = {
257-
replace: node => {
257+
replace: (node) => {
258258
if (node.name === 'title') {
259259
return React.createElement('title', {}, 'Replaced Title');
260260
}
@@ -320,7 +320,7 @@ describe('replace option', () => {
320320

321321
it('does not replace the element if an invalid React element is returned', () => {
322322
const options = {
323-
replace: node => {
323+
replace: (node) => {
324324
if (node.attribs && node.attribs.id === 'header') {
325325
return {
326326
type: 'h1',

test/integration/index.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe.each([
1515
describe('internal', () => {
1616
it.each(['attributesToProps', 'domToReact', 'htmlToDOM'])(
1717
'exports %s',
18-
name => {
18+
(name) => {
1919
expect(parse[name]).toBeInstanceOf(Function);
2020
}
2121
);
@@ -24,7 +24,7 @@ describe.each([
2424
describe('domhandler', () => {
2525
it.each(['Comment', 'Element', 'ProcessingInstruction', 'Text'])(
2626
'exports %s',
27-
name => {
27+
(name) => {
2828
expect(parse[name]).toBeInstanceOf(Function);
2929
}
3030
);

test/utilities.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const {
1111
describe('invertObject', () => {
1212
it.each([undefined, null, '', 'test', 0, 1, true, false, () => {}])(
1313
'throws error for value: %p',
14-
value => {
14+
(value) => {
1515
expect(() => {
1616
invertObject(value);
1717
}).toThrow(TypeError);
@@ -48,7 +48,7 @@ describe('invertObject', () => {
4848
describe('options', () => {
4949
it('applies override if provided', () => {
5050
expect(
51-
invertObject({ foo: 'bar', baz: 'qux' }, key => {
51+
invertObject({ foo: 'bar', baz: 'qux' }, (key) => {
5252
if (key === 'foo') {
5353
return ['key', 'value'];
5454
}
@@ -58,7 +58,7 @@ describe('invertObject', () => {
5858

5959
it('does not apply override if invalid', () => {
6060
expect(
61-
invertObject({ foo: 'bar', baz: 'qux' }, key => {
61+
invertObject({ foo: 'bar', baz: 'qux' }, (key) => {
6262
if (key === 'foo') {
6363
return ['key'];
6464
} else if (key === 'baz') {
@@ -98,7 +98,7 @@ describe('PRESERVE_CUSTOM_ATTRIBUTES', () => {
9898
describe('setStyleProp', () => {
9999
it.each([undefined, null])(
100100
'does not set props.style when style=%p',
101-
style => {
101+
(style) => {
102102
const props = {};
103103
expect(setStyleProp(style, props)).toBe(undefined);
104104
expect(props).toEqual({});
@@ -143,7 +143,7 @@ describe('setStyleProp', () => {
143143
describe('canTextBeChildOfNode', () => {
144144
it.each(Array.from(ELEMENTS_WITH_NO_TEXT_CHILDREN))(
145145
'returns false since text node cannot be child of %s',
146-
nodeName => {
146+
(nodeName) => {
147147
const node = {
148148
name: nodeName
149149
};

0 commit comments

Comments
 (0)