Skip to content

Commit 38b43c5

Browse files
committed
migrate vue.js 3
1 parent be99589 commit 38b43c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+5105
-33678
lines changed

.babelrc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"presets": ["@babel/preset-typescript"],
3+
"plugins": [
4+
[
5+
"module-resolver",
6+
{
7+
"root": ["./"],
8+
"alias": {
9+
"@": "./src",
10+
"@/utils": "./src/utils",
11+
"@/components": "./src/components"
12+
}
13+
}
14+
]
15+
]
16+
}

.eslintrc.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
module.exports = {
2+
root: true,
3+
parser: "vue-eslint-parser", // Specifies the ESLint parser
4+
parserOptions: {
5+
project: "./tsconfig.eslint.json",
6+
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
7+
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
8+
sourceType: "module", // Allows for the use of imports
9+
ecmaFeatures: {
10+
jsx: true, // Allows for the parsing of JSX
11+
},
12+
},
13+
extends: [
14+
"plugin:vue/vue3-essential",
15+
"eslint:recommended",
16+
"@vue/typescript",
17+
"airbnb-typescript-prettier",
18+
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
19+
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
20+
"plugin:prettier/recommended", // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
21+
],
22+
overrides: [
23+
{
24+
files: [
25+
"**/__tests__/*.{j,t}s?(x)",
26+
"**/tests/unit/**/*.spec.{j,t}s?(x)",
27+
],
28+
env: {
29+
jest: true,
30+
},
31+
},
32+
{
33+
files: [
34+
"**/__tests__/*.{j,t}s?(x)",
35+
"**/tests/unit/**/*.spec.{j,t}s?(x)",
36+
],
37+
env: {
38+
jest: true,
39+
},
40+
},
41+
],
42+
rules: {
43+
"import/prefer-default-export": "off",
44+
"import/no-cycle": "off",
45+
"no-multi-assign": "off",
46+
// use typscript version of no-use-before-define
47+
"no-use-before-define": "off",
48+
"@typescript-eslint/no-use-before-define": ["error"],
49+
"@typescript-eslint/ban-types": [
50+
"error",
51+
{
52+
extendDefaults: true,
53+
types: {
54+
"{}": false,
55+
},
56+
},
57+
],
58+
"import/no-extraneous-dependencies": "off",
59+
},
60+
settings: {
61+
"import/parsers": {
62+
"@typescript-eslint/parser": [".ts", ".tsx"],
63+
},
64+
"import/resolver": {
65+
typescript: {},
66+
},
67+
},
68+
plugins: ["import", "jest-dom"],
69+
};

.prettierrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
trailingComma: "es5",
3+
tabWidth: 4,
4+
semi: true,
5+
singleQuote: false,
6+
printWidth: 80,
7+
overrides: [{ files: ["*.json", "*.js"], options: { tabWidth: 2 } }],
8+
arrowParens: "avoid",
9+
};

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,15 @@
11
# vue-toastr
22

33
You can find **React.js** version of this library from [here](https://github.com/s4l1h/react-toasted)
4-
4+
Vue Toastr for vue.js 3.
55
## Project setup
66

77
```
88
yarn install
99
```
1010

11-
### Compiles and hot-reloads for development
12-
13-
```
14-
yarn run demo
15-
```
16-
1711
### Compiles and minifies for production
1812

1913
```
20-
yarn run build
21-
```
22-
23-
### Lints and fixes files
24-
25-
```
26-
yarn run lint
27-
```
28-
29-
### Build and Watch Documentation
30-
31-
```
32-
yarn run docs
33-
```
34-
35-
### Reference and documentation
36-
37-
See [http://s4l1h.github.io/vue-toastr/](http://s4l1h.github.io/vue-toastr/).
38-
39-
### Basic Demo
40-
41-
[https://codepen.io/s4l1h/pen/PyaRGQ](https://codepen.io/s4l1h/pen/PyaRGQ)
42-
43-
### Contribute
44-
45-
You can send your pull requests via the dev branch.
14+
yarn build
15+
```

__tests__/intervalmanager.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import IntervalTimeManager from "@/utils/intervalmanager";
2+
3+
test("test interval manager", async () => {
4+
const beforeStartFN = jest.fn();
5+
const afterFinishFN = jest.fn();
6+
7+
const manager = new IntervalTimeManager({
8+
totalTime: 3000,
9+
stepTime: 50,
10+
callbackFunctions: {
11+
"before:start": beforeStartFN,
12+
"after:finish": afterFinishFN,
13+
},
14+
});
15+
16+
expect(manager.estimated).toBe(0);
17+
expect(manager.id).toBe(0);
18+
expect(manager.remaning).toBe(0);
19+
expect(manager.params.totalTime).toBe(3000);
20+
expect(manager.params.stepTime).toBe(50);
21+
expect(manager.params.callbackFunctions).not.toBeUndefined();
22+
manager.start();
23+
expect(beforeStartFN).toHaveBeenCalledTimes(1);
24+
expect(manager.id).not.toBe(0);
25+
await new Promise(r => setTimeout(r, 1000));
26+
27+
expect(manager.getPercent()).toBeLessThanOrEqual(70);
28+
29+
await new Promise(r => setTimeout(r, 2500));
30+
expect(manager.remaning).toBe(0);
31+
expect(afterFinishFN).toHaveBeenCalledTimes(1);
32+
});

babel.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

bower.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

demo/Demo.vue

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)