Skip to content

Commit

Permalink
Update prettier configuration and organize imports.Formatted code and…
Browse files Browse the repository at this point in the history
… added prettierignore file.
  • Loading branch information
kolirt committed Mar 18, 2024
1 parent 5d0ac04 commit 6d2412b
Show file tree
Hide file tree
Showing 18 changed files with 109 additions and 370 deletions.
9 changes: 3 additions & 6 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@ require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
},
rules: {
'vue/multi-word-component-names': 'off'
},
ignorePatterns: [
'dist/**/*',
'demo/**/*'
]
ignorePatterns: ['dist/**/*', 'demo/**/*']
}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
examples
13 changes: 2 additions & 11 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,9 @@
"singleQuote": true,
"endOfLine": "auto",
"plugins": [
"@trivago/prettier-plugin-sort-imports",
"prettier-plugin-organize-attributes",
"prettier-plugin-tailwindcss"
"prettier-plugin-organize-imports",
"prettier-plugin-organize-attributes"
],
"importOrder": [
"^./App.vue$",
"<THIRD_PARTY_MODULES>",
"^@/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"attributeGroups": [
"^ref",
"^v-if",
Expand Down
8 changes: 4 additions & 4 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}
import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}
12 changes: 12 additions & 0 deletions examples/vite/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"bracketSpacing": true,
"trailingComma": "none",
"tabWidth": 2,
"printWidth": 120,
"semi": false,
"singleQuote": true,
"endOfLine": "auto",
"plugins": [
"prettier-plugin-organize-imports"
]
}
3 changes: 0 additions & 3 deletions examples/vite/.vscode/extensions.json

This file was deleted.

7 changes: 5 additions & 2 deletions examples/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "vite preview"
"preview": "vite preview",
"format": "prettier --write \"**/*.{ts,js,cjs,vue,json}\""
},
"dependencies": {
"@kolirt/vue-modal": "^0.0.16",
Expand All @@ -18,6 +19,8 @@
"@vitejs/plugin-vue": "^4.5.0",
"typescript": "^5.2.2",
"vite": "^5.0.0",
"vue-tsc": "^1.8.22"
"vue-tsc": "^1.8.22",
"prettier": "3.0.3",
"prettier-plugin-organize-imports": "^3.2.4"
}
}
10 changes: 10 additions & 0 deletions examples/vite/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,16 @@ postcss@^8.4.31:
picocolors "^1.0.0"
source-map-js "^1.0.2"

prettier-plugin-organize-imports@^3.2.4:
version "3.2.4"
resolved "https://registry.yarnpkg.com/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.4.tgz#77967f69d335e9c8e6e5d224074609309c62845e"
integrity sha512-6m8WBhIp0dfwu0SkgfOxJqh+HpdyfqSSLfKKRZSFbDuEQXDDndb8fTpRWkUrX/uBenkex3MgnVk0J3b3Y5byog==

[email protected]:
version "3.0.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643"
integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==

