Skip to content

Commit d392894

Browse files
committed
chore: add eslint rules
1 parent f675a2f commit d392894

File tree

3 files changed

+91
-16
lines changed

3 files changed

+91
-16
lines changed

.eslintrc.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
'plugin:@typescript-eslint/recommended',
1010
'plugin:prettier/recommended',
1111
],
12-
plugins: ['@typescript-eslint'],
12+
plugins: ['simple-import-sort', '@typescript-eslint'],
1313
parserOptions: {
1414
ecmaVersion: 2020,
1515
sourceType: 'module',
@@ -25,6 +25,9 @@ module.exports = {
2525
'@typescript-eslint/ban-ts-comment': 'off',
2626
'@typescript-eslint/explicit-module-boundary-types': 'off',
2727
'@typescript-eslint/ban-types': 'off',
28+
'@typescript-eslint/consistent-type-imports': 'error',
29+
'simple-import-sort/imports': 'error',
30+
'simple-import-sort/exports': 'error',
2831
},
2932
overrides: [
3033
{

package.json

+12-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "vue-request",
33
"version": "1.2.0",
44
"description": "Vue 3 composition API for data fetching, supports SWR, polling, error retry, cache request, pagination and other cool features.",
5-
"license": "MIT",
65
"keywords": [
76
"vue",
87
"vue3",
@@ -15,15 +14,16 @@
1514
"vue-request",
1615
"vue request"
1716
],
17+
"homepage": "https://www.attojs.org",
18+
"bugs": "https://github.com/attojs/vue-request/issues",
1819
"repository": {
1920
"type": "git",
2021
"url": "https://github.com/attojs/vue-request.git"
2122
},
22-
"bugs": "https://github.com/attojs/vue-request/issues",
23-
"homepage": "https://www.attojs.org",
23+
"license": "MIT",
2424
"main": "dist/index.cjs.js",
25-
"module": "dist/index.es.js",
2625
"unpkg": "dist/vue-request.min.js",
26+
"module": "dist/index.es.js",
2727
"types": "dist/types/index.d.ts",
2828
"files": [
2929
"dist/**"
@@ -49,12 +49,9 @@
4949
},
5050
"lint-staged": {
5151
"*.{js,jsx,ts,tsx}": [
52-
"eslint",
53-
"prettier -c"
54-
]
55-
},
56-
"peerDependencies": {
57-
"vue": "^3.0.0"
52+
"eslint --fix"
53+
],
54+
"package.json": "sort-package-json"
5855
},
5956
"devDependencies": {
6057
"@babel/core": "^7.12.3",
@@ -80,6 +77,7 @@
8077
"eslint": "^7.14.0",
8178
"eslint-config-prettier": "^6.15.0",
8279
"eslint-plugin-prettier": "^3.1.4",
80+
"eslint-plugin-simple-import-sort": "^7.0.0",
8381
"eslint-plugin-vue": "^7.0.0-0",
8482
"fetch-mock": "^9.10.7",
8583
"husky": "^4.3.0",
@@ -95,10 +93,14 @@
9593
"rollup-plugin-terser": "^7.0.2",
9694
"rollup-plugin-typescript2": "^0.29.0",
9795
"simple-git": "^2.21.0",
96+
"sort-package-json": "^1.50.0",
9897
"standard-version": "^9.1.1",
9998
"ts-jest": "^26.4.1",
10099
"typescript": "^4.0.5",
101100
"vite": "^2.1.5",
102101
"vue": "^3.0.2"
102+
},
103+
"peerDependencies": {
104+
"vue": "^3.0.0"
103105
}
104106
}

yarn.lock

+75-5
Original file line numberDiff line numberDiff line change
@@ -1424,6 +1424,14 @@
14241424
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
14251425
integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==
14261426

1427+
"@types/glob@^7.1.1":
1428+
version "7.1.3"
1429+
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.3.tgz#e6ba80f36b7daad2c685acd9266382e68985c183"
1430+
integrity sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==
1431+
dependencies:
1432+
"@types/minimatch" "*"
1433+
"@types/node" "*"
1434+
14271435
"@types/graceful-fs@^4.1.2":
14281436
version "4.1.5"
14291437
resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15"
@@ -1475,6 +1483,11 @@
14751483
dependencies:
14761484
"@types/node" "*"
14771485

1486+
"@types/minimatch@*":
1487+
version "3.0.4"
1488+
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.4.tgz#f0ec25dbf2f0e4b18647313ac031134ca5b24b21"
1489+
integrity sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==
1490+
14781491
"@types/minimist@^1.2.0":
14791492
version "1.2.1"
14801493
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.1.tgz#283f669ff76d7b8260df8ab7a4262cc83d988256"
@@ -3022,7 +3035,7 @@ detect-indent@^6.0.0:
30223035
resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.0.0.tgz#0abd0f549f69fc6659a254fe96786186b6f528fd"
30233036
integrity sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA==
30243037

3025-
detect-newline@^3.0.0, detect-newline@^3.1.0:
3038+
detect-newline@3.1.0, detect-newline@^3.0.0, detect-newline@^3.1.0:
30263039
version "3.1.0"
30273040
resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651"
30283041
integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==
@@ -3200,6 +3213,11 @@ eslint-plugin-prettier@^3.1.4:
32003213
dependencies:
32013214
prettier-linter-helpers "^1.0.0"
32023215

3216+
eslint-plugin-simple-import-sort@^7.0.0:
3217+
version "7.0.0"
3218+
resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz#a1dad262f46d2184a90095a60c66fef74727f0f8"
3219+
integrity sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw==
3220+
32033221
eslint-plugin-vue@^7.0.0-0:
32043222
version "7.9.0"
32053223
resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-7.9.0.tgz#f8e83a2a908f4c43fc8304f5401d4ff671f3d560"
@@ -3481,6 +3499,17 @@ fast-diff@^1.1.2:
34813499
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
34823500
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
34833501

3502+
fast-glob@^3.0.3:
3503+
version "3.2.6"
3504+
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.6.tgz#434dd9529845176ea049acc9343e8282765c6e1a"
3505+
integrity sha512-GnLuqj/pvQ7pX8/L4J84nijv6sAnlwvSDpMkJi9i7nPmPxGtRPkBSStfvDW5l6nMdX9VWe+pkKWFTgD+vF2QSQ==
3506+
dependencies:
3507+
"@nodelib/fs.stat" "^2.0.2"
3508+
"@nodelib/fs.walk" "^1.2.3"
3509+
glob-parent "^5.1.2"
3510+
merge2 "^1.3.0"
3511+
micromatch "^4.0.4"
3512+
34843513
fast-glob@^3.1.1:
34853514
version "3.2.5"
34863515
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661"
@@ -3816,6 +3845,11 @@ getpass@^0.1.1:
38163845
dependencies:
38173846
assert-plus "^1.0.0"
38183847

3848+
3849+
version "1.0.3"
3850+
resolved "https://registry.yarnpkg.com/git-hooks-list/-/git-hooks-list-1.0.3.tgz#be5baaf78203ce342f2f844a9d2b03dba1b45156"
3851+
integrity sha512-Y7wLWcrLUXwk2noSka166byGCvhMtDRpgHdzCno1UQv/n/Hegp++a2xBWJL1lJarnKD3SWaljD+0z1ztqxuKyQ==
3852+
38193853
git-raw-commits@^2.0.0, git-raw-commits@^2.0.8:
38203854
version "2.0.10"
38213855
resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.10.tgz#e2255ed9563b1c9c3ea6bd05806410290297bbc1"
@@ -3855,7 +3889,7 @@ github-url-from-git@^1.5.0:
38553889
resolved "https://registry.yarnpkg.com/github-url-from-git/-/github-url-from-git-1.5.0.tgz#f985fedcc0a9aa579dc88d7aff068d55cc6251a0"
38563890
integrity sha1-+YX+3MCpqledyI16/waNVcxiUaA=
38573891

3858-
glob-parent@^5.0.0, glob-parent@^5.1.0:
3892+
glob-parent@^5.0.0, glob-parent@^5.1.0, glob-parent@^5.1.2:
38593893
version "5.1.2"
38603894
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
38613895
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
@@ -3919,6 +3953,20 @@ globals@^13.6.0:
39193953
dependencies:
39203954
type-fest "^0.20.2"
39213955

3956+
3957+
version "10.0.0"
3958+
resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.0.tgz#abfcd0630037ae174a88590132c2f6804e291072"
3959+
integrity sha512-3LifW9M4joGZasyYPz2A1U74zbC/45fvpXUvO/9KbSa+VV0aGZarWkfdgKyR9sExNP0t0x0ss/UMJpNpcaTspw==
3960+
dependencies:
3961+
"@types/glob" "^7.1.1"
3962+
array-union "^2.1.0"
3963+
dir-glob "^3.0.1"
3964+
fast-glob "^3.0.3"
3965+
glob "^7.1.3"
3966+
ignore "^5.1.1"
3967+
merge2 "^1.2.3"
3968+
slash "^3.0.0"
3969+
39223970
globby@^11.0.1:
39233971
version "11.0.3"
39243972
resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.3.tgz#9b1f0cb523e171dd1ad8c7b2a9fb4b644b9593cb"
@@ -4184,7 +4232,7 @@ ignore@^4.0.6:
41844232
resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
41854233
integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==
41864234

4187-
ignore@^5.1.4:
4235+
ignore@^5.1.1, ignore@^5.1.4:
41884236
version "5.1.8"
41894237
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
41904238
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
@@ -4525,6 +4573,11 @@ is-path-inside@^3.0.1, is-path-inside@^3.0.2:
45254573
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283"
45264574
integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
45274575

4576+
4577+
version "2.1.0"
4578+
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287"
4579+
integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==
4580+
45284581
is-plain-obj@^1.1.0:
45294582
version "1.1.0"
45304583
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e"
@@ -5681,7 +5734,7 @@ merge-stream@^2.0.0:
56815734
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
56825735
integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==
56835736

5684-
merge2@^1.3.0:
5737+
merge2@^1.2.3, merge2@^1.3.0:
56855738
version "1.4.1"
56865739
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
56875740
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
@@ -5705,7 +5758,7 @@ micromatch@^3.1.4:
57055758
snapdragon "^0.8.1"
57065759
to-regex "^3.0.2"
57075760

5708-
micromatch@^4.0.2:
5761+
micromatch@^4.0.2, micromatch@^4.0.4:
57095762
version "4.0.4"
57105763
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9"
57115764
integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==
@@ -7284,6 +7337,23 @@ snapdragon@^0.8.1:
72847337
source-map-resolve "^0.5.0"
72857338
use "^3.1.0"
72867339

7340+
sort-object-keys@^1.1.3:
7341+
version "1.1.3"
7342+
resolved "https://registry.yarnpkg.com/sort-object-keys/-/sort-object-keys-1.1.3.tgz#bff833fe85cab147b34742e45863453c1e190b45"
7343+
integrity sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg==
7344+
7345+
sort-package-json@^1.50.0:
7346+
version "1.50.0"
7347+
resolved "https://registry.yarnpkg.com/sort-package-json/-/sort-package-json-1.50.0.tgz#19fc109fe23bd157bd03c8e572fa3251a52467d8"
7348+
integrity sha512-qZpqhMU9XTntebgAgc4hv/D6Fzhh7kFnwvV6a7+q8y8J5JoaDqPYQnvXPf7BBqG95tdE8X6JVNo7/jDzcbdfUg==
7349+
dependencies:
7350+
detect-indent "^6.0.0"
7351+
detect-newline "3.1.0"
7352+
git-hooks-list "1.0.3"
7353+
globby "10.0.0"
7354+
is-plain-obj "2.1.0"
7355+
sort-object-keys "^1.1.3"
7356+
72877357
source-map-resolve@^0.5.0:
72887358
version "0.5.3"
72897359
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a"

0 commit comments

Comments
 (0)