This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Component = props => | |
| <div className='myComponent'> | |
| {do { | |
| if(color === 'blue') { <BlueComponent/>; } | |
| else if(color === 'red') { <RedComponent/>; } | |
| else if(color === 'green') { <GreenComponent/>; } | |
| }} | |
| </div> | |
| ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: 2.1 | |
| executors: | |
| default: | |
| docker: | |
| - image: circleci/node:12 | |
| working_directory: ~/my-app | |
| commands: | |
| restore_yarn: | |
| steps: | |
| - restore_cache: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { message, danger } from "danger" | |
| message(danger.git.modified_files.join("- ")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| danger: | |
| executor: | |
| name: default | |
| steps: | |
| - checkout | |
| - restore_yarn | |
| - restore_node | |
| - run: yarn | |
| - save_yarn | |
| - save_node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "scripts": { | |
| "start": "react-scripts start", | |
| "build": "react-scripts build", | |
| "test": "react-scripts test", | |
| "eject": "react-scripts eject", | |
| "danger:ci": "danger ci" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // dangerfile.ts | |
| import { warn, danger } from "danger" | |
| const prThreshold = 300; | |
| if (danger.github.pr.additions + danger.github.pr.deletions > prThreshold) { | |
| warn(':exclamation: Big PR'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // dangerfile.ts | |
| //... | |
| const createLink = (href: string, text: string): string => | |
| `<a href='${href}'>${text}</a>`; | |
| const toLinkList = (files: string[]): string => { | |
| const repoURL = danger.github.pr.head.repo.html_url; | |
| const ref = danger.github.pr.head.ref; | |
| return files | |
| .map(f => createLink(`${repoURL}/blob/${ref}/${f}`, f)) | |
| .map(a => `- ${a}`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // dangerfile.ts | |
| import { warn, danger, schedule } from "danger" | |
| import { istanbulCoverage } from 'danger-plugin-istanbul-coverage'; | |
| // ... | |
| schedule( | |
| istanbulCoverage({ | |
| reportFileSet: 'createdOrModified', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| danger: | |
| executor: | |
| name: default | |
| steps: | |
| - checkout | |
| - restore_yarn | |
| - restore_node | |
| - run: yarn | |
| - save_yarn | |
| - save_node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const formatDate = (date) => { | |
| let result | |
| if (date) { | |
| const dateObj = new Date(date) | |
| if (isToday(dateObj)) { | |
| result = 'Today' | |
| } else if (isYesterday(dateObj)) { | |
| result = 'Yesterday' |