Skip to content

Commit

Permalink
fix: quote component name in error message (#1136)
Browse files Browse the repository at this point in the history
* quote component name in error message

* revert unnecessary changes in readme
  • Loading branch information
kaisugi committed Jul 15, 2020
1 parent 075a3c4 commit 6cac979
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/advanced/components.mdx
Expand Up @@ -68,9 +68,9 @@ stubbed `Button`:
const makeShortcode = name =>
function MDXDefaultShortcode(props) {
console.warn(
'Component ' +
"Component '" +
name +
' was not imported, exported, or provided by MDXProvider as global scope'
"' was not imported, exported, or provided by MDXProvider as global scope"
)
return <div {...props} />
}
Expand Down
2 changes: 1 addition & 1 deletion packages/mdx/mdx-hast-to-jsx.js
Expand Up @@ -163,7 +163,7 @@ MDXContent.isMDXComponent = true`
const importExportNames = importNames.concat(exportNames)
const fakedModulesForGlobalScope =
`const makeShortcode = name => function MDXDefaultShortcode(props) {
console.warn("Component " + name + " was not imported, exported, or provided by MDXProvider as global scope")
console.warn("Component '" + name + "' was not imported, exported, or provided by MDXProvider as global scope")
return <div {...props}/>
};
` +
Expand Down
6 changes: 3 additions & 3 deletions packages/mdx/test/index.test.js
Expand Up @@ -47,9 +47,9 @@ it('Should match sample blog post snapshot', async () => {
const makeShortcode = (name) =>
function MDXDefaultShortcode(props) {
console.warn(
\\"Component \\" +
\\"Component '\\" +
name +
\\" was not imported, exported, or provided by MDXProvider as global scope\\"
\\"' was not imported, exported, or provided by MDXProvider as global scope\\"
);
return <div {...props} />;
};
Expand Down Expand Up @@ -333,7 +333,7 @@ test('Should handle layout props', () => {
authors: ['fred', 'sally']
};
const makeShortcode = name => function MDXDefaultShortcode(props) {
console.warn(\\"Component \\" + name + \\" was not imported, exported, or provided by MDXProvider as global scope\\")
console.warn(\\"Component '\\" + name + \\"' was not imported, exported, or provided by MDXProvider as global scope\\")
return <div {...props}/>
};
const Foo = makeShortcode(\\"Foo\\");
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-mdx/test/__snapshots__/test.js.snap
Expand Up @@ -5,7 +5,7 @@ exports[`correctly transpiles 1`] = `
export { Baz } from './foo';
const makeShortcode = name => function MDXDefaultShortcode(props) {
console.warn(\\"Component \\" + name + \\" was not imported, exported, or provided by MDXProvider as global scope\\")
console.warn(\\"Component '\\" + name + \\"' was not imported, exported, or provided by MDXProvider as global scope\\")
return <div {...props}/>
};
const Baz = makeShortcode(\\"Baz\\");
Expand Down

1 comment on commit 6cac979

@vercel
Copy link

@vercel vercel bot commented on 6cac979 Jul 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.