Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
860492ad3f | ||
|
|
4e579627b7 | ||
|
|
053c5de689 |
12
01-eslint-install-run-and-configure-eslint/.eslintrc
Normal file
12
01-eslint-install-run-and-configure-eslint/.eslintrc
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "2018"
|
||||||
|
},
|
||||||
|
"extends": ["eslint:recommended"],
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true
|
||||||
|
}
|
||||||
|
}
|
||||||
1033
01-eslint-install-run-and-configure-eslint/package-lock.json
generated
Normal file
1033
01-eslint-install-run-and-configure-eslint/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
15
01-eslint-install-run-and-configure-eslint/package.json
Normal file
15
01-eslint-install-run-and-configure-eslint/package.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "static-testing-tools",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "src/example.js",
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint src"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^5.5.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
11
01-eslint-install-run-and-configure-eslint/src/example.js
Normal file
11
01-eslint-install-run-and-configure-eslint/src/example.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const name = 'Freddy'
|
||||||
|
typeof name === 'string'
|
||||||
|
|
||||||
|
if (!('serviceWorker' in navigator)) {
|
||||||
|
// you have an old browser :-(
|
||||||
|
}
|
||||||
|
|
||||||
|
const greeting = 'hello'
|
||||||
|
console.log(`${greeting} world!`)
|
||||||
|
|
||||||
|
;[(1, 2, 3)].forEach(x => console.log(x))
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "2018"
|
||||||
|
},
|
||||||
|
"extends": ["eslint:recommended"],
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true
|
||||||
|
}
|
||||||
|
}
|
||||||
1
02-lint-javascript-by-configuring-and-running-eslint/.gitignore
vendored
Normal file
1
02-lint-javascript-by-configuring-and-running-eslint/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
1039
02-lint-javascript-by-configuring-and-running-eslint/package-lock.json
generated
Normal file
1039
02-lint-javascript-by-configuring-and-running-eslint/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "static-testing-tools",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "src/example.js",
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint src",
|
||||||
|
"format": "prettier --write \"**/*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)\""
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^5.5.0",
|
||||||
|
"prettier": "^1.14.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
const name = "Freddy";
|
||||||
|
typeof name === "string";
|
||||||
|
|
||||||
|
if (!("serviceWorker" in navigator)) {
|
||||||
|
// you have an old browser :-(
|
||||||
|
}
|
||||||
|
|
||||||
|
const greeting = "hello";
|
||||||
|
console.log(`${greeting} world!`);
|
||||||
|
|
||||||
|
[(1, 2, 3)].forEach(x => console.log(x));
|
||||||
12
03-configure-prettier/.eslintrc
Normal file
12
03-configure-prettier/.eslintrc
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "2018"
|
||||||
|
},
|
||||||
|
"extends": ["eslint:recommended"],
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true
|
||||||
|
}
|
||||||
|
}
|
||||||
1
03-configure-prettier/.gitignore
vendored
Normal file
1
03-configure-prettier/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
1039
03-configure-prettier/package-lock.json
generated
Normal file
1039
03-configure-prettier/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
03-configure-prettier/package.json
Normal file
17
03-configure-prettier/package.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "static-testing-tools",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint src",
|
||||||
|
"format": "prettier --write \"**/*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)\""
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^5.5.0",
|
||||||
|
"prettier": "^1.14.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
11
03-configure-prettier/src/example.js
Normal file
11
03-configure-prettier/src/example.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const name = 'Freddy'
|
||||||
|
typeof name === 'string'
|
||||||
|
|
||||||
|
if (!('serviceWorker' in navigator)) {
|
||||||
|
// you have an old browser :-(
|
||||||
|
}
|
||||||
|
|
||||||
|
const greeting = 'hello'
|
||||||
|
console.log(`${greeting} world!`)
|
||||||
|
|
||||||
|
;[(1, 2, 3)].forEach(x => console.log(x))
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "2018"
|
||||||
|
},
|
||||||
|
"extends": ["eslint:recommended", "eslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true
|
||||||
|
}
|
||||||
|
}
|
||||||
1
04-use-eslint-config-prettier-to-disable-unnecessary-eslint-stylistic-rules/.gitignore
vendored
Normal file
1
04-use-eslint-config-prettier-to-disable-unnecessary-eslint-stylistic-rules/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
node_modules
|
||||||
|
coverage
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
.build
|
||||||
|
|
||||||
|
# etc...
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"bracketSpacing": false,
|
||||||
|
"jsxBracketSameLine": false,
|
||||||
|
"printWidth": 80,
|
||||||
|
"proseWrap": "always",
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"useTabs": false
|
||||||
|
}
|
||||||
1054
04-use-eslint-config-prettier-to-disable-unnecessary-eslint-stylistic-rules/package-lock.json
generated
Normal file
1054
04-use-eslint-config-prettier-to-disable-unnecessary-eslint-stylistic-rules/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "static-testing-tools",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint src",
|
||||||
|
"format": "prettier --write \"**/*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)\""
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^5.5.0",
|
||||||
|
"eslint-config-prettier": "^3.0.1",
|
||||||
|
"prettier": "^1.14.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
const name = 'Freddy'
|
||||||
|
typeof name === 'string'
|
||||||
|
|
||||||
|
if (!('serviceWorker' in navigator)) {
|
||||||
|
// you have an old browser :-(
|
||||||
|
}
|
||||||
|
|
||||||
|
const greeting = 'hello'
|
||||||
|
console.log(`${greeting} world!`)
|
||||||
|
|
||||||
|
;[(1, 2, 3)].forEach(x => console.log(x))
|
||||||
12
05-validate-all-files-are-formatted-when-linting/.eslintrc
Normal file
12
05-validate-all-files-are-formatted-when-linting/.eslintrc
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "2018"
|
||||||
|
},
|
||||||
|
"extends": ["eslint:recommended", "eslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true
|
||||||
|
}
|
||||||
|
}
|
||||||
1
05-validate-all-files-are-formatted-when-linting/.gitignore
vendored
Normal file
1
05-validate-all-files-are-formatted-when-linting/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
node_modules
|
||||||
|
coverage
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
.build
|
||||||
|
|
||||||
|
# etc...
|
||||||
12
05-validate-all-files-are-formatted-when-linting/.prettierrc
Normal file
12
05-validate-all-files-are-formatted-when-linting/.prettierrc
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"bracketSpacing": false,
|
||||||
|
"jsxBracketSameLine": false,
|
||||||
|
"printWidth": 80,
|
||||||
|
"proseWrap": "always",
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"useTabs": false
|
||||||
|
}
|
||||||
1054
05-validate-all-files-are-formatted-when-linting/package-lock.json
generated
Normal file
1054
05-validate-all-files-are-formatted-when-linting/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "static-testing-tools",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint src",
|
||||||
|
"format": "npm run prettier -- --write",
|
||||||
|
"prettier": "prettier \"**/*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)\"",
|
||||||
|
"validate": "npm run lint && npm run prettier -- --list-different"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^5.5.0",
|
||||||
|
"eslint-config-prettier": "^3.0.1",
|
||||||
|
"prettier": "^1.14.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
const name = 'Freddy'
|
||||||
|
typeof name === 'string'
|
||||||
|
|
||||||
|
if (!('serviceWorker' in navigator)) {
|
||||||
|
// you have an old browser :-(
|
||||||
|
}
|
||||||
|
|
||||||
|
const greeting = 'hello'
|
||||||
|
console.log(`${greeting} world!`)
|
||||||
|
|
||||||
|
;[(1, 2, 3)].forEach(x => console.log(x))
|
||||||
1
06-install-run-and-configure-flow/.gitignore
vendored
Normal file
1
06-install-run-and-configure-flow/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
7
06-install-run-and-configure-flow/.prettierignore
Normal file
7
06-install-run-and-configure-flow/.prettierignore
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
node_modules
|
||||||
|
coverage
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
.build
|
||||||
|
|
||||||
|
# etc...
|
||||||
12
06-install-run-and-configure-flow/.prettierrc
Normal file
12
06-install-run-and-configure-flow/.prettierrc
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"bracketSpacing": false,
|
||||||
|
"jsxBracketSameLine": false,
|
||||||
|
"printWidth": 80,
|
||||||
|
"proseWrap": "always",
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"useTabs": false
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"parser": "babel-eslint",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "2018"
|
||||||
|
},
|
||||||
|
"extends": ["eslint:recommended", "eslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[ignore]
|
||||||
|
|
||||||
|
[include]
|
||||||
|
|
||||||
|
[libs]
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
|
||||||
|
[options]
|
||||||
|
|
||||||
|
[strict]
|
||||||
1
07-run-the-validate-script-in-a-pre-commit-git-hook-with-husky/.gitignore
vendored
Normal file
1
07-run-the-validate-script-in-a-pre-commit-git-hook-with-husky/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
node_modules
|
||||||
|
coverage
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
.build
|
||||||
|
|
||||||
|
# etc...
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"bracketSpacing": false,
|
||||||
|
"jsxBracketSameLine": false,
|
||||||
|
"printWidth": 80,
|
||||||
|
"proseWrap": "always",
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"useTabs": false
|
||||||
|
}
|
||||||
1235
07-run-the-validate-script-in-a-pre-commit-git-hook-with-husky/package-lock.json
generated
Normal file
1235
07-run-the-validate-script-in-a-pre-commit-git-hook-with-husky/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "static-testing-tools",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint src",
|
||||||
|
"flow": "flow",
|
||||||
|
"format": "npm run prettier -- --write",
|
||||||
|
"prettier": "prettier \"**/*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)\"",
|
||||||
|
"validate": "npm run lint && npm run prettier -- --list-different && npm run flow",
|
||||||
|
"precommit": "npm run validate"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"babel-eslint": "^9.0.0",
|
||||||
|
"eslint": "^5.5.0",
|
||||||
|
"eslint-config-prettier": "^3.0.1",
|
||||||
|
"flow-bin": "^0.81.0",
|
||||||
|
"husky": "^0.14.3",
|
||||||
|
"prettier": "^1.14.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
const name = 'Freddy'
|
||||||
|
typeof name === 'string'
|
||||||
|
|
||||||
|
if (!('serviceWorker' in navigator)) {
|
||||||
|
// you have an old browser :-(
|
||||||
|
}
|
||||||
|
|
||||||
|
const greeting = 'hello'
|
||||||
|
console.log(`${greeting} world!`)
|
||||||
|
;[(1, 2, 3)].forEach(x => console.log(x))
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// @flow
|
||||||
|
function add(a: number, b: number): number {
|
||||||
|
return a + b
|
||||||
|
}
|
||||||
|
|
||||||
|
type User = {
|
||||||
|
name: {
|
||||||
|
first: string,
|
||||||
|
middle: string,
|
||||||
|
last: string,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
function getFullName(user: User): string {
|
||||||
|
const {
|
||||||
|
name: {first, middle, last},
|
||||||
|
} = user
|
||||||
|
return [first, middle, last].filter(Boolean).join('')
|
||||||
|
}
|
||||||
|
|
||||||
|
add(1, 2)
|
||||||
|
|
||||||
|
getFullName({name: {first: 'Joe', middle: 'Bud', last: 'Matthews'}})
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"parser": "babel-eslint",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "2018"
|
||||||
|
},
|
||||||
|
"extends": ["eslint:recommended", "eslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[ignore]
|
||||||
|
|
||||||
|
[include]
|
||||||
|
|
||||||
|
[libs]
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
|
||||||
|
[options]
|
||||||
|
|
||||||
|
[strict]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"linters": {
|
||||||
|
"*.js": [
|
||||||
|
"eslint"
|
||||||
|
],
|
||||||
|
"*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)": [
|
||||||
|
"prettier --write",
|
||||||
|
"git add"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
node_modules
|
||||||
|
coverage
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
.build
|
||||||
|
|
||||||
|
# etc...
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"bracketSpacing": false,
|
||||||
|
"jsxBracketSameLine": false,
|
||||||
|
"printWidth": 80,
|
||||||
|
"proseWrap": "always",
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"useTabs": false
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "static-testing-tools",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint src",
|
||||||
|
"flow": "flow",
|
||||||
|
"format": "npm run prettier -- --write",
|
||||||
|
"prettier": "prettier \"**/*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)\"",
|
||||||
|
"validate": "npm run lint && npm run prettier -- --list-different && npm run flow",
|
||||||
|
"precommit": "lint-staged && npm run flow"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"babel-eslint": "^9.0.0",
|
||||||
|
"eslint": "^5.5.0",
|
||||||
|
"eslint-config-prettier": "^3.0.1",
|
||||||
|
"flow-bin": "^0.81.0",
|
||||||
|
"husky": "^0.14.3",
|
||||||
|
"lint-staged": "^7.2.2",
|
||||||
|
"prettier": "^1.14.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
const name = 'Freddy'
|
||||||
|
typeof name === 'string'
|
||||||
|
|
||||||
|
if (!('serviceWorker' in navigator)) {
|
||||||
|
// you have an old browser :-(
|
||||||
|
}
|
||||||
|
|
||||||
|
const greeting = 'hello'
|
||||||
|
console.log(`${greeting} world!`)
|
||||||
|
;[(1, 2, 3)].forEach(x => console.log(x))
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// @flow
|
||||||
|
function add(a: number, b: number): number {
|
||||||
|
return a + b
|
||||||
|
}
|
||||||
|
|
||||||
|
type User = {
|
||||||
|
name: {
|
||||||
|
first: string,
|
||||||
|
middle: string,
|
||||||
|
last: string,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
function getFullName(user: User): string {
|
||||||
|
const {
|
||||||
|
name: {first, middle, last},
|
||||||
|
} = user
|
||||||
|
return [first, middle, last].filter(Boolean).join('')
|
||||||
|
}
|
||||||
|
|
||||||
|
add(1, 2)
|
||||||
|
|
||||||
|
getFullName({name: {first: 'Joe', middle: 'Bud', last: 'Matthews'}})
|
||||||
Reference in New Issue
Block a user