Allow typescript files

Change-type: patch
Changelog-entry: Allow typescript files
Signed-off-by: Lorenzo Alberto Maria Ambrosi <lorenzoa@balena.io>
This commit is contained in:
Lorenzo Alberto Maria Ambrosi 2019-07-26 16:58:46 +02:00 committed by Lorenzo Alberto Maria Ambrosi
parent 3a68d84376
commit 8df5d972fc
6 changed files with 995 additions and 212 deletions

View File

@ -14,3 +14,9 @@ trim_trailing_whitespace = false
[Makefile]
indent_style = tab
[*.ts]
indent_style = tab
[*.tsx]
indent_style = tab

View File

@ -150,6 +150,9 @@ sass:
npm rebuild node-sass
node-sass lib/gui/app/scss/main.scss > lib/gui/css/main.css
lint-ts:
resin-lint --typescript lib
lint-js:
eslint --ignore-pattern scripts/resin/**/*.js lib tests scripts bin webpack.config.js
@ -169,9 +172,9 @@ lint-spell:
--skip *.svg *.gz,*.bz2,*.xz,*.zip,*.img,*.dmg,*.iso,*.rpi-sdcard,*.wic,.DS_Store,*.dtb,*.dtbo,*.dat,*.elf,*.bin,*.foo,xz-without-extension \
lib tests docs scripts Makefile *.md LICENSE
lint: lint-js lint-sass lint-cpp lint-html lint-spell
lint: lint-ts lint-js lint-sass lint-cpp lint-html lint-spell
MOCHA_OPTIONS=--recursive --reporter spec
MOCHA_OPTIONS=--recursive --reporter spec --require ts-node/register
# See https://github.com/electron/spectron/issues/127
ETCHER_SPECTRON_ENTRYPOINT ?= $(shell node -e 'console.log(require("electron"))')

1161
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@
},
"scripts": {
"test": "make lint test sanity-checks",
"prettier": "prettier --config ./node_modules/resin-lint/config/.prettierrc --write \"lib/**/*.ts\" \"lib/**/*.tsx\"",
"start": "./node_modules/.bin/electron .",
"postshrinkwrap": "node ./scripts/clean-shrinkwrap.js",
"configure": "node-gyp configure",
@ -111,10 +112,14 @@
"node-sass": "^4.7.2",
"omit-deep-lodash": "1.1.4",
"pkg": "^4.3.0",
"resin-lint": "^3.1.0",
"sass-lint": "^1.12.1",
"simple-progress-webpack-plugin": "^1.1.2",
"spectron": "^5.0.0",
"webpack": "^4.27.0",
"ts-loader": "^6.0.4",
"ts-node": "^8.3.0",
"typescript": "^3.5.3",
"webpack": "^4.31.0",
"webpack-cli": "^3.1.2",
"webpack-node-externals": "^1.7.2"
}

19
tsconfig.json Normal file
View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"resolveJsonModule": true,
"allowJs": true,
"moduleResolution": "node",
"module": "commonjs",
"target": "es2017",
"jsx": "react"
},
"include": [
"lib/**/*.ts",
"node_modules/electron/**/*.d.ts",
"typings/**/*.d.ts"
]
}

View File

@ -51,11 +51,16 @@ const commonConfig = {
use: {
loader: 'html-loader'
}
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: [ '.js', '.jsx', '.json' ]
extensions: [ '.js', '.jsx', '.json', '.ts', '.tsx' ]
},
plugins: [
new SimpleProgressWebpackPlugin({