rollup@^4.2.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.6.0.tgz#4f966f6dd3f6bafd01b864d68ba078d308b864fa"
Expand Down
11 changes: 2 additions & 9 deletions examples/vue-cli-service/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
"singleQuote": true,
"endOfLine": "auto",
"plugins": [
"@trivago/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss"
],
"importOrder": [
"<THIRD_PARTY_MODULES>",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
"prettier-plugin-organize-imports"
]
}
4 changes: 1 addition & 3 deletions examples/vue-cli-service/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
presets: ['@vue/cli-plugin-babel/preset']
}
11 changes: 2 additions & 9 deletions examples/vue-cli-service/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
"@/*": ["src/*"]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
}
}
5 changes: 2 additions & 3 deletions examples/vue-cli-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"format": "prettier --write src/"
"format": "prettier --write \"**/*.{ts,js,cjs,vue,json}\""
},
"dependencies": {
"@kolirt/vue-modal": "^0.0.16",
Expand All @@ -18,14 +18,13 @@
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"prettier": "3.0.3",
"prettier-plugin-tailwindcss": "^0.5.5"
"prettier-plugin-organize-imports": "^3.2.4"
},
"eslintConfig": {
"root": true,
Expand Down
71 changes: 8 additions & 63 deletions examples/vue-cli-service/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,7 @@
eslint-visitor-keys "^2.1.0"
semver "^6.3.1"

"@babel/[email protected]":
version "7.17.7"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.17.7.tgz#8da2599beb4a86194a3b24df6c085931d9ee45ad"
integrity sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w==
dependencies:
"@babel/types" "^7.17.0"
jsesc "^2.5.1"
source-map "^0.5.0"

"@babel/generator@^7.23.0", "@babel/generator@^7.23.3", "@babel/generator@^7.23.4":
"@babel/generator@^7.23.3", "@babel/generator@^7.23.4":
version "7.23.4"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.4.tgz#4a41377d8566ec18f807f42962a7f3551de83d1c"
integrity sha512-esuS49Cga3HcThFNebGhlgsrVLkvhqvYDTzgjfFFlHJcIfLe5jFmRRfCQ1KuBfc4Jrtn3ndLgKWAKjBE+IraYQ==
Expand Down Expand Up @@ -254,7 +245,7 @@
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz#9478c707febcbbe1ddb38a3d91a2e054ae622d83"
integrity sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==

"@babel/helper-validator-identifier@^7.16.7", "@babel/helper-validator-identifier@^7.22.20":
"@babel/helper-validator-identifier@^7.22.20":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0"
integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==
Expand Down Expand Up @@ -291,7 +282,7 @@
chalk "^2.4.2"
js-tokens "^4.0.0"

"@babel/parser@^7.20.5", "@babel/parser@^7.22.15", "@babel/parser@^7.23.0", "@babel/parser@^7.23.3", "@babel/parser@^7.23.4":
"@babel/parser@^7.22.15", "@babel/parser@^7.23.3", "@babel/parser@^7.23.4":
version "7.23.4"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.4.tgz#409fbe690c333bb70187e2de4021e1e47a026661"
integrity sha512-vf3Xna6UEprW+7t6EtOmFpHNAuxw3xqPZghy+brsnusscJRW5BMUzzHZc5ICjULee81WeUV2jjakG09MDglJXQ==
Expand Down Expand Up @@ -1001,22 +992,6 @@
"@babel/parser" "^7.22.15"
"@babel/types" "^7.22.15"

"@babel/[email protected]":
version "7.23.2"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8"
integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==
dependencies:
"@babel/code-frame" "^7.22.13"
"@babel/generator" "^7.23.0"
"@babel/helper-environment-visitor" "^7.22.20"
"@babel/helper-function-name" "^7.23.0"
"@babel/helper-hoist-variables" "^7.22.5"
"@babel/helper-split-export-declaration" "^7.22.6"
"@babel/parser" "^7.23.0"
"@babel/types" "^7.23.0"
debug "^4.1.0"
globals "^11.1.0"

"@babel/traverse@^7.22.5", "@babel/traverse@^7.23.3", "@babel/traverse@^7.23.4":
version "7.23.4"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.4.tgz#c2790f7edf106d059a0098770fe70801417f3f85"
Expand All @@ -1033,15 +1008,7 @@
debug "^4.1.0"
globals "^11.1.0"

"@babel/[email protected]":
version "7.17.0"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.17.0.tgz#a826e368bccb6b3d84acd76acad5c0d87342390b"
integrity sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==
dependencies:
"@babel/helper-validator-identifier" "^7.16.7"
to-fast-properties "^2.0.0"

"@babel/types@^7.17.0", "@babel/types@^7.22.15", "@babel/types@^7.22.19", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.3", "@babel/types@^7.23.4", "@babel/types@^7.4.4":
"@babel/types@^7.22.15", "@babel/types@^7.22.19", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.3", "@babel/types@^7.23.4", "@babel/types@^7.4.4":
version "7.23.4"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.4.tgz#7206a1810fc512a7f7f7d4dace4cb4c1c9dbfb8e"
integrity sha512-7uIFwVYpoplT5jp/kVv6EF93VaJ8H+Yn5IczYiaAi98ajzjfoZfslet/e0sLh+wVBjb2qqIut1b0S26VSafsSQ==
Expand Down Expand Up @@ -1233,18 +1200,6 @@
resolved "https://registry.yarnpkg.com/@soda/get-current-script/-/get-current-script-1.0.2.tgz#a53515db25d8038374381b73af20bb4f2e508d87"
integrity sha512-T7VNNlYVM1SgQ+VsMYhnDkcGmWhQdL0bDyGm5TlQ3GBXnJscEClUUOKduWTmm2zCnvNLC1hc3JpuXjs/nFOc5w==

"@trivago/prettier-plugin-sort-imports@^4.2.0":
version "4.3.0"
resolved "https://registry.yarnpkg.com/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.3.0.tgz#725f411646b3942193a37041c84e0b2116339789"
integrity sha512-r3n0onD3BTOVUNPhR4lhVK4/pABGpbA7bW3eumZnYdKaHkf1qEC+Mag6DPbGNuuh0eG8AaYj+YqmVHSiGslaTQ==
dependencies:
"@babel/generator" "7.17.7"
"@babel/parser" "^7.20.5"
"@babel/traverse" "7.23.2"
"@babel/types" "7.17.0"
javascript-natural-sort "0.7.1"
lodash "^4.17.21"

"@trysound/[email protected]":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad"
Expand Down Expand Up @@ -3962,11 +3917,6 @@ isobject@^3.0.1:
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==

[email protected]:
version "0.7.1"
resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59"
integrity sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==

javascript-stringify@^2.0.1:
version "2.1.0"
resolved "https://registry.yarnpkg.com/javascript-stringify/-/javascript-stringify-2.1.0.tgz#27c76539be14d8bd128219a2d731b09337904e79"
Expand Down Expand Up @@ -5056,10 +5006,10 @@ prelude-ls@^1.2.1:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==

prettier-plugin-tailwindcss@^0.5.5:
version "0.5.7"
resolved "https://registry.yarnpkg.com/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.5.7.tgz#d05dc42c6f2167e3bf2c20e9f71a1fff4232b5d9"
integrity sha512-4v6uESAgwCni6YF6DwJlRaDjg9Z+al5zM4JfngcazMy4WEf/XkPS5TEQjbD+DZ5iNuG6RrKQLa/HuX2SYzC3kQ==
prettier-plugin-organize-imports@^3.2.4:
version "3.2.4"
resolved "https://registry.yarnpkg.com/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.4.tgz#77967f69d335e9c8e6e5d224074609309c62845e"
integrity sha512-6m8WBhIp0dfwu0SkgfOxJqh+HpdyfqSSLfKKRZSFbDuEQXDDndb8fTpRWkUrX/uBenkex3MgnVk0J3b3Y5byog==

[email protected]:
version "3.0.3"
Expand Down Expand Up @@ -5576,11 +5526,6 @@ source-map-support@~0.5.20:
buffer-from "^1.0.0"
source-map "^0.6.0"

source-map@^0.5.0:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==

source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
Expand Down
10 changes: 2 additions & 8 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import ModalTarget from './components/ModalTarget.vue'

export { closeAllModals, closeModal, confirmModal, openModal } from './actions'
export { useLock } from './composables/useLock'

export { openModal, confirmModal, closeModal, closeAllModals } from './actions'

export { isOpened, modals } from './data'

export { $on, $off } from './event'

export { $off, $on } from './event'
export { createModal } from './plugin'

export { Events } from './types'

export { ModalTarget }
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "@kolirt/vue-modal",
"version": "1.0.0",
"type": "module",
"description": "Simple Vue3 modal package",
"author": "kolirt",
"private": false,
"license": "MIT",
"keywords": [
"vue",
Expand All @@ -23,14 +25,12 @@
"build-demo": "vite build -c vite.demo.config.ts",
"preview-demo": "vite preview -c vite.demo.config.ts",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore --ignore-path .eslintignore",
"format": "prettier --write src/ --write lib/ --write examples/vue-cli-service/src/ --write examples/vite/src/"
"format": "prettier --write \"**/*.{ts,js,cjs,vue,json}\""
},
"pre-commit": [
"lint",
"type-check-lib"
],
"private": false,
"type": "module",
"files": [
"dist"
],
Expand All @@ -42,7 +42,8 @@
"types": "./dist/vue-modal.d.ts",
"import": "./dist/vue-modal.js",
"require": "./dist/vue-modal.umd.cjs"
}
},
"./package.json": "./package.json"
},
"repository": {
"type": "git",
Expand All @@ -63,7 +64,6 @@
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.2.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@tsconfig/node18": "^2.0.1",
"@types/node": "^18.16.8",
"@vitejs/plugin-vue": "^4.2.3",
Expand All @@ -76,7 +76,7 @@
"pre-commit": "^1.2.2",
"prettier": "^3.0.2",
"prettier-plugin-organize-attributes": "^1.0.0",
"prettier-plugin-tailwindcss": "^0.5.3",
"prettier-plugin-organize-imports": "^3.2.4",
"sass": "^1.63.6",
"typescript": "~5.0.4",
"vite": "^4.3.5",
Expand Down
Loading

0 comments on commit 6d2412b

Please sign in to comment.