Skip to content

Commit

Permalink
Add tslint, and tenative travis file.
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed May 14, 2018
1 parent aba6a1d commit 6f59a95
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 13 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: go
go:
- 1.9.2
cache: ccache
install:
- go get github.com/ry/v8worker2
- cd `go env GOPATH`/src/github.com/ry/v8worker2 && ./tools/build.py
- make
script:
- make lint
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ clean:
distclean: clean
-rm -rf node_modules/

.PHONY: clean distclean
lint: node_modules
yarn lint
go vet

.PHONY: lint clean distclean
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func loadAsset(w *v8worker2.Worker, path string) {
func main() {
worker := v8worker2.New(recv)
loadAsset(worker, "dist/main.js")

loadMsg := &Msg{
Kind: Msg_LOAD,
Argv: os.Args,
Expand All @@ -63,5 +62,4 @@ func main() {
if err != nil {
panic(err)
}

}
6 changes: 3 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//import * as ts from "typescript";
import { main as pb } from "./msg.pb"
import { main as pb } from "./msg.pb";
import "./util";
import { TextDecoder } from "text-encoding";

Expand All @@ -16,14 +16,14 @@ function readFileSync(filename: string): string {
throw Error(res.error);
}
const decoder = new TextDecoder("utf8");
return decoder.decode(res.data)
return decoder.decode(res.data);
}

function load(argv: string[]): void {
console.log("Load argv", argv);
const inputFn = argv[1];
const source = readFileSync(inputFn);
console.log("source", source)
console.log("source", source);
}

V8Worker2.recv((ab: ArrayBuffer) => {
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"name": "deno",
"scripts": {
"lint": "tslint -p tsconfig.json"
},
"devDependencies": {
"@types/text-encoding": "^0.0.32",
"parcel-bundler": "^1.8.1",
"protobufjs": "^6.8.6",
"text-encoding": "^0.6.4",
"tslint": "^5.10.0",
"typescript": "^2.8.3"
}
}
61 changes: 61 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"rules": {
"array-type": [true, "array-simple"],
"arrow-return-shorthand": true,
"ban": [true,
["fit"],
["fdescribe"],
["xit"],
["xdescribe"],
["fitAsync"],
["xitAsync"],
["fitFakeAsync"],
["xitFakeAsync"]
],
"ban-types": [true,
["Object", "Use {} instead."],
["String", "Use 'string' instead."],
["Number", "Use 'number' instead."],
["Boolean", "Use 'boolean' instead."]
],
"class-name": true,
"curly": true,
"interface-name": [true, "never-prefix"],
"jsdoc-format": true,
"forin": false,
"label-position": true,
"max-line-length": [true, 80],
"new-parens": true,
"no-angle-bracket-type-assertion": true,
"no-any": true,
"no-construct": true,
"no-consecutive-blank-lines": true,
"no-debugger": true,
"no-default-export": true,
"no-inferrable-types": true,
"no-namespace": [true, "allow-declarations"],
"no-reference": true,
"no-require-imports": true,
"no-string-throw": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-var-keyword": true,
"object-literal-shorthand": true,
"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"],
"prefer-const": true,
"quotemark": [true, "double"],
"radix": true,
"restrict-plus-operands": true,
"semicolon": [true, "always", "ignore-bound-class-methods"],
"switch-default": true,
"triple-equals": [true, "allow-null-check"],
"use-isnan": true,
"variable-name": [
true,
"check-format",
"ban-keywords",
"allow-leading-underscore",
"allow-trailing-underscore"
]
}
}
3 changes: 2 additions & 1 deletion util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ const globalEval = eval;
const _global = globalEval("this");

_global["console"] = {
// tslint:disable-next-line:no-any
log(...args: any[]): void {
const out: string[] = [];
for (let a of args) {
for (const a of args) {
if (typeof(a) === "string") {
out.push(a);
} else {
Expand Down
47 changes: 41 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ autoprefixer@^6.3.1:
postcss "^5.2.16"
postcss-value-parser "^3.2.3"

babel-code-frame@^6.26.0:
babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
dependencies:
Expand Down Expand Up @@ -819,6 +819,10 @@ buffer@^4.3.0:
ieee754 "^1.1.4"
isarray "^1.0.0"

builtin-modules@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"

builtin-status-codes@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8"
Expand Down Expand Up @@ -864,7 +868,7 @@ chalk@^1.1.3:
strip-ansi "^3.0.0"
supports-color "^2.0.0"

chalk@^2.1.0, chalk@^2.4.1:
chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e"
dependencies:
Expand Down Expand Up @@ -987,7 +991,7 @@ command-exists@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.6.tgz#577f8e5feb0cb0f159cd557a51a9be1bdd76e09e"

commander@^2.11.0, commander@^2.9.0:
commander@^2.11.0, commander@^2.12.1, commander@^2.9.0:
version "2.15.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f"

Expand Down Expand Up @@ -1284,6 +1288,10 @@ detect-libc@^1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"

diff@^3.2.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"

diffie-hellman@^5.0.0:
version "5.0.3"
resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875"
Expand Down Expand Up @@ -1586,7 +1594,7 @@ glob-parent@^3.1.0:
is-glob "^3.1.0"
path-dirname "^1.0.0"

glob@^7.0.5, glob@^7.1.2:
glob@^7.0.5, glob@^7.1.1, glob@^7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
Expand Down Expand Up @@ -1973,7 +1981,7 @@ js-tokens@^3.0.0, js-tokens@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"

js-yaml@^3.10.0:
js-yaml@^3.10.0, js-yaml@^3.7.0:
version "3.11.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef"
dependencies:
Expand Down Expand Up @@ -3015,7 +3023,7 @@ resolve-url@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"

resolve@^1.1.5, resolve@^1.4.0:
resolve@^1.1.5, resolve@^1.3.2, resolve@^1.4.0:
version "1.7.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3"
dependencies:
Expand Down Expand Up @@ -3455,6 +3463,33 @@ trim-right@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"

tslib@^1.8.0, tslib@^1.8.1:
version "1.9.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"

tslint@^5.10.0:
version "5.10.0"
resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.10.0.tgz#11e26bccb88afa02dd0d9956cae3d4540b5f54c3"
dependencies:
babel-code-frame "^6.22.0"
builtin-modules "^1.1.1"
chalk "^2.3.0"
commander "^2.12.1"
diff "^3.2.0"
glob "^7.1.1"
js-yaml "^3.7.0"
minimatch "^3.0.4"
resolve "^1.3.2"
semver "^5.3.0"
tslib "^1.8.0"
tsutils "^2.12.1"

tsutils@^2.12.1:
version "2.27.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.27.0.tgz#9efb252b188eaa0ca3ade41dc410d6ce7eaab816"
dependencies:
tslib "^1.8.1"

[email protected]:
version "0.0.0"
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
Expand Down

0 comments on commit 6f59a95

Please sign in to comment.