Skip to content

Commit

Permalink
Merge pull request #2 from rjchow/feat/add-typescript
Browse files Browse the repository at this point in the history
feat(language-support): added typescript
  • Loading branch information
rjchow authored Jun 7, 2019
2 parents 4684e46 + a5fb9cb commit faa4545
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 43 deletions.
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
}
}
],
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
Expand Down
31 changes: 23 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
{
"parser": "babel-eslint",
"extends": [
"airbnb-base",
"plugin:prettier/recommended"
],
"plugins": [
],
"extends": ["airbnb-base", "plugin:prettier/recommended"],
"env": {
"jest": true
},
"rules": {
}
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint"],
"rules": {
"no-undef": "off",
"no-unused-vars": "off",
"no-restricted-globals": "off"
}
}
]
}
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,7 @@ It'll automatically run `test`, `lint`, `docs`, `build`, generate `CHANGELOG.md`

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

- [sayHello](#sayhello)
- [Parameters](#parameters)

### sayHello

This function says hello.

#### Parameters

- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Some name to say hello for.

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The hello.
### Table of Contents

## License

Expand Down
144 changes: 129 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,41 @@
"src"
],
"scripts": {
"type-check": "tsc --noEmit",
"test": "jest",
"coverage": "npm test -- --coverage",
"postcoverage": "opn coverage/lcov-report/index.html",
"lint": "eslint .",
"lint": "eslint . --ext js,ts,tsx",
"docs": "documentation readme src --section=API",
"postdocs": "git add README.md",
"clean": "rimraf dist",
"prebuild": "npm run docs && npm run clean",
"build": "babel src -d dist",
"build": "tsc --emitDeclarationOnly && babel src -d dist -x .js,.ts,.tsx",
"preversion": "npm run lint && npm test && npm run build",
"semantic-release": "semantic-release"
},
"types": "dist/ts/src",
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"eslint --fix",
"*.{js,ts,tsx}": [
"eslint --fix --ext js,ts,tsx",
"git add"
]
},
"keywords": [
"generator-nod"
],
"dependencies": {},
"dependencies": {
"@babel/preset-typescript": "7.3.3",
"@types/jest": "24.0.13",
"@typescript-eslint/eslint-plugin": "1.9.0",
"@typescript-eslint/parser": "1.9.0",
"typescript": "3.5.1"
},
"devDependencies": {
"@babel/cli": "7.2.3",
"@babel/core": "7.3.4",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js → src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
* @param name Some name to say hello for.
* @returns The hello.
*/
const sayHello = (name = "Haz") => `Hello, ${name}!`;
const sayHello = (name: string = "Haz"): string => `Hello, ${name}!`;

export default sayHello;
16 changes: 16 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"outDir": "dist/ts",
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"strict": true,
"declaration": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"stripInternal": true
}
}

0 comments on commit faa4545

Please sign in to comment.