-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(ComponentExample): fix code editor body regex #2481
Conversation
Cool, be sure to run |
Codecov Report
@@ Coverage Diff @@
## master #2481 +/- ##
==========================================
- Coverage 99.74% 99.74% -0.01%
==========================================
Files 154 154
Lines 2712 2699 -13
==========================================
- Hits 2705 2692 -13
Misses 7 7
Continue to review full report at Codecov.
|
tip: On future PRs, you'll want to create a branch in your fork and open the PR from the work on your branch. This helps isolate multiple threads of work. It also makes it to where the repo owners can commit back to your branch if need be. When making a PR from your master branch, this is not possible. Testing this out now! |
The changes fail for the Button example. There is a mixture of syntax used in examples. I'd suggest trying your changes in several code files. http://localhost:8080/elements/button#button-example-button import React from 'react'
import { Button } from 'semantic-ui-react'
const ButtonExampleButton = () => (
<Button>Click Heres</Button>
)
export default ButtonExampleButton |
looking through the components I saw that classes are defined in these 3 ways class * extends Component
const * = () => (
export default class Sometimes variables were declared above the class, but it would match with the top 'const' (would be an issue if var is used) const data = [foo, bar];
class * extends Component {} This matches all examples above. const body = _.get(/(export\sdefault\sclass|const|class\s\S*\sextends)[\s\S]*/.exec(sourceCode), '[0]', '')
.replace(/export\s+default\s+(?!class|function)\w+([\s\n]+)?/, '') // remove `export default Foo` statements
.replace(/export\s+default\s+/, '') This assumes the class isnt defined as such (var * = () => ), and variable definitions above the class is using 'const' |
This looks good. The only issue is that I'm unable to add new lines for some reason. Pressing enter does not add a new line character. |
@nieroda ^ |
I assume you mean the enter key adding a new line? If this is what you mean, I am unable to replicate this on my end as I am having no issues with new lines |
OK, I've noticed this on master locally as well. It could be something with my machine. In either case, it is unrelated to this PR so let's move forward. Thanks! |
Released in |
docs(ComponentExample): fix code editor body regex
Updated to regex to fix error: #2465
This is my first pull request, please let me know if I have done anything wrong!