27 Commits

Author SHA1 Message Date
Kent C. Dodds
281993d1ca add npm-run-all --parallel 2019-08-14 11:59:53 -06:00
Kent C. Dodds
a1e30ee995 add lint-staged 2019-08-14 11:59:52 -06:00
Kent C. Dodds
cc6fdf9d84 add husky 2019-08-14 11:59:50 -06:00
Kent C. Dodds
a5d2d971dd add typescript 2019-08-14 11:59:13 -06:00
Kent C. Dodds
b41c948eeb prettier --list-different 2019-08-06 13:43:20 -06:00
Kent C. Dodds
a8d752b04f setup eslint-config-prettier 2019-08-06 13:43:19 -06:00
Kent C. Dodds
dda36098bd config prettier 2019-08-06 13:43:17 -06:00
Kent C. Dodds
945eaac136 install and run prettier 2019-08-06 13:43:16 -06:00
Kent C. Dodds
df642497e9 scripting eslint 2019-08-06 13:43:15 -06:00
Kent C. Dodds
8fb12ded93 eslint extends 2019-08-06 13:43:11 -06:00
Kent C. Dodds
acf0e58463 eslint: config 2019-08-06 13:41:33 -06:00
Kent C. Dodds
c204cda937 init 2019-07-31 22:52:15 -06:00
Kent C. Dodds
cd5939daf8 I think this is it 2019-07-31 20:24:08 -06:00
Kent C. Dodds
cc722afcb2 progress 2019-07-31 20:20:48 -06:00
Kent C. Dodds
571fc946b8 some progress made 2019-07-31 17:10:32 -06:00
Kent C. Dodds
898876d0d2 fix husky 2019-07-31 12:54:29 -06:00
Kent C. Dodds
9c51bd92fa improve things 2019-07-31 12:53:54 -06:00
Kent C. Dodds
f10cfb98ce progress 2019-07-31 12:51:37 -06:00
Zac Jones
860492ad3f updated to folders in master (#1) 2018-10-24 09:58:04 -06:00
Kent C. Dodds
4e579627b7 lint-staged 2018-09-14 22:16:10 -06:00
Kent C. Dodds
053c5de689 husky 2018-09-14 22:14:43 -06:00
Kent C. Dodds
d43c846d12 flow all the things 2018-09-14 22:13:35 -06:00
Kent C. Dodds
437ed30ddb list different 2018-09-14 22:01:31 -06:00
Kent C. Dodds
94216f47e8 setup eslint-config-prettier 2018-09-14 21:49:45 -06:00
Kent C. Dodds
4f2fde56e2 config prettier 2018-09-14 21:49:32 -06:00
Kent C. Dodds
c077931399 prettier! 2018-09-14 21:49:31 -06:00
Kent C. Dodds
82342de51c install, config, run 2018-09-14 21:49:25 -06:00
11 changed files with 5797 additions and 16 deletions

12
.babelrc Normal file
View File

@@ -0,0 +1,12 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "10"
}
}
]
]
}

25
.eslintrc Normal file
View File

@@ -0,0 +1,25 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2019,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint/eslint-plugin"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"eslint-config-prettier",
"eslint-config-prettier/@typescript-eslint"
],
"rules": {
"strict": ["error", "never"]
},
"env": {
"browser": true
}
}

1
.gitignore vendored
View File

@@ -1 +1,2 @@
node_modules
dist

5
.huskyrc Normal file
View File

@@ -0,0 +1,5 @@
{
"hooks": {
"pre-commit": "npm run check-types && lint-staged"
}
}

9
.lintstagedrc Normal file
View File

@@ -0,0 +1,9 @@
{
"*.js": [
"eslint"
],
"*.+(js|json|ts)": [
"prettier --write",
"git add"
]
}

17
.prettierrc Normal file
View File

@@ -0,0 +1,17 @@
{
"arrowParens": "avoid",
"bracketSpacing": false,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "always",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}

5669
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,29 @@
{
"name": "static-testing-tools",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {},
"keywords": [],
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
"license": "MIT",
"devDependencies": {}
"private": true,
"author": "Kent C. Dodds (http://kentcdodds.com/)",
"license": "GPLv3",
"scripts": {
"build": "babel src --out-dir dist",
"lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx .",
"check-types": "tsc",
"prettier": "prettier --ignore-path .gitignore --write \"**/*.+(js|json)\"",
"format": "npm run prettier -- --write",
"check-format": "npm run prettier -- --list-different",
"validate": "npm-run-all --parallel check-types check-format lint build"
},
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.0.0",
"eslint": "^6.1.0",
"eslint-config-prettier": "^6.0.0",
"husky": "^3.0.2",
"lint-staged": "^9.2.1",
"npm-run-all": "^4.1.5",
"prettier": "^1.18.2",
"typescript": "^3.5.3"
}
}

View File

@@ -1,11 +1,10 @@
const name = 'Freddy'
typeof name === 'strng'
const username = 'freddy'
typeof username === 'string'
if (!'serviceWorker' in navigator) {
if (!('serviceWorker' in navigator)) {
// you have an old browser :-(
}
const greeting = 'hello'
console.log('${greting} world!')
[(1, 2, 3)].forEach(x => console.log(x))
console.log(`${greeting} world!`)
;[1, 2, 3].forEach(x => console.log(x))

21
src/typescript-example.ts Normal file
View File

@@ -0,0 +1,21 @@
function add(a: number, b: number): number {
return a + b
}
interface 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'}})

9
tsconfig.json Normal file
View File

@@ -0,0 +1,9 @@
{
"compilerOptions": {
// because we're compiling with Babel instead of TypeScript
// and we're only using TypeScript for type checking, we'll set "noEmit"
// to true so running type checking doesn't generate any files.
"noEmit": true,
"baseUrl": "./src"
}
}