build: typescript config

This commit is contained in:
Fabio Di Stasio 2022-04-12 17:04:11 +02:00
parent 6cc098c6f0
commit cbef7489b2
4 changed files with 58 additions and 4 deletions

View File

@ -6,15 +6,22 @@
},
"extends": [
"standard",
"plugin:@typescript-eslint/recommended",
"plugin:vue/recommended"
],
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "@babel/eslint-parser",
"parser": "@typescript-eslint/parser",
"ecmaVersion": 9,
"sourceType": "module",
"requireConfigFile": false
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"space-infix-ops": "off",
"object-curly-newline": "off",
"indent": [
"error",
3,
@ -69,6 +76,20 @@
"max": 1
}
}
]
],
"@typescript-eslint/member-delimiter-style": [
"warn",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/no-var-requires": "off"
}
}

View File

@ -134,6 +134,12 @@
"devDependencies": {
"@babel/eslint-parser": "^7.15.7",
"@babel/preset-env": "^7.15.8",
"@babel/preset-typescript": "^7.16.7",
"@types/better-sqlite3": "^7.5.0",
"@types/node": "^17.0.23",
"@types/pg": "^8.6.5",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"all-contributors-cli": "^6.20.0",
"babel-loader": "^8.2.3",
"chalk": "^4.1.2",
@ -163,7 +169,10 @@
"stylelint-config-standard": "^22.0.0",
"stylelint-scss": "^3.21.0",
"tree-kill": "^1.2.2",
"ts-loader": "^9.2.8",
"typescript": "^4.6.3",
"vue": "^2.6.14",
"vue-eslint-parser": "^8.3.0",
"vue-loader": "^15.9.8",
"vue-template-compiler": "^2.6.14",
"webpack": "^5.60.0",

19
tsconfig.json Normal file
View File

@ -0,0 +1,19 @@
{
"include": ["./src/main/**/*", "src/common/interfaces/antares.ts"],
"compilerOptions": {
"baseUrl": "./",
"target": "es2021",
"allowJs": true,
"moduleResolution": "node12",
"noImplicitAny": true,
"types": [
"node"
],
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"removeComments": true,
"paths": {
"common/*": ["./src/common/*"]
}
}
}

View File

@ -13,7 +13,7 @@ module.exports = { // Main
mode: process.env.NODE_ENV,
devtool: isDevMode ? 'eval-source-map' : false,
entry: {
main: path.join(__dirname, './src/main/main.js')
main: path.join(__dirname, './src/main/main.ts')
},
target: 'electron-main',
output: {
@ -28,7 +28,7 @@ module.exports = { // Main
},
externals: externals.filter((d) => !whiteListedModules.includes(d)),
resolve: {
extensions: ['.js', '.json'],
extensions: ['.js', '.json', '.ts'],
alias: {
src: path.join(__dirname, 'src/'),
common: path.resolve(__dirname, 'src/common')
@ -56,6 +56,11 @@ module.exports = { // Main
name: '[path][name].[ext]'
}
},
{
test: /\.ts$/,
exclude: /node_modules/,
loader: 'ts-loader'
},
{
test: /\.js$/,
exclude: /node_modules/,