Skip to content

Commit 2377394

Browse files
authored
Merge pull request #29 from Automattic/update/lint-hovercards
Hovercards: Format files
2 parents 02c2201 + 22e0d0e commit 2377394

22 files changed

+259
-255
lines changed

web/packages/hovercards/.eslintrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ module.exports = {
33
ecmaVersion: 'latest',
44
sourceType: 'module',
55
},
6-
extends: ['plugin:@wordpress/eslint-plugin/recommended'],
6+
extends: [ 'plugin:@wordpress/eslint-plugin/recommended' ],
7+
plugins: [ 'prettier' ],
78
rules: {
9+
'prettier/prettier': [ 'error', require( './.prettierrc.js' ) ], // Uses our .prettierrc.js config
810
'@wordpress/i18n-no-variables': 'off',
911
},
1012
};

web/packages/hovercards/.markdownlint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"allow_different_nesting": true
1414
},
1515
"MD033": {
16-
"allowed_elements": ["img"]
16+
"allowed_elements": [ "img" ]
1717
},
1818
"MD041": false,
1919
"no-hard-tabs": false,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
2-
...require('@wordpress/prettier-config'),
2+
...require( '@wordpress/prettier-config' ),
33
printWidth: 120,
44
};

web/packages/hovercards/.release-it.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"github": {
1010
"release": true,
11-
"assets": ["release/hovercards.zip"]
11+
"assets": [ "release/hovercards.zip" ]
1212
},
1313
"npm": {
1414
"publish": true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: [['@babel/env', { loose: true }], ['@babel/react', { runtime: 'automatic' }], '@babel/typescript'],
2+
presets: [ [ '@babel/env', { loose: true } ], [ '@babel/react', { runtime: 'automatic' } ], '@babel/typescript' ],
33
};

web/packages/hovercards/lint-staged.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
'*.{js,jsx,ts,tsx}': [() => 'npm run type-check', 'npm run lint:js'],
2+
'*.{js,jsx,ts,tsx}': [ () => 'npm run type-check', 'npm run lint:js' ],
33
'*.{css,scss}': 'npm run lint:style',
44
'*.md': 'npm run lint:md:docs',
55
'*.{js,jsx,ts,tsx,json,yaml,yml}': 'npm run format',

web/packages/hovercards/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"type-check": "tsc --noEmit",
6161
"lint:js": "wp-scripts lint-js",
6262
"lint:style": "wp-scripts lint-style",
63-
"lint:md:docs": "wp-scripts lint-md-docs",
63+
"lint:md": "wp-scripts lint-md-docs",
6464
"lint": "run-p 'lint:*'",
6565
"clean:dist": "rimraf dist",
6666
"clean:release": "rimraf release",

web/packages/hovercards/playground/core.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import type { Options, Attach } from '../dist';
44
import { Hovercards } from '../dist';
55

6-
addEventListener('DOMContentLoaded', () => {
6+
addEventListener( 'DOMContentLoaded', () => {
77
// To test types
88
const options: Options = {
99
placement: 'right',
@@ -13,23 +13,23 @@ addEventListener('DOMContentLoaded', () => {
1313
'View profile': 'View profile 😜',
1414
},
1515
};
16-
const hovercards = new Hovercards(options);
16+
const hovercards = new Hovercards( options );
1717

1818
// To test type
19-
const attach: Attach = (target, opts) => {
20-
hovercards.attach(target, opts);
19+
const attach: Attach = ( target, opts ) => {
20+
hovercards.attach( target, opts );
2121
};
22-
attach(document.body, { ignoreSelector: '' });
22+
attach( document.body, { ignoreSelector: '' } );
2323

2424
// To test sanitization
25-
document.getElementById('inline-hovercard')?.appendChild(
26-
Hovercards.createHovercard({
25+
document.getElementById( 'inline-hovercard' )?.appendChild(
26+
Hovercards.createHovercard( {
2727
hash: '99c3338797c95c418d9996bd39931506',
2828
avatarUrl: 'https://www.gravatar.com/avatar/99c3338797c95c418d9996bd39931506?s=60&d=retro&r=g&esc=^^',
2929
profileUrl: 'https://gravatar.com/wellyshen',
3030
displayName: '<i>gyp</i>',
3131
location: '<i>Earth</i>',
3232
description: '<i>Test</i>, &amp;, &lt;, &gt;, &quot;, &#39;, &#x60;',
33-
})
33+
} )
3434
);
35-
});
35+
} );

web/packages/hovercards/playground/react.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ const props: HovercardsProps = {
1515

1616
function App() {
1717
// eslint-disable-next-line no-console
18-
const { attach } = useHovercards({ onFetchProfileSuccess: (hash) => console.log(hash) });
19-
const containerRef = useRef(null);
18+
const { attach } = useHovercards( { onFetchProfileSuccess: ( hash ) => console.log( hash ) } );
19+
const containerRef = useRef( null );
2020

21-
useEffect(() => {
22-
if (containerRef.current) {
23-
attach(containerRef.current);
21+
useEffect( () => {
22+
if ( containerRef.current ) {
23+
attach( containerRef.current );
2424
}
25-
}, [attach]);
25+
}, [ attach ] );
2626

2727
return (
28-
<div style={{ display: 'flex', flexDirection: 'column', gap: '5rem' }}>
28+
<div style={ { display: 'flex', flexDirection: 'column', gap: '5rem' } }>
2929
<div>
30-
<div ref={containerRef} style={{ display: 'flex', flexDirection: 'column', gap: '5rem' }}>
30+
<div ref={ containerRef } style={ { display: 'flex', flexDirection: 'column', gap: '5rem' } }>
3131
<img
3232
src="https://www.gravatar.com/avatar/33252cd1f33526af53580fcb1736172f06e6716f32afdd1be19ec3096d15dea5?s=60&d=retro&r=g"
3333
width="60"
@@ -42,7 +42,7 @@ function App() {
4242
/>
4343
</div>
4444
</div>
45-
<Hovercards style={{ display: 'flex', flexDirection: 'column', gap: '5rem' }} {...props}>
45+
<Hovercards style={ { display: 'flex', flexDirection: 'column', gap: '5rem' } } { ...props }>
4646
<img
4747
src="https://www.gravatar.com/avatar/33252cd1f33526af53580fcb1736172f06e6716f32afdd1be19ec3096d15dea5?s=60&d=retro&r=g"
4848
width="60"
@@ -66,5 +66,5 @@ function App() {
6666
);
6767
}
6868

69-
const root = createRoot(document.getElementById('react-app')!);
70-
root.render(<App />);
69+
const root = createRoot( document.getElementById( 'react-app' )! );
70+
root.render( <App /> );
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
// Add you postcss configuration here
33
// Learn more about it at https://github.com/webpack-contrib/postcss-loader#config-files
4-
plugins: [['autoprefixer']],
4+
plugins: [ [ 'autoprefixer' ] ],
55
};

0 commit comments

Comments
 (0)