Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandopasik committed Feb 23, 2019
1 parent 9fa8b9c commit 54bf54b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ module.exports = function loader(content) {
.then(component => callback(null, component))
.catch(callback);
};

2 changes: 1 addition & 1 deletion src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const frontMatter = require('front-matter');
const Prism = require('node-prismjs');
const Remarkable = require('remarkable');
const escapeHtml = require('remarkable/lib/common/utils').escapeHtml;
const { escapeHtml } = require('remarkable/lib/common/utils');

const md = new Remarkable();

Expand Down
4 changes: 2 additions & 2 deletions test/examples/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import PropTypes from 'prop-types';
* @param {Object} props React props
* @returns {JSX} template
*/
export default function Button(props) {
return <button className="button">{ props.label }</button>;
export default function Button({ label }) {
return <button className="button" type="button">{label}</button>;
}

Button.propTypes = { label: PropTypes.string };
Expand Down
9 changes: 7 additions & 2 deletions test/examples/hello-world.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ import PropTypes from 'prop-types';
* @param {Object} props React props
* @returns {JSX} template
*/
export default function HelloWorld(props) {
return <div className="hello-world">Hello { props.who }</div>;
export default function HelloWorld({ who }) {
return (
<div className="hello-world">
Hello
{who}
</div>
);
}

HelloWorld.propTypes = { who: PropTypes.string };
Expand Down
18 changes: 9 additions & 9 deletions test/parser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ describe('Parse Markdown', () => {
</div>`);
});

it('parses markdown with live code blocks', () =>
it('parses markdown with live code blocks', () => (
parser.parse(mdExample).then((result) => {
expect(result.html).toMatch(/<div class="run"><HelloWorld \/>\s*<Button label="Hello World" \/>\s*<\/div>/);
}),
);
})
));

it('parses markdown and created valid html for JSX', () =>
it('parses markdown and created valid html for JSX', () => (
parser.parse('![](myImage.png)').then((result) => {
expect(result.html).toMatch(/<p><img src="myImage.png" alt="" \/><\/p>\n/);
}),
);
})
));

it('provides the front-matter attributes', () =>
it('provides the front-matter attributes', () => (
parser.parse(mdExample).then((result) => {
expect(result.attributes).toHaveProperty('test-front-matter', 'hello world');
}),
);
})
));
});

0 comments on commit 54bf54b

Please sign in to comment.