mirror of
https://github.com/rhysd/Mstdn.git
synced 2024-11-28 20:24:10 +01:00
setup typescript
This commit is contained in:
parent
c8e316dccf
commit
8504fdf901
26
Guardfile
Normal file
26
Guardfile
Normal file
@ -0,0 +1,26 @@
|
||||
ignore /^node_modules/
|
||||
|
||||
def timestamp(file)
|
||||
puts "\033[93m#{Time.now}: #{file}\033[0m"
|
||||
end
|
||||
|
||||
def npm_run(task)
|
||||
cmd = "npm run #{task}"
|
||||
puts cmd
|
||||
success = system cmd
|
||||
puts (
|
||||
if success
|
||||
"\033[92mOK\033[0m\n\n"
|
||||
else
|
||||
"\033[91mFAIL\033[0m\n\n"
|
||||
end
|
||||
)
|
||||
success
|
||||
end
|
||||
|
||||
guard :shell do
|
||||
watch %r[^.+\.ts$] do |m|
|
||||
timestamp m[0]
|
||||
npm_run 'build'
|
||||
end
|
||||
end
|
@ -8,7 +8,13 @@
|
||||
"open-mstdn-app": "./bin/cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"build": "tsc --pretty -p .",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"lint": "tslint --project tsconfig.json --type-check $(git ls-files | grep -E \"\\.ts$\")",
|
||||
"watch": "guard --watchdir main renderer typings",
|
||||
"debug": "NODE_ENV=development electron .",
|
||||
"start": "NODE_ENV=production electron .",
|
||||
"release": "npm run lint && ./scripts/make-release.sh"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -33,6 +39,7 @@
|
||||
"@types/node": "^7.0.12",
|
||||
"electron-packager": "^8.6.0",
|
||||
"npm-run-all": "^4.0.2",
|
||||
"tslint": "^5.1.0",
|
||||
"typescript": "^2.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
|
22
tsconfig.json
Normal file
22
tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"removeComments": true,
|
||||
"preserveConstEnums": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noEmitOnError": true,
|
||||
"strictNullChecks": true,
|
||||
"target": "es2015",
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": [
|
||||
"main/**/*.ts",
|
||||
"renderer/**/*.ts",
|
||||
"typings/**/*.d.ts"
|
||||
]
|
||||
}
|
140
tslint.json
Normal file
140
tslint.json
Normal file
@ -0,0 +1,140 @@
|
||||
{
|
||||
"extends": ["tslint:recommended"],
|
||||
"rules": {
|
||||
"align": [
|
||||
true,
|
||||
"parameters",
|
||||
"statements"
|
||||
],
|
||||
"ban": false,
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
"check-space"
|
||||
],
|
||||
"curly": true,
|
||||
"eofline": true,
|
||||
"forin": false,
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"interface-name": false,
|
||||
"jsdoc-format": true,
|
||||
"label-position": true,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"member-ordering": [
|
||||
true,
|
||||
"public-before-private",
|
||||
"static-before-instance",
|
||||
"variables-before-functions"
|
||||
],
|
||||
"no-any": false,
|
||||
"no-arg": true,
|
||||
"no-bitwise": false,
|
||||
"no-conditional-assignment": true,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-construct": true,
|
||||
"no-debugger": true,
|
||||
"no-duplicate-variable": true,
|
||||
"no-empty": true,
|
||||
"no-eval": true,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": true,
|
||||
"no-require-imports": false,
|
||||
"no-shadowed-variable": true,
|
||||
"no-string-literal": true,
|
||||
"no-switch-case-fall-through": false,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unsafe-finally": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-keyword": true,
|
||||
"no-var-requires": true,
|
||||
"object-literal-sort-keys": false,
|
||||
"object-literal-key-quotes": [
|
||||
true,
|
||||
"as-needed"
|
||||
],
|
||||
"one-line": [
|
||||
true,
|
||||
"check-open-brace",
|
||||
"check-catch",
|
||||
"check-else",
|
||||
"check-whitespace"
|
||||
],
|
||||
"quotemark": [
|
||||
true,
|
||||
"single",
|
||||
"avoid-escape",
|
||||
"jsx-double"
|
||||
],
|
||||
"radix": true,
|
||||
"semicolon": true,
|
||||
"switch-default": true,
|
||||
"trailing-comma": [
|
||||
true,
|
||||
{
|
||||
"multiline": "always",
|
||||
"singleline": "never"
|
||||
}
|
||||
],
|
||||
"triple-equals": [
|
||||
true,
|
||||
"allow-null-check"
|
||||
],
|
||||
"typedef": [
|
||||
false
|
||||
],
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}
|
||||
],
|
||||
"variable-name": [
|
||||
false,
|
||||
"check-format",
|
||||
"allow-leading-underscore",
|
||||
"ban-keywords"
|
||||
],
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type"
|
||||
],
|
||||
"no-namespace": false,
|
||||
"ordered-imports": false,
|
||||
"trailing-comma": true,
|
||||
"arrow-parens": false,
|
||||
"no-unbound-method": true,
|
||||
"arrow-return-shorthand": true,
|
||||
"no-unbound-method": false,
|
||||
"no-boolean-literal-compare": true,
|
||||
"no-unsafe-any": false,
|
||||
"no-unnecessary-qualifier": true,
|
||||
"no-unnecessary-initializer": true,
|
||||
"await-promise": true,
|
||||
"no-floating-promises": false,
|
||||
"strict-type-predicates": true,
|
||||
"no-misused-new": true,
|
||||
"prefer-method-signature": true,
|
||||
"prefer-function-over-method": false
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user