Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Introduce typescript migration pipeline #352

Merged
merged 1 commit into from
Jan 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ node_modules
.idea
npm-debug.log
coverage
dist

# nyc test coverage
.nyc_output
19 changes: 19 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Logs
logs
*.log
npm-debug.log*

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

spec
.git
.vscode

dist/test
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ node_js:
- "0.12"
- "4"
- "5"
after_success:
- npm run codecov
script:
#test tooling doesn't support node < 4, build only
- if [ ! "$TRAVIS_NODE_VERSION" == "0.12" ]; then npm run codecov; fi
5 changes: 3 additions & 2 deletions index.js → index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var events = require('./lib/clients/events');
var retryPolicies = require('./lib/clients/retry-policies');
// tslint:disable:no-require-imports no-var-requires
const events = require('./lib/clients/events');
const retryPolicies = require('./lib/clients/retry-policies');

module.exports = {
WebClient: require('./lib/clients/web/client'),
Expand Down
52 changes: 46 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,46 @@
"name": "@slack/client",
"version": "3.10.0",
"description": "A library for creating a Slack client",
"main": "./index",
"main": "./dist/index.js",
"nyc": {
"include": [
"lib/*.ts",
"lib/*.js",
"test/**/*.ts",
"test/**/*.js"
],
"exclude": [
"node_modules",
"**/facets/*.js"
],
"extension": [
".ts",
".js"
],
"require": [
"ts-node/register"
],
"all": true
},
"lint-staged": {
"*.@(ts)": [
"tslint --fix",
"git add"
]
},
"scripts": {
"lint": "eslint . --ignore-path .gitignore",
"mocha": "mocha --recursive --reporter spec test",
"prepublish": "npm run build",
"precommit": "lint-staged",
"prepush": "npm run build",
"lint:js": "eslint . --ignore-path .gitignore",
"lint:ts": "tslint index.ts \"lib/**/*.ts\" \"test/**/*.ts\"",
"lint": "npm run lint:js && npm run lint:ts",
"mocha": "mocha --compilers ts:ts-node/register --recursive --reporter spec test",
"test": "npm run mocha && npm run lint",
"cover": "istanbul cover -x **/facets/*.js --report lcovonly _mocha -- --recursive",
"cover": "nyc --reporter=lcov npm test",
"codecov": "npm run cover && codecov",
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist",
"make-slack-client-symlink": "mkdir -p $PWD/node_modules/@slack/client && ln -s $PWD/index.js $PWD/node_modules/@slack/client/index.js",
"make-docs": "node jsdoc.js"
},
Expand Down Expand Up @@ -36,16 +69,23 @@
"ws": "^1.0.1"
},
"devDependencies": {
"@types/node": "^7.0.18",
"chai": "^3.5.0",
"codecov": "^1.0.1",
"eslint": "^2.2.0",
"eslint-config-airbnb": "^6.0.2",
"istanbul": "^0.4.2",
"husky": "^0.13.3",
"jsdoc-to-markdown": "^1.3.7",
"lint-staged": "^3.4.2",
"mocha": "^3.4.1",
"mocha-lcov-reporter": "^1.0.0",
"nock": "^7.2.2",
"sinon": "^1.17.1"
"nyc": "^10.3.2",
"shx": "^0.2.2",
"sinon": "^1.17.1",
"ts-node": "^3.0.4",
"tslint": "^5.2.0",
"typescript": "^2.3.2"
},
"engines": {
"node": ">= 0.12.x",
Expand Down
33 changes: 33 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"compilerOptions": {
"removeComments": false,
"preserveConstEnums": true,
"sourceMap": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"suppressImplicitAnyIndexErrors": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"noImplicitThis": true,
"noUnusedParameters": true,
"module": "commonjs",
"allowJs": true,
"moduleResolution": "node",
"pretty": true,
"target": "es5",
"outDir": "dist",
"lib": [
"es5",
"es2015",
"dom"
],
"typeRoots" : ["./node_modules/@types"]
},
"formatCodeOptions": {
"indentSize": 2,
"tabSize": 2
},
"exclude": [
"node_modules"
]
}
39 changes: 39 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"rules": {
"curly": true,
"eofline": false,
"align": [true, "parameters"],
"class-name": true,
"indent": [true, "spaces"],
"max-line-length": [true, 150],
"no-consecutive-blank-lines": [true],
"no-trailing-whitespace": true,
"no-duplicate-variable": true,
"no-var-keyword": true,
"no-empty": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-requires": true,
"no-require-imports": true,
"one-line": [true,
"check-else",
"check-whitespace",
"check-open-brace"],
"quotemark": [true,
"single",
"avoid-escape"],
"semicolon": [true, "always"],
"typedef-whitespace": [true, {
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}],
"whitespace": [true,
"check-branch",
"check-decl",
"check-operator",
"check-type"]
}
}