Skip to content
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

Merged
merged 5 commits into from
Feb 25, 2018

Conversation

road-cycling
Copy link
Contributor

Updated to regex to fix error: #2465

This is my first pull request, please let me know if I have done anything wrong!

@levithomason
Copy link
Member

Cool, be sure to run yarn test and yarn lint. Otherwise, you could be waiting for CI to tell you of a lint issue.

@codecov-io
Copy link

codecov-io commented Feb 2, 2018

Codecov Report

Merging #2481 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/modules/Progress/Progress.js 100% <0%> (ø) ⬆️
src/modules/Accordion/AccordionTitle.js 100% <0%> (ø) ⬆️
src/addons/Portal/Portal.js 100% <0%> (ø) ⬆️
src/modules/Popup/Popup.js 100% <0%> (ø) ⬆️
src/modules/Sticky/Sticky.js 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3f26bef...97d88e4. Read the comment docs.

@levithomason
Copy link
Member

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!

@levithomason
Copy link
Member

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

image

@road-cycling
Copy link
Contributor Author

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'

@levithomason
Copy link
Member

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.

@levithomason
Copy link
Member

@nieroda ^

@road-cycling
Copy link
Contributor Author

road-cycling commented Feb 20, 2018

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

@levithomason
Copy link
Member

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!

@levithomason levithomason changed the title fixed regex error docs(ComponentExample): fix code editor body regex Feb 25, 2018
@levithomason levithomason merged commit b9eea11 into Semantic-Org:master Feb 25, 2018
@welcome
Copy link

welcome bot commented Feb 25, 2018

Congrats on merging your first pull request! 🎉🎉🎉

robot victory dance

@levithomason
Copy link
Member

Released in semantic-ui-react@0.78.3.

Brantron pushed a commit to Brantron/Semantic-UI-React that referenced this pull request Mar 14, 2018
docs(ComponentExample): fix code editor body regex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants