diff --git a/.browserslistrc b/.browserslistrc
new file mode 100644
index 0000000..dc3bc09
--- /dev/null
+++ b/.browserslistrc
@@ -0,0 +1,4 @@
+> 1%
+last 2 versions
+not dead
+not ie 11
diff --git a/.eslintrc.js b/.eslintrc.js
index 0f28fca..cf84fda 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -2,19 +2,35 @@ const isProduction = process.env.NODE_ENV === 'production'
module.exports = {
root: true,
+ extends: [
+ 'plugin:vue/vue3-recommended'
+ ],
parserOptions: {
- parser: 'babel-eslint',
+ parser: '@babel/eslint-parser',
sourceType: 'module'
},
- extends: ['standard', 'plugin:vue/recommended'],
- plugins: ['vue'],
- overrides: [{
- files: ['**/*.spec.js'],
- plugins: ['jest'],
- env: {
- jest: true
+ overrides: [
+ {
+ files: [
+ '**/*.spec.js'
+ ],
+ plugins: [
+ 'jest'
+ ],
+ env: {
+ jest: true
+ }
+ },
+ {
+ files: [
+ '**/__tests__/*.{j,t}s?(x)',
+ '**/tests/unit/**/*.spec.{j,t}s?(x)'
+ ],
+ env: {
+ jest: true
+ }
}
- }],
+ ],
rules: {
'arrow-parens': 'off',
'generator-star-spacing': 'off',
diff --git a/README.md b/README.md
index 55233a0..bb27b4e 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
[![github license](https://badgen.net/github/license/dafrok/v-hotkey)](https://github.com/dafrok/v-hotkey/blob/master/LICENSE)
[![js standard style](https://badgen.net/badge/code%20style/standard/pink)](https://standardjs.com)
-Vue 2.x directive for binding hotkeys to components.
+Vue 3.x directive for binding hotkeys to components.
## Play with me
@@ -22,10 +22,14 @@ $ yarn add v-hotkey
## Usage
```javascript
-import Vue from 'vue'
+import { createApp } from 'vue'
import VueHotkey from 'v-hotkey'
-Vue.use(VueHotkey)
+const app = createApp({
+ /* ... */
+})
+app.use(VueHotkey)
+
```
```vue
@@ -119,10 +123,13 @@ This ability to provide their own key code alias for developers who using keyboa
### Definition
```javascript
-import Vue from 'vue'
+import { createApp } from 'vue'
import VueHotkey from 'v-hotkey'
-Vue.use(VueHotkey, {
+const app = createApp({
+ /* ... */
+})
+app.use(VueHotkey, {
'①': 49 // the key code of character '1'
})
```
@@ -133,13 +140,15 @@ Vue.use(VueHotkey, {