Skip to content

Commit

Permalink
chore: convert parseDuration to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-m-dev committed Sep 13, 2024
1 parent 6c8d41d commit 1d36d80
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = {
},
},
{
files: ['@xen-orchestra/{web-core,lite,web}/**/*.{vue,ts}'],
files: ['@vates/**/*.{ts}', '@xen-orchestra/{web-core,lite,web}/**/*.{vue,ts}'],
parser: 'vue-eslint-parser',
parserOptions: {
sourceType: 'module',
Expand Down Expand Up @@ -79,6 +79,10 @@ module.exports = {
XO_LITE_GIT_HEAD: true,
},
rules: {
// allow "use strict"
strict: 'off',
// allow "require"
'@typescript-eslint/no-var-requires': 'off',
'import/order': [
'error',
{
Expand Down
7 changes: 5 additions & 2 deletions @vates/parse-duration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"ms": "^2.1.2"
},
"scripts": {
"postversion": "npm publish --access public"
}
"postversion": "npm publish --access public",
"build": "tsc",
"dev": "tsc --watch"
},
"main": "dist/index.js"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

const ms = require('ms')

exports.parseDuration = value => {
exports.parseDuration = (value: number | string): number => {
if (typeof value === 'number') {
return value
}
const duration = ms(value)
const duration: number = ms(value)
if (duration === undefined) {
throw new TypeError(`not a valid duration: ${value}`)
}
Expand Down
18 changes: 18 additions & 0 deletions @vates/parse-duration/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"esModuleInterop": true,
"module": "commonjs",
"moduleResolution": "node",
"newLine": "lf",
"noImplicitAny": true,
"strict": false,
"skipLibCheck": true,
"baseUrl": ".",
"sourceMap": false,
"strictNullChecks": true,
"target": "ES2015",
"outDir": "./dist",
"rootDir": "./src"
},
"exclude": ["node_modules", "dist"]
}
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<!--packages-start-->

- @vates/parse-duration minor
- @xen-orchestra/lite minor
- @xen-orchestra/web minor
- @xen-orchestra/web-core minor
Expand Down

0 comments on commit 1d36d80

Please sign in to comment.