diff --git a/circle.yml b/circle.yml index 40fa6f77c..7ee9880fd 100644 --- a/circle.yml +++ b/circle.yml @@ -16,7 +16,7 @@ test: - yarn test pre: - greenkeeper-lockfile-update - - lerna run build_cjs + - yarn build_all post: - npm run check_circular_dependencies - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js diff --git a/package.json b/package.json index 92fe01ad2..5903a92dd 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,9 @@ "packages/*" ], "scripts": { - "build_all": "lerna run build_cjs", + "build_all": "lerna exec npm run build_cjs", "check_circular_dependencies": "madge ./packages/*/dist/cjs --circular", + "lint": "lerna exec npm run lint", "test": "rm -rf ./coverage && nyc lerna exec npm test" }, "repository": { diff --git a/packages/teambition-sdk-core/package.json b/packages/teambition-sdk-core/package.json index 09c210a82..b6e9d8c09 100644 --- a/packages/teambition-sdk-core/package.json +++ b/packages/teambition-sdk-core/package.json @@ -14,7 +14,7 @@ "build_socket": "rm -rf dist/bundle/tbsdk.socket.js && tsc ./src/SocketApp.ts ./src/teambition.ts -m commonjs --outDir dist/socket --sourcemap --inlineSources --target ES5 -d --diagnostics --pretty --experimentalDecorators --suppressImplicitAnyIndexErrors --moduleResolution node --lib es5,es2015.iterable,es2015.collection,es2015.promise,es2015.core,dom && ts-node ./tools/tasks/bundle.socket.ts", "build_test": "rm -rf spec-js && tsc --project test", "copy_files": "cp README.md package.json ./dist/cjs/", - "lint": "tslint ./src/**/*.ts ./mock/**/*.ts ./test/*.ts ./test/apis/**/*.ts ./test/mock/**/*.ts ./test/utils/**/*.ts", + "lint": "tslint --project . --config ../../tslint.json", "publish_sdk": "npm run build_all && npm run copy_files && npm publish ./dist/cjs", "publish_all": "npm run publish_sdk && ts-node ./tools/tasks/publish.ts && cp -r ./dist/mock-cjs/** ./.tmp/mock && cp -r ./dist/socket/** ./.tmp/socket && npm publish .tmp/mock/ && npm publish .tmp/socket/", "test": "npm run lint && npm run build_test && tman --mocha spec-js/test/app.js", diff --git a/packages/teambition-sdk-request/package.json b/packages/teambition-sdk-request/package.json index 68a113009..acfe00445 100644 --- a/packages/teambition-sdk-request/package.json +++ b/packages/teambition-sdk-request/package.json @@ -7,7 +7,7 @@ "scripts": { "build_cjs": "rm -rf dist/cjs && tsc src/index.ts -m commonjs --outDir dist/cjs --sourcemap --inlineSources --target ES5 -d --diagnostics --pretty --strict --noUnusedLocals --noUnusedParameters --experimentalDecorators --suppressImplicitAnyIndexErrors --moduleResolution node --importHelpers --noEmitHelpers --lib es5,es2015.iterable,es2015.collection,es2015.promise,es2015.core,dom", "build_test": "rm -rf spec-js && tsc --project test", - "lint": "tslint ./src/**/*.ts ./mock/**/*.ts ./test/*.ts ./test/apis/**/*.ts ./test/mock/**/*.ts ./test/utils/**/*.ts", + "lint": "tslint --project . --config ../../tslint.json", "test": "npm run lint && npm run build_test && tman --mocha spec-js/test/app.js", "watch_test": "tsc --project test --watch --skipLibCheck", "watch": "npm run watch_test & ts-node ../../tools/tasks/test.ts $!" diff --git a/packages/teambition-sdk-request/src/event/get.ts b/packages/teambition-sdk-request/src/event/get.ts index 55ee3785f..609a2679a 100644 --- a/packages/teambition-sdk-request/src/event/get.ts +++ b/packages/teambition-sdk-request/src/event/get.ts @@ -17,6 +17,7 @@ export function getEventFetch( SDKFetch.prototype.getEvent = getEventFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { getEvent: typeof getEventFetch } @@ -46,6 +47,7 @@ export function getEvent( SDK.prototype.getEvent = getEvent declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable interface SDK { getEvent: typeof getEvent } diff --git a/packages/teambition-sdk-request/src/file/get.ts b/packages/teambition-sdk-request/src/file/get.ts index 262ad8b17..c59357459 100644 --- a/packages/teambition-sdk-request/src/file/get.ts +++ b/packages/teambition-sdk-request/src/file/get.ts @@ -14,6 +14,7 @@ export function getFileFetch( SDKFetch.prototype.getFile = getFileFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { getFile: typeof getFileFetch } @@ -42,6 +43,7 @@ export function getFile ( SDK.prototype.getFile = getFile declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable interface SDK { getFile: typeof getFile } diff --git a/packages/teambition-sdk-request/src/like/get.ts b/packages/teambition-sdk-request/src/like/get.ts index 2112d4d72..3c5eb757d 100644 --- a/packages/teambition-sdk-request/src/like/get.ts +++ b/packages/teambition-sdk-request/src/like/get.ts @@ -16,6 +16,7 @@ export function getLikeFetch ( SDKFetch.prototype.getLike = getLikeFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { getLike: typeof getLikeFetch } @@ -39,6 +40,7 @@ export function getLike ( SDK.prototype.getLike = getLike declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable interface SDK { getLike: typeof getLike } diff --git a/packages/teambition-sdk-request/src/like/toggleLike.ts b/packages/teambition-sdk-request/src/like/toggleLike.ts index 71de400f5..3e4628ee2 100644 --- a/packages/teambition-sdk-request/src/like/toggleLike.ts +++ b/packages/teambition-sdk-request/src/like/toggleLike.ts @@ -20,6 +20,7 @@ export function toggleLikeFetch ( SDKFetch.prototype.toggleLike = toggleLikeFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { toggleLike: typeof toggleLikeFetch } @@ -42,6 +43,7 @@ export function toggleLike ( SDK.prototype.toggleLike = toggleLike declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable interface SDK { toggleLike: typeof toggleLike } diff --git a/packages/teambition-sdk-request/src/my/count.ts b/packages/teambition-sdk-request/src/my/count.ts index 02a9645cf..2959f93cc 100644 --- a/packages/teambition-sdk-request/src/my/count.ts +++ b/packages/teambition-sdk-request/src/my/count.ts @@ -19,6 +19,7 @@ export function getMyCountFetch( SDKFetch.prototype.getMyCount = getMyCountFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { getMyCount: typeof getMyCountFetch } @@ -33,6 +34,7 @@ export function getMyCount( SDK.prototype.getMyCount = getMyCount declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable interface SDK { getMyCount: typeof getMyCount } diff --git a/packages/teambition-sdk-request/src/my/recent.ts b/packages/teambition-sdk-request/src/my/recent.ts index 741a53faa..addb6b4cb 100644 --- a/packages/teambition-sdk-request/src/my/recent.ts +++ b/packages/teambition-sdk-request/src/my/recent.ts @@ -34,6 +34,7 @@ export function getMyRecentFetch( SDKFetch.prototype.getMyRecent = getMyRecentFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { getMyRecent: typeof getMyRecentFetch } @@ -169,6 +170,7 @@ export function getMyRecent( SDK.prototype.getMyRecent = getMyRecent declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable interface SDK { getMyRecent: typeof getMyRecent } diff --git a/packages/teambition-sdk-request/src/organization/projects.ts b/packages/teambition-sdk-request/src/organization/projects.ts index 4ae75ad13..8605a1f09 100644 --- a/packages/teambition-sdk-request/src/organization/projects.ts +++ b/packages/teambition-sdk-request/src/organization/projects.ts @@ -59,6 +59,7 @@ SDKFetch.prototype.getOrganizationProjectsByTagId = getOrganizationProjectsByTag SDKFetch.prototype.getUngroupedOrganizationProjects = getUngroupedOrganizationProjects declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { getAllOrganizationProjects: typeof getAllOrganizationProjects, getJoinedOrganizationProjects: typeof getJoinedOrganizationProjects, diff --git a/packages/teambition-sdk-request/src/post/create.ts b/packages/teambition-sdk-request/src/post/create.ts index 824d2bff6..25dbc1188 100644 --- a/packages/teambition-sdk-request/src/post/create.ts +++ b/packages/teambition-sdk-request/src/post/create.ts @@ -20,6 +20,7 @@ export function createPostFetch(this: SDKFetch, options: CreatePostOptions): Obs SDKFetch.prototype.createPost = createPostFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable export interface SDKFetch { createPost: typeof createPostFetch } @@ -36,6 +37,7 @@ export function createPost (this: SDK, options: CreatePostOptions): Observable

( SDKFetch.prototype.getPosts = getPostsFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { getPosts: typeof getPostsFetch } @@ -70,6 +71,7 @@ export function getAllProjectPosts ( SDK.prototype.getAllProjectPosts = getAllProjectPosts declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable export interface SDK { getAllProjectPosts: typeof getAllProjectPosts } diff --git a/packages/teambition-sdk-request/src/post/update.ts b/packages/teambition-sdk-request/src/post/update.ts index 40254a26c..e23b09be0 100644 --- a/packages/teambition-sdk-request/src/post/update.ts +++ b/packages/teambition-sdk-request/src/post/update.ts @@ -22,6 +22,7 @@ export function updatePostFetch( SDKFetch.prototype.updatePost = updatePostFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { updatePost: typeof updatePostFetch } @@ -43,6 +44,7 @@ export function updatePost( SDK.prototype.updatePost = updatePost declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable interface SDK { updatePost: typeof updatePost } diff --git a/packages/teambition-sdk-request/src/project/personal.ts b/packages/teambition-sdk-request/src/project/personal.ts index def4385b1..a9808dbb0 100644 --- a/packages/teambition-sdk-request/src/project/personal.ts +++ b/packages/teambition-sdk-request/src/project/personal.ts @@ -22,6 +22,7 @@ export function getPersonalProjects( SDKFetch.prototype.getPersonalProjects = getPersonalProjects declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { getPersonalProjects: typeof getPersonalProjects } diff --git a/packages/teambition-sdk-request/src/search/members.ts b/packages/teambition-sdk-request/src/search/members.ts index dab9526d3..a13b4b9a1 100644 --- a/packages/teambition-sdk-request/src/search/members.ts +++ b/packages/teambition-sdk-request/src/search/members.ts @@ -95,6 +95,7 @@ SDKFetch.prototype.searchMembersInGroup = searchMembersInGroup SDKFetch.prototype.searchMembers = searchMembers declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { searchMembersInTeam: typeof searchMembersInTeam, searchMembersInProject: typeof searchMembersInProject, diff --git a/packages/teambition-sdk-request/src/task/get.ts b/packages/teambition-sdk-request/src/task/get.ts index 6e995359e..c43916f1d 100644 --- a/packages/teambition-sdk-request/src/task/get.ts +++ b/packages/teambition-sdk-request/src/task/get.ts @@ -14,6 +14,7 @@ export function getTaskFetch( SDKFetch.prototype.getTask = getTaskFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { getTask: typeof getTaskFetch } @@ -49,6 +50,7 @@ export function getTask( SDK.prototype.getTask = getTask declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable interface SDK { getTask: typeof getTask } diff --git a/packages/teambition-sdk-request/src/user/addEmail.ts b/packages/teambition-sdk-request/src/user/addEmail.ts index e79c4a122..38268fb30 100644 --- a/packages/teambition-sdk-request/src/user/addEmail.ts +++ b/packages/teambition-sdk-request/src/user/addEmail.ts @@ -11,6 +11,7 @@ export function addEmailFetch ( SDKFetch.prototype.addEmail = addEmailFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { addEmail: typeof addEmailFetch } @@ -31,6 +32,7 @@ export function addEmail( SDK.prototype.addEmail = addEmail declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable interface SDK { addEmail: typeof addEmail } diff --git a/packages/teambition-sdk-request/src/user/get.ts b/packages/teambition-sdk-request/src/user/get.ts index d85a910d5..d71fd0bd6 100644 --- a/packages/teambition-sdk-request/src/user/get.ts +++ b/packages/teambition-sdk-request/src/user/get.ts @@ -15,6 +15,7 @@ export function getUserMe ( SDK.prototype.getUserMe = getUserMe declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable interface SDK { getUserMe: typeof getUserMe } diff --git a/packages/teambition-sdk-request/src/user/update.ts b/packages/teambition-sdk-request/src/user/update.ts index fc9118860..dd47e091c 100644 --- a/packages/teambition-sdk-request/src/user/update.ts +++ b/packages/teambition-sdk-request/src/user/update.ts @@ -11,6 +11,7 @@ export function updateUserFetch ( SDKFetch.prototype.updateUser = updateUserFetch declare module 'teambition-sdk-core/dist/cjs/SDKFetch' { + // tslint:disable-next-line no-shadowed-variable interface SDKFetch { updateUser: typeof updateUserFetch } @@ -31,6 +32,7 @@ export function updateUser( SDK.prototype.updateUser = updateUser declare module 'teambition-sdk-core/dist/cjs/SDK' { + // tslint:disable-next-line no-shadowed-variable interface SDK { updateUser: typeof updateUser } diff --git a/packages/teambition-sdk-testutil/package.json b/packages/teambition-sdk-testutil/package.json index 170270491..c46ec0e0b 100644 --- a/packages/teambition-sdk-testutil/package.json +++ b/packages/teambition-sdk-testutil/package.json @@ -6,7 +6,9 @@ "main": "./dist/cjs/index.js", "typings": "./dist/cjs/index.d.ts", "scripts": { - "build_cjs": "rm -rf dist/cjs && tsc" + "build_cjs": "rm -rf dist/cjs && tsc", + "lint": "tslint --project . --exclude src/fixture/**/*.ts --config ../../tslint.json", + "test": "npm run lint" }, "repository": { "type": "git", @@ -27,5 +29,10 @@ "homepage": "https://github.com/teambition/teambition-sdk#readme", "peerDependencies": { "core-js": "^2.4.1" + }, + "devDependencies": { + "tslint": "^5.5.0", + "tslint-eslint-rules": "^4.1.1", + "typescript": "^2.4.2" } }