Skip to content

Commit

Permalink
修复 lint,并在代码中做相应调整,消除 lint 报错:no-shadowed-variables
Browse files Browse the repository at this point in the history
  • Loading branch information
chuan6 committed Aug 24, 2017
1 parent 757001a commit eb37495
Show file tree
Hide file tree
Showing 25 changed files with 48 additions and 5 deletions.
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/teambition-sdk-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/teambition-sdk-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 $!"
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/event/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/file/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/like/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/like/toggleLike.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/my/count.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/my/recent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/post/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -36,6 +37,7 @@ export function createPost (this: SDK, options: CreatePostOptions): Observable<P
SDK.prototype.createPost = createPost

declare module 'teambition-sdk-core/dist/cjs/SDK' {
// tslint:disable-next-line no-shadowed-variable
export interface SDK {
createPost: typeof createPost
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/post/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function deletePostFetch (
SDKFetch.prototype.deletePost = deletePostFetch

declare module 'teambition-sdk-core/dist/cjs/SDKFetch' {
// tslint:disable-next-line no-shadowed-variable
interface SDKFetch {
deletePost: typeof deletePostFetch
}
Expand All @@ -32,6 +33,7 @@ export function deletePost(
SDK.prototype.deletePost = deletePost

declare module 'teambition-sdk-core/dist/cjs/SDK' {
// tslint:disable-next-line no-shadowed-variable
interface SDK {
deletePost: typeof deletePost
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/post/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function getPostFetch(
SDKFetch.prototype.getPost = getPostFetch

declare module 'teambition-sdk-core/dist/cjs/SDKFetch' {
// tslint:disable-next-line no-shadowed-variable
interface SDKFetch {
getPost: typeof getPostFetch
}
Expand Down Expand Up @@ -41,6 +42,7 @@ export function getPost (
SDK.prototype.getPost = getPost

declare module 'teambition-sdk-core/dist/cjs/SDK' {
// tslint:disable-next-line no-shadowed-variable
interface SDK {
getPost: typeof getPost
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/post/getByTagId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function getByTagIdFetch(
SDKFetch.prototype.getPostsByTagId = getByTagIdFetch

declare module 'teambition-sdk-core/dist/cjs/SDKFetch' {
// tslint:disable-next-line no-shadowed-variable
interface SDKFetch {
getPostsByTagId: typeof getByTagIdFetch
}
Expand Down Expand Up @@ -68,6 +69,7 @@ export function getByTagId (
SDK.prototype.getPostsByTagId = getByTagId

declare module 'teambition-sdk-core/dist/cjs/SDK' {
// tslint:disable-next-line no-shadowed-variable
export interface SDK {
getPostsByTagId: typeof getByTagId
}
Expand Down
1 change: 1 addition & 0 deletions packages/teambition-sdk-request/src/post/getMyProjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function getMyProjectPosts (
SDK.prototype.getMyProjectPosts = getMyProjectPosts

declare module 'teambition-sdk-core/dist/cjs/SDK' {
// tslint:disable-next-line no-shadowed-variable
export interface SDK {
getMyProjectPosts: typeof getMyProjectPosts
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/post/getProjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function getPostsFetch<T extends ProjectPostType>(
SDKFetch.prototype.getPosts = getPostsFetch

declare module 'teambition-sdk-core/dist/cjs/SDKFetch' {
// tslint:disable-next-line no-shadowed-variable
interface SDKFetch {
getPosts: typeof getPostsFetch
}
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/post/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions packages/teambition-sdk-request/src/project/personal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions packages/teambition-sdk-request/src/search/members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/task/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/user/addEmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions packages/teambition-sdk-request/src/user/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions packages/teambition-sdk-request/src/user/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function updateUserFetch<T> (
SDKFetch.prototype.updateUser = updateUserFetch

declare module 'teambition-sdk-core/dist/cjs/SDKFetch' {
// tslint:disable-next-line no-shadowed-variable
interface SDKFetch {
updateUser: typeof updateUserFetch
}
Expand All @@ -31,6 +32,7 @@ export function updateUser<T>(
SDK.prototype.updateUser = updateUser

declare module 'teambition-sdk-core/dist/cjs/SDK' {
// tslint:disable-next-line no-shadowed-variable
interface SDK {
updateUser: typeof updateUser
}
Expand Down
9 changes: 8 additions & 1 deletion packages/teambition-sdk-testutil/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
}

0 comments on commit eb37495

Please sign in to comment.