Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Add code formatters (#16)
Browse files Browse the repository at this point in the history
* Add code formatters

Signed-off-by: Vitaliy Guliy <[email protected]>

* Add formatter for eclipse-che-theia-plugin

Signed-off-by: Vitaliy Guliy <[email protected]>
  • Loading branch information
Vitaliy Gulyy authored Jan 11, 2019
1 parent 167acf2 commit 3f3e3cf
Show file tree
Hide file tree
Showing 18 changed files with 592 additions and 427 deletions.
16 changes: 9 additions & 7 deletions extensions/eclipse-che-theia-plugin-ext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,27 @@
"src"
],
"dependencies": {
"@theia/core": "0.3.18",
"@theia/plugin-ext": "0.3.18",
"@eclipse-che/plugin": "latest",
"@eclipse-che/workspace-client": "^0.0.1-1546509769"
"@eclipse-che/workspace-client": "^0.0.1-1546509769",
"@theia/core": "0.3.18",
"@theia/plugin-ext": "0.3.18"
},
"devDependencies": {
"clean-webpack-plugin": "^0.1.19",
"rimraf": "2.6.2",
"ts-loader": "^4.1.0",
"ts-node": "5.0.1",
"typescript": "^2.9.2",
"typescript-formatter": "7.2.2",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.1",
"clean-webpack-plugin": "^0.1.19",
"ts-loader": "^4.1.0"
"webpack-cli": "^3.1.1"
},
"scripts": {
"prepare": "yarn run clean && yarn run build",
"clean": "rimraf lib",
"compile": "tsc",
"build": "yarn run compile && yarn run compileWorker",
"format-code": "tsfmt -r",
"build": "yarn run format-code && yarn run compile && yarn run compileWorker",
"compileWorker": "webpack-cli --config webpack.config.js",
"watch": "tsc -w"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class CheVariablesMainImpl implements CheVariablesMain {
this.disposableMap = new Map()
}

async $registerVariable(variable: Variable ): Promise<void> {
async $registerVariable(variable: Variable): Promise<void> {
const handle = (id: number) => {
return this.proxy.$resolveVariable(id);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function createAPIFactory(rpc: RPCProtocol): CheApiFactory {
const cheFactoryImpl = rpc.set(PLUGIN_RPC_CONTEXT.CHE_FACTORY, new CheFactoryImpl(rpc));
const cheVariablesImpl = rpc.set(PLUGIN_RPC_CONTEXT.CHE_VARIABLES, new CheVariablesImpl(rpc));

return function (plugin: Plugin): typeof che {
return function(plugin: Plugin): typeof che {
const workspace: typeof che.workspace = {
getCurrentWorkspace(): Promise<cheApi.workspace.Workspace> {
return cheWorkspaceImpl.getCurrentWorkspace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { RPCProtocol } from '@theia/plugin-ext/lib/api/rpc-protocol';
import { PLUGIN_RPC_CONTEXT, CheVariables, CheVariablesMain } from '../common/che-protocol';
import * as che from '@eclipse-che/plugin';

export class CheVariablesImpl implements CheVariables{
export class CheVariablesImpl implements CheVariables {

private readonly cheVariablesMain: CheVariablesMain;
private readonly variablesCache = new Map<number, che.Variable>();
Expand All @@ -38,7 +38,7 @@ export class CheVariablesImpl implements CheVariables{
}

private addNewVariable(variable: che.Variable): number {
const callId = this.callId ++;
const callId = this.callId++;
this.variablesCache.set(callId, variable);
return callId;
}
Expand All @@ -49,7 +49,7 @@ export class CheVariablesImpl implements CheVariables{

async $resolveVariable(variableId: number): Promise<string | undefined> {
const variable = this.variablesCache.get(variableId);
if (variable ) {
if (variable) {
if (variable.isResolved && variable.value) {
return variable.value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function overrideInternalLoad(): void {

// if we try to resolve che module, return the filename entry to use cache.
// tslint:disable-next-line:no-any
module._load = function (request: string, parent: any, isMain: {}) {
module._load = function(request: string, parent: any, isMain: {}) {
if (request !== '@eclipse-che/plugin') {
return internalLoad.apply(this, arguments);
}
Expand Down
18 changes: 18 additions & 0 deletions extensions/eclipse-che-theia-plugin-ext/tsfmt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"baseIndentSize": 0,
"newLineCharacter": "\n",
"indentSize": 4,
"tabSize": 4,
"indentStyle": 4,
"convertTabsToSpaces": true,
"insertSpaceAfterCommaDelimiter": true,
"insertSpaceAfterSemicolonInForStatements": true,
"insertSpaceBeforeAndAfterBinaryOperators": true,
"insertSpaceAfterKeywordsInControlFlowStatements": true,
"insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
"placeOpenBraceOnNewLineForFunctions": false,
"placeOpenBraceOnNewLineForControlBlocks": false
}
43 changes: 39 additions & 4 deletions extensions/eclipse-che-theia-plugin-ext/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==

"@types/node@*":
"@types/node@*", "@types/node@^10.11.7":
version "10.12.18"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67"
integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==
Expand Down Expand Up @@ -632,7 +632,7 @@
resolved "https://registry.yarnpkg.com/@types/route-parser/-/route-parser-0.1.1.tgz#24b69588c68249f695122c230e547d3d6c8be095"
integrity sha512-VF2jxpkSGehlHBcfnVbVuvAp9/EdGr9Gi0C9qOZk4IKMGuYwFkF6AmsRNhN4V1WeLX+FpaXXa7PwYjQNQeVJiA==

"@types/semver@^5.4.0":
"@types/semver@^5.4.0", "@types/semver@^5.5.0":
version "5.5.0"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45"
integrity sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==
Expand Down Expand Up @@ -1524,6 +1524,11 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
dependencies:
delayed-stream "~1.0.0"

commander@^2.19.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==

commander@~2.17.1:
version "2.17.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
Expand All @@ -1536,6 +1541,11 @@ commander@~2.8.1:
dependencies:
graceful-readlink ">= 1.0.0"

commandpost@^1.0.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/commandpost/-/commandpost-1.4.0.tgz#89218012089dfc9b67a337ba162f15c88e0f1048"
integrity sha512-aE2Y4MTFJ870NuB/+2z1cXBhSBBzRydVVjzhFC4gtenEhpnj15yu0qptWGJsO9YGrcPZ3ezX8AWb1VA391MKpQ==

commondir@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
Expand Down Expand Up @@ -1989,6 +1999,18 @@ ecc-jsbn@~0.1.1:
jsbn "~0.1.0"
safer-buffer "^2.1.0"

editorconfig@^0.15.0:
version "0.15.2"
resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.2.tgz#047be983abb9ab3c2eefe5199cb2b7c5689f0702"
integrity sha512-GWjSI19PVJAM9IZRGOS+YKI8LN+/sjkSjNyvxL5ucqP9/IqtYNXBaQ/6c/hkPNYQHyOHra2KoXZI/JVpuqwmcQ==
dependencies:
"@types/node" "^10.11.7"
"@types/semver" "^5.5.0"
commander "^2.19.0"
lru-cache "^4.1.3"
semver "^5.6.0"
sigmund "^1.0.1"

[email protected]:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
Expand Down Expand Up @@ -3423,7 +3445,7 @@ loud-rejection@^1.0.0:
currently-unhandled "^0.4.1"
signal-exit "^3.0.0"

lru-cache@^4.0.0, lru-cache@^4.0.1, lru-cache@^4.1.1:
lru-cache@^4.0.0, lru-cache@^4.0.1, lru-cache@^4.1.1, lru-cache@^4.1.3:
version "4.1.5"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==
Expand Down Expand Up @@ -4858,7 +4880,7 @@ seek-bzip@^1.0.5:
dependencies:
commander "~2.8.1"

"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0:
"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0:
version "5.6.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
Expand Down Expand Up @@ -4968,6 +4990,11 @@ shell-path@^2.0.0:
dependencies:
shell-env "^0.3.0"

sigmund@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590"
integrity sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=

signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
Expand Down Expand Up @@ -5556,6 +5583,14 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

[email protected]:
version "7.2.2"
resolved "https://registry.yarnpkg.com/typescript-formatter/-/typescript-formatter-7.2.2.tgz#a147181839b7bb09c2377b072f20f6336547c00a"
integrity sha512-V7vfI9XArVhriOTYHPzMU2WUnm5IMdu9X/CPxs8mIMGxmTBFpDABlbkBka64PZJ9/xgQeRpK8KzzAG4MPzxBDQ==
dependencies:
commandpost "^1.0.0"
editorconfig "^0.15.0"

typescript@^2.9.2:
version "2.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
Expand Down
47 changes: 26 additions & 21 deletions extensions/eclipse-che-theia-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
{
"name": "@eclipse-che/plugin",
"version": "0.0.1",
"description": "Eclipse Che specific Theia plugin API",
"publishConfig": {
"access": "public"
},
"license": "EPL-2.0",
"types": "./src/che.d.ts",
"files": [
"src"
],
"dependencies": {
"@eclipse-che/api": "^6.16.1"
},
"scripts": {
"prepare": "",
"clean": "",
"build": "",
"watch": "",
"publish:next": "yarn publish --registry=https://registry.npmjs.org/ --no-git-tag-version --new-version 0.0.1-\"$(date +%s)\""
}
"name": "@eclipse-che/plugin",
"version": "0.0.1",
"description": "Eclipse Che specific Theia plugin API",
"publishConfig": {
"access": "public"
},
"license": "EPL-2.0",
"types": "./src/che.d.ts",
"files": [
"src"
],
"dependencies": {
"@eclipse-che/api": "^6.16.1"
},
"scripts": {
"prepare": "",
"format-code": "tsfmt -r",
"clean": "",
"build": "yarn run format-code",
"watch": "",
"publish:next": "yarn publish --registry=https://registry.npmjs.org/ --no-git-tag-version --new-version 0.0.1-\"$(date +%s)\""
},
"devDependencies": {
"typescript": "^2.9.2",
"typescript-formatter": "7.2.2"
}
}
18 changes: 18 additions & 0 deletions extensions/eclipse-che-theia-plugin/tsfmt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"baseIndentSize": 0,
"newLineCharacter": "\n",
"indentSize": 4,
"tabSize": 4,
"indentStyle": 4,
"convertTabsToSpaces": true,
"insertSpaceAfterCommaDelimiter": true,
"insertSpaceAfterSemicolonInForStatements": true,
"insertSpaceBeforeAndAfterBinaryOperators": true,
"insertSpaceAfterKeywordsInControlFlowStatements": true,
"insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
"placeOpenBraceOnNewLineForFunctions": false,
"placeOpenBraceOnNewLineForControlBlocks": false
}
73 changes: 73 additions & 0 deletions extensions/eclipse-che-theia-plugin/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,76 @@
"@eclipse-che/api@^6.16.1":
version "6.16.1"
resolved "https://registry.yarnpkg.com/@eclipse-che/api/-/api-6.16.1.tgz#5b5e70285cf27d525df3752c938388e36f7925d6"

"@types/node@^10.11.7":
version "10.12.18"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67"
integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==

"@types/semver@^5.5.0":
version "5.5.0"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45"
integrity sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==

commander@^2.19.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==

commandpost@^1.0.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/commandpost/-/commandpost-1.4.0.tgz#89218012089dfc9b67a337ba162f15c88e0f1048"
integrity sha512-aE2Y4MTFJ870NuB/+2z1cXBhSBBzRydVVjzhFC4gtenEhpnj15yu0qptWGJsO9YGrcPZ3ezX8AWb1VA391MKpQ==

editorconfig@^0.15.0:
version "0.15.2"
resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.2.tgz#047be983abb9ab3c2eefe5199cb2b7c5689f0702"
integrity sha512-GWjSI19PVJAM9IZRGOS+YKI8LN+/sjkSjNyvxL5ucqP9/IqtYNXBaQ/6c/hkPNYQHyOHra2KoXZI/JVpuqwmcQ==
dependencies:
"@types/node" "^10.11.7"
"@types/semver" "^5.5.0"
commander "^2.19.0"
lru-cache "^4.1.3"
semver "^5.6.0"
sigmund "^1.0.1"

lru-cache@^4.1.3:
version "4.1.5"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==
dependencies:
pseudomap "^1.0.2"
yallist "^2.1.2"

pseudomap@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM=

semver@^5.6.0:
version "5.6.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==

sigmund@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590"
integrity sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=

[email protected]:
version "7.2.2"
resolved "https://registry.yarnpkg.com/typescript-formatter/-/typescript-formatter-7.2.2.tgz#a147181839b7bb09c2377b072f20f6336547c00a"
integrity sha512-V7vfI9XArVhriOTYHPzMU2WUnm5IMdu9X/CPxs8mIMGxmTBFpDABlbkBka64PZJ9/xgQeRpK8KzzAG4MPzxBDQ==
dependencies:
commandpost "^1.0.0"
editorconfig "^0.15.0"

typescript@^2.9.2:
version "2.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
integrity sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==

yallist@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=
Loading

0 comments on commit 3f3e3cf

Please sign in to comment.