Builtin conversejs: using typescript.
This commit is contained in:
parent
5575628e99
commit
a74954a0cb
@ -1,23 +1,40 @@
|
||||
{
|
||||
"root": true,
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": [
|
||||
"standard"
|
||||
"root": true,
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": [
|
||||
"standard-with-typescript"
|
||||
],
|
||||
"globals": {},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018,
|
||||
"project": [
|
||||
"./conversejs/tsconfig.json"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"ignorePatterns": [],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-vars": [2, {"argsIgnorePattern": "^_"}],
|
||||
"@typescript-eslint/no-floating-promises": "error",
|
||||
"@typescript-eslint/no-misused-promises": "error",
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
"@typescript-eslint/strict-boolean-expressions": "off",
|
||||
"@typescript-eslint/return-await": [2, "in-try-catch"], // FIXME: correct?
|
||||
"@typescript-eslint/no-invalid-void-type": "off",
|
||||
"@typescript-eslint/triple-slash-reference": "off",
|
||||
"max-len": [
|
||||
"error",
|
||||
{
|
||||
"code": 120,
|
||||
"comments": 120
|
||||
}
|
||||
],
|
||||
"globals": {},
|
||||
"plugins": [],
|
||||
"ignorePatterns": [],
|
||||
"rules": {
|
||||
"max-len": [
|
||||
"error",
|
||||
{
|
||||
"code": 120,
|
||||
"comments": 120
|
||||
}
|
||||
],
|
||||
"no-unused-vars": [2, {"argsIgnorePattern": "^_"}]
|
||||
}
|
||||
"no-unused-vars": "off"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,12 @@
|
||||
function inIframe () {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
interface Window {
|
||||
converse: {
|
||||
initialize: (args: any) => void
|
||||
}
|
||||
initConverse: (args: any) => void
|
||||
}
|
||||
|
||||
function inIframe (): boolean {
|
||||
try {
|
||||
return window.self !== window.top
|
||||
} catch (e) {
|
25
conversejs/tsconfig.json
Normal file
25
conversejs/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "es6",
|
||||
"target": "es5",
|
||||
"allowJs": true,
|
||||
"sourceMap": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"alwaysStrict": true, // should already be true because of strict:true
|
||||
"noImplicitAny": true, // should already be true because of strict:true
|
||||
"noImplicitThis": true, // should already be true because of strict:true
|
||||
"noImplicitReturns": true,
|
||||
"strictBindCallApply": true, // should already be true because of strict:true
|
||||
"noUnusedLocals": true,
|
||||
"outDir": "../dist/client",
|
||||
"paths": {
|
||||
"shared/*": ["../shared/*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"./**/*",
|
||||
"../shared/**/*"
|
||||
],
|
||||
"exclude": []
|
||||
}
|
@ -42,8 +42,16 @@ let config = clientFiles.map(f => ({
|
||||
}))
|
||||
|
||||
config.push({
|
||||
entry: "./conversejs/builtin.js",
|
||||
entry: "./conversejs/builtin.ts",
|
||||
devtool: process.env.NODE_ENV === 'dev' ? 'eval-source-map' : false,
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, "./dist/client/static"),
|
||||
filename: "./builtin.js"
|
||||
|
Loading…
Reference in New Issue
Block a user