In React's terminology, there are five core types that are important to distinguish:
React Elements
| exports.host = functions.https.onRequest((req, res) => { | |
| const userAgent = req.headers['user-agent'].toLowerCase(); | |
| let indexHTML = fs.readFileSync('./hosting/index.html').toString(); | |
| const path = req.path ? req.path.split('/') : req.path; | |
| const ogPlaceholder = '<meta name="functions-insert-dynamic-og">'; | |
| const metaPlaceholder = '<meta name="functions-insert-dynamic-meta">'; | |
| const isBot = userAgent.includes('googlebot') || | |
| userAgent.includes('yahoou') || | |
| userAgent.includes('bingbot') || |
In React's terminology, there are five core types that are important to distinguish:
React Elements
| #!/bin/bash | |
| for file in $(git diff --cached --name-only | grep -E '\.(js|jsx)$') | |
| do | |
| git show ":$file" | node_modules/.bin/eslint --stdin --stdin-filename "$file" # we only want to lint the staged changes, not any un-staged changes | |
| if [ $? -ne 0 ]; then | |
| echo "ESLint failed on staged file '$file'. Please check your code and try again. You can run ESLint manually via npm run eslint." | |
| exit 1 # exit with failure status | |
| fi | |
| done |
| #!/bin/sh | |
| STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$") | |
| ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint" | |
| if [[ "$STAGED_FILES" = "" ]]; then | |
| exit 0 | |
| fi | |
| PASS=true |
| /*jslint node: true */ | |
| "use strict"; | |
| var express = require("express"), | |
| consolidate = require("consolidate"), | |
| Handlebars = require("handlebars"), | |
| fs = require("fs"); | |
| var app = express(); |