├── .commitlintrc.js
├── .eslintrc.cjs
├── .github
└── workflows
│ ├── publish.yml
│ └── release.yml
├── .gitignore
├── .husky
├── .gitignore
├── .lintstagedrc
├── commit-msg
├── common.sh
└── pre-commit
├── .markdownlint.json
├── .pnpmfile.cjs
├── .prettierignore
├── .prettierrc.js
├── LICENSE.md
├── README.md
├── package.json
├── packages
├── commitlint-config
│ ├── CHANGELOG.md
│ ├── build.config.ts
│ ├── package.json
│ └── src
│ │ └── index.ts
├── eslint-config
│ ├── CHANGELOG.md
│ ├── build.config.ts
│ ├── package.json
│ └── src
│ │ └── index.ts
├── prettier-config
│ ├── CHANGELOG.md
│ ├── build.config.ts
│ ├── package.json
│ └── src
│ │ ├── index.ts
│ │ └── prettier-plugin-packagejson.d.ts
└── stylelint-config
│ ├── CHANGELOG.md
│ ├── build.config.ts
│ ├── package.json
│ └── src
│ └── index.ts
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── scripts
├── constant.ts
├── publish.ts
├── release.ts
├── tsconfig.json
└── utils.ts
└── tsconfig.json
/.commitlintrc.js:
--------------------------------------------------------------------------------
1 | /** @type {import('@commitlint/types').UserConfig} */
2 | export default {
3 | extends: ['./packages/commitlint-config']
4 | }
5 |
--------------------------------------------------------------------------------
/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ['./packages/eslint-config'],
3 | overrides: [
4 | {
5 | files: ['scripts/**'],
6 | rules: {
7 | 'no-sequences': 'off',
8 | '@typescript-eslint/no-var-requires': 'off'
9 | }
10 | }
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish Package
2 |
3 | on:
4 | push:
5 | tags:
6 | - "*-config@*"
7 |
8 | jobs:
9 | publish:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: Checkout
13 | uses: actions/checkout@v4
14 | with:
15 | fetch-depth: 0
16 |
17 | - name: Install pnpm
18 | uses: pnpm/action-setup@v4
19 |
20 | - name: Set node
21 | uses: actions/setup-node@v4
22 | with:
23 | node-version: 22.x
24 | registry-url: https://registry.npmjs.org/
25 | cache: pnpm
26 |
27 | - name: Install deps
28 | run: pnpm install
29 |
30 | - name: Build packages
31 | run: pnpm run build
32 |
33 | - name: Publish package
34 | run: pnpm run publish:ci ${{ github.ref_name }}
35 | env:
36 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37 | NODE_OPTIONS: --max-old-space-size=4096
38 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Create Release
2 |
3 | on:
4 | push:
5 | tags:
6 | - "*-config@*"
7 |
8 | jobs:
9 | build:
10 | name: Create Release
11 | runs-on: ubuntu-latest
12 | steps:
13 | - name: Checkout
14 | uses: actions/checkout@v4
15 | with:
16 | fetch-depth: 0
17 |
18 | - name: Get pkgName for tag
19 | id: tag
20 | run: |
21 | pkgName=${GITHUB_REF_NAME%@*}
22 | echo "::set-output name=pkgName::$pkgName"
23 |
24 | - name: Create Release for Tag
25 | id: release_tag
26 | uses: yyx990803/release-tag@master
27 | env:
28 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29 | with:
30 | tag_name: ${{ github.ref }}
31 | body: |
32 | Please refer to [CHANGELOG.md](https://github.com/vexip-ui/lint-config/blob/${{ github.ref_name }}/packages/${{ steps.tag.outputs.pkgName }}/CHANGELOG.md) for details.
33 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | dist
4 | temp
5 |
6 | package-lock.json
7 | yarn.lock
8 |
9 | # local env files
10 | .env.local
11 | .env.*.local
12 |
13 | # Log files
14 | npm-debug.log*
15 | yarn-debug.log*
16 | yarn-error.log*
17 | pnpm-debug.log*
18 |
19 | # Editor directories and files
20 | .idea
21 | .vscode
22 | *.suo
23 | *.ntvs*
24 | *.njsproj
25 | *.sln
26 | *.sw?
27 |
28 | .eslintcache
29 | .stylelintcache
30 |
--------------------------------------------------------------------------------
/.husky/.gitignore:
--------------------------------------------------------------------------------
1 | _
2 |
--------------------------------------------------------------------------------
/.husky/.lintstagedrc:
--------------------------------------------------------------------------------
1 | {
2 | "*.{js,jsx,ts,tsx}": [
3 | "prettier --write",
4 | "eslint --fix"
5 | ],
6 | "{!(package)*.json,*.code-snippets,.!(browserslist|npm)*rc}": [
7 | "prettier --write--parser json"
8 | ],
9 | "package.json": [
10 | "prettier --write"
11 | ],
12 | "*.{css,scss,pcss,html}": [
13 | "prettier --write",
14 | "stylelint --fix"
15 | ],
16 | "*.md": [
17 | "prettier --write"
18 | ],
19 | "*.vue": [
20 | "prettier --write",
21 | "eslint --fix",
22 | "stylelint --fix"
23 | ]
24 | }
25 |
--------------------------------------------------------------------------------
/.husky/commit-msg:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | . "$(dirname "$0")/_/husky.sh"
3 | . "$(dirname "$0")/common.sh"
4 |
5 | npx --no-install commitlint --edit "$1"
6 |
--------------------------------------------------------------------------------
/.husky/common.sh:
--------------------------------------------------------------------------------
1 | command_exists () {
2 | command -v "$1" >/dev/null 2>&1
3 | }
4 |
5 | # Workaround for Windows 10, Git Bash and Yarn
6 | if command_exists winpty && test -t 1; then
7 | exec < /dev/tty
8 | fi
9 |
--------------------------------------------------------------------------------
/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | . "$(dirname "$0")/_/husky.sh"
3 | . "$(dirname "$0")/common.sh"
4 |
5 | [ -n "$CI" ] && exit 0
6 |
7 | pnpm run precommit
8 |
--------------------------------------------------------------------------------
/.markdownlint.json:
--------------------------------------------------------------------------------
1 | {
2 | "MD013": false,
3 | "MD033": false,
4 | "MD041": false
5 | }
6 |
--------------------------------------------------------------------------------
/.pnpmfile.cjs:
--------------------------------------------------------------------------------
1 | function readPackage(pkg) {
2 | if (pkg.dependencies.fsevents && pkg.dependencies.fsevents.match(/[\^~]?1./)) {
3 | pkg.dependencies.fsevents = '^2.3.2'
4 | } else if (pkg.dependencies.chokidar && pkg.dependencies.chokidar.match(/[\^~]?2./)) {
5 | pkg.dependencies.chokidar = '^3.5.3'
6 | } else if (pkg.dependencies.micromatch && pkg.dependencies.micromatch.match(/[\^~]?3./)) {
7 | pkg.dependencies.micromatch = '^4.0.5'
8 | } else if (pkg.dependencies.uuid && pkg.dependencies.uuid.match(/[\^~]?3./)) {
9 | pkg.dependencies.uuid = '^7.0.3'
10 | }
11 |
12 | return pkg
13 | }
14 |
15 | module.exports = {
16 | hooks: {
17 | readPackage
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
3 | public
4 | cache
5 | .husky
6 |
7 | *.svg
8 | *.sh
9 |
10 | CHANGELOG.md
11 |
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | export { default } from './packages/prettier-config/dist/index.mjs'
2 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2022-present vexip-ui
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vexip Lint Config
8 |
9 | ## Usage
10 |
11 | Install:
12 |
13 | ```sh
14 | # commitlint
15 | pnpm add -D @commitlint/cli @vexip-ui/commitlint-config
16 |
17 | # eslint
18 | pnpm add -D eslint @vexip-ui/eslint-config
19 |
20 | # prettier
21 | pnpm add -D prettier @vexip-ui/prettier-config
22 |
23 | # stylelint
24 | pnpm add -D stylelint @vexip-ui/stylelint-config
25 | ```
26 |
27 | Then in your `xxxlintrc.cjs`:
28 |
29 | ```js
30 | module.exports = {
31 | extends: ['@vexip-ui/xxxlint-config']
32 | }
33 | ```
34 |
35 | Or in your `xxxlintrc.mjs`:
36 |
37 | ```js
38 | export default {
39 | extends: ['@vexip-ui/xxxlint-config']
40 | }
41 | ```
42 |
43 | For `prettierrc.cjs` just a little defferent:
44 |
45 | ```js
46 | module.exports = require('@vexip-ui/prettier-config')
47 | ```
48 |
49 | ```js
50 | export { default } from '@vexip-ui/prettier-config'
51 | ```
52 |
53 | ## License
54 |
55 | [MIT License](./LICENSE.md)
56 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "lint-config",
3 | "type": "module",
4 | "packageManager": "pnpm@10.11.0",
5 | "license": "MIT",
6 | "private": true,
7 | "author": "qmhc",
8 | "scripts": {
9 | "build": "pnpm -r run build",
10 | "lint": "eslint --fix .",
11 | "prettier": "prettier --write \"**/*.{js,cjs,ts,json,md}\"",
12 | "release": "tsx scripts/release.ts",
13 | "publish:ci": "tsx scripts/publish.ts"
14 | },
15 | "devDependencies": {
16 | "@commitlint/cli": "^18.5.0",
17 | "@commitlint/types": "^19.0.3",
18 | "@types/minimist": "^1.2.5",
19 | "@types/node": "^20.11.6",
20 | "@types/prompts": "^2.4.9",
21 | "@types/semver": "^7.5.6",
22 | "@vexip-ui/scripts": "^1.1.4",
23 | "conventional-changelog-cli": "^4.1.0",
24 | "eslint": "^8.56.0",
25 | "husky": "^9.0.1",
26 | "is-ci": "^3.0.1",
27 | "lint-staged": "^15.2.0",
28 | "minimist": "^1.2.8",
29 | "prettier": "^3.2.4",
30 | "prompts": "^2.4.2",
31 | "semver": "^7.5.4",
32 | "tsx": "^4.7.0",
33 | "typescript": "^5.4.5",
34 | "unbuild": "^2.0.0"
35 | },
36 | "pnpm": {
37 | "peerDependencyRules": {
38 | "allowAny": [
39 | "stylelint",
40 | "@csstools/*"
41 | ]
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/packages/commitlint-config/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # [0.5.0](https://github.com/vexip-ui/lint-config/compare/commitlint-config@0.4.0...commitlint-config@0.5.0) (2024-04-13)
2 |
3 |
4 |
5 | # [0.4.0](https://github.com/vexip-ui/lint-config/compare/commitlint-config@0.3.0...commitlint-config@0.4.0) (2024-01-25)
6 |
7 |
8 |
9 | # [0.3.0](https://github.com/vexip-ui/lint-config/compare/commitlint-config@0.2.0...commitlint-config@0.3.0) (2023-10-25)
10 |
11 |
12 | ### Features
13 |
14 | * **eslint-config:** support jsx syntax ([155695c](https://github.com/vexip-ui/lint-config/commit/155695c29c7bd5b6328eb2df831ec42ae413bfb8))
15 |
16 |
17 |
18 | # [0.2.0](https://github.com/vexip-ui/lint-config/compare/commitlint-config@0.1.0...commitlint-config@0.2.0) (2023-07-11)
19 |
20 | # 0.1.0 (2022-09-27)
21 |
--------------------------------------------------------------------------------
/packages/commitlint-config/build.config.ts:
--------------------------------------------------------------------------------
1 | import { defineBuildConfig } from 'unbuild'
2 |
3 | export default defineBuildConfig({
4 | entries: ['src/index'],
5 | clean: true,
6 | declaration: true,
7 | rollup: {
8 | emitCJS: true
9 | }
10 | })
11 |
--------------------------------------------------------------------------------
/packages/commitlint-config/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@vexip-ui/commitlint-config",
3 | "version": "0.5.0",
4 | "type": "module",
5 | "license": "MIT",
6 | "author": "qmhc",
7 | "scripts": {
8 | "build": "unbuild"
9 | },
10 | "main": "dist/index.cjs",
11 | "module": "dist/index.mjs",
12 | "types": "dist/index.d.ts",
13 | "exports": {
14 | ".": {
15 | "types": "./dist/index.d.ts",
16 | "require": "./dist/index.cjs",
17 | "import": "./dist/index.mjs"
18 | },
19 | "./package.json": "./package.json"
20 | },
21 | "keywords": [
22 | "vexip-ui",
23 | "commitlint",
24 | "commitlint-config"
25 | ],
26 | "homepage": "https://github.com/vexip-ui/lint-config",
27 | "dependencies": {
28 | "@commitlint/config-conventional": "^19.1.0"
29 | },
30 | "peerDependencies": {
31 | "@commitlint/cli": "*"
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/packages/commitlint-config/src/index.ts:
--------------------------------------------------------------------------------
1 | import type { UserConfig } from '@commitlint/types'
2 |
3 | export default {
4 | extends: ['@commitlint/config-conventional'],
5 | rules: {
6 | 'body-leading-blank': [2, 'always'],
7 | 'footer-leading-blank': [1, 'always'],
8 | 'header-max-length': [2, 'always', 108],
9 | 'subject-empty': [2, 'never'],
10 | 'type-empty': [2, 'never'],
11 | 'type-enum': [
12 | 2,
13 | 'always',
14 | [
15 | 'feat',
16 | 'fix',
17 | 'perf',
18 | 'style',
19 | 'docs',
20 | 'test',
21 | 'refactor',
22 | 'build',
23 | 'ci',
24 | 'chore',
25 | 'revert',
26 | 'wip',
27 | 'workflow',
28 | 'types',
29 | 'release'
30 | ]
31 | ]
32 | }
33 | } satisfies UserConfig
34 |
--------------------------------------------------------------------------------
/packages/eslint-config/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [0.12.1](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.12.0...eslint-config@0.12.1) (2024-04-08)
2 |
3 |
4 | ### Bug Fixes
5 |
6 | * **eslint-config:** manually set standard rules ([44b6ce8](https://github.com/vexip-ui/lint-config/commit/44b6ce8dae37bd23c221bb237a8f6fbff57f6ad4))
7 |
8 |
9 |
10 | # [0.12.0](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.11.0...eslint-config@0.12.0) (2024-01-25)
11 |
12 |
13 |
14 | # [0.11.0](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.10.0...eslint-config@0.11.0) (2023-12-07)
15 |
16 |
17 |
18 | # [0.10.0](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.9.0...eslint-config@0.10.0) (2023-12-04)
19 |
20 |
21 | ### Bug Fixes
22 |
23 | * **eslint-config:** off react/jsx-key rule ([c29c3db](https://github.com/vexip-ui/lint-config/commit/c29c3db8ca757584cd907f9395ce5a5957217c7a))
24 |
25 |
26 |
27 | # [0.9.0](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.8.1...eslint-config@0.9.0) (2023-10-25)
28 |
29 |
30 |
31 | ## [0.8.1](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.8.0...eslint-config@0.8.1) (2023-07-11)
32 |
33 |
34 | ### Bug Fixes
35 |
36 | * **eslint-config:** specify plugins option to resolve plugins ([476a2a9](https://github.com/vexip-ui/lint-config/commit/476a2a9a86dbb7fb724b6253244d42f3b278773b))
37 |
38 |
39 |
40 | # [0.8.0](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.7.4...eslint-config@0.8.0) (2023-07-11)
41 |
42 |
43 | ### Features
44 |
45 | * **eslint-config:** support jsx syntax ([155695c](https://github.com/vexip-ui/lint-config/commit/155695c29c7bd5b6328eb2df831ec42ae413bfb8))
46 |
47 |
48 |
49 | ## [0.7.4](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.7.3...eslint-config@0.7.4) (2023-07-11)
50 |
51 | ## [0.7.3](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.7.2...eslint-config@0.7.3) (2023-07-11)
52 |
53 | ## [0.7.2](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.7.1...eslint-config@0.7.2) (2023-07-11)
54 |
55 | ### Bug Fixes
56 |
57 | - **eslint-config:** off @typescript-eslint/no-unused-vars ([61756e9](https://github.com/vexip-ui/lint-config/commit/61756e9776abf6980fa00ff2cf3e818bd9858381))
58 |
59 | ## [0.7.1](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.7.0...eslint-config@0.7.1) (2023-07-11)
60 |
61 | ### Bug Fixes
62 |
63 | - **eslint-config:** off @typescript-eslint/no-unused-vars ([89c8cc8](https://github.com/vexip-ui/lint-config/commit/89c8cc863d39dd0b899690a92d4dc6a822b41eea))
64 |
65 | # [0.7.0](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.6.3...eslint-config@0.7.0) (2023-07-11)
66 |
67 | ## [0.6.3](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.6.2...eslint-config@0.6.3) (2023-05-16)
68 |
69 | ### Bug Fixes
70 |
71 | - **eslint-config:** should both node:_ and node:\*\*/_ patterns ([ed5231e](https://github.com/vexip-ui/lint-config/commit/ed5231ee971f154fcaf92da862344bd16e6d5b1d))
72 |
73 | ## [0.6.2](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.6.1...eslint-config@0.6.2) (2023-05-16)
74 |
75 | ### Bug Fixes
76 |
77 | - **eslint-config:** import pattern node:\*_/_ ([c0a59f2](https://github.com/vexip-ui/lint-config/commit/c0a59f2716357a983077b8de06576b4bbe381ff5))
78 |
79 | ## [0.6.1](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.6.0...eslint-config@0.6.1) (2023-05-16)
80 |
81 | ### Bug Fixes
82 |
83 | - **eslint-config:** unexpected change improts order of side effects ([b3d266d](https://github.com/vexip-ui/lint-config/commit/b3d266d510634a4557efc27cdfbda49e38b41b9d))
84 |
85 | # [0.6.0](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.5.2...eslint-config@0.6.0) (2023-05-16)
86 |
87 | ### Features
88 |
89 | - **eslint-config:** add import/no-mutable-exports rule ([bdaa482](https://github.com/vexip-ui/lint-config/commit/bdaa4824bfcd0548d8f5617dbbda0392bd7daf6c))
90 | - **eslint-config:** add rules for sorting imports ([f445a86](https://github.com/vexip-ui/lint-config/commit/f445a868d4d530947a488a96b1274e66ab9a2104))
91 |
92 | ## [0.5.2](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.5.1...eslint-config@0.5.2) (2023-02-24)
93 |
94 | ## [0.5.1](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.5.0...eslint-config@0.5.1) (2022-11-14)
95 |
96 | ### Bug Fixes
97 |
98 | - **eslint-config:** override ts rules for vue files ([80cf7ac](https://github.com/vexip-ui/lint-config/commit/80cf7ac3bea48eecfa57b0cb1b99d94bf2cac8c7))
99 |
100 | # [0.5.0](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.4.7...eslint-config@0.5.0) (2022-11-03)
101 |
102 | ### Features
103 |
104 | - **eslint-config:** update extends ([6f0f0a6](https://github.com/vexip-ui/lint-config/commit/6f0f0a6768b7e4cdb46369e17ae9fbeae2d141c0))
105 |
106 | ## [0.4.7](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.4.6...eslint-config@0.4.7) (2022-11-03)
107 |
108 | ### Bug Fixes
109 |
110 | - **eslint-config:** extract parserOptions ([5fa1d7a](https://github.com/vexip-ui/lint-config/commit/5fa1d7a97d0ff5cb5d7b064a0d50e1c6e682b75a))
111 |
112 | ## [0.4.6](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.4.5...eslint-config@0.4.6) (2022-11-03)
113 |
114 | ### Bug Fixes
115 |
116 | - **eslint-config:** close standard no-use-before-define ([55053b7](https://github.com/vexip-ui/lint-config/commit/55053b7afc5b94629bb7f84d5d9c5ed1fe9363d0))
117 | - **eslint-config:** improve @typescript-eslint/indent ([73a43db](https://github.com/vexip-ui/lint-config/commit/73a43db1f55b074f25413c6c3990cb5803f1e5d9))
118 | - **eslint-config:** improve @typescript-eslint/no-unused-vars ([b2e390e](https://github.com/vexip-ui/lint-config/commit/b2e390e17e0b636362f957a43d3435ed87ab9158))
119 |
120 | ## [0.4.5](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.4.4...eslint-config@0.4.5) (2022-11-03)
121 |
122 | ### Bug Fixes
123 |
124 | - **eslint-config:** remove unnecessary settings ([2b2054a](https://github.com/vexip-ui/lint-config/commit/2b2054adbe7a518c5e760f9de20902124ad72006))
125 |
126 | ## [0.4.4](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.4.3...eslint-config@0.4.4) (2022-11-03)
127 |
128 | ### Bug Fixes
129 |
130 | - **eslint-config:** add typescript lint dependencies ([8a53fa9](https://github.com/vexip-ui/lint-config/commit/8a53fa9440286573f8194d95e985b42bbd619783))
131 |
132 | ## [0.4.3](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.4.2...eslint-config@0.4.3) (2022-11-03)
133 |
134 | ### Bug Fixes
135 |
136 | - **eslint-config:** remove rules which are related tsconfig.json ([07e0435](https://github.com/vexip-ui/lint-config/commit/07e043590738912f3fb6785865e7720c53d742e7))
137 |
138 | ## [0.4.2](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.4.1...eslint-config@0.4.2) (2022-11-03)
139 |
140 | ### Bug Fixes
141 |
142 | - manually override typescript rules ([7d11d13](https://github.com/vexip-ui/lint-config/commit/7d11d13c64207b6343e4693cebc9a79ab537b0c9))
143 |
144 | ## [0.4.1](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.4.0...eslint-config@0.4.1) (2022-11-03)
145 |
146 | ### Bug Fixes
147 |
148 | - **eslint-config:** missing parserOptions.project ([37cdee8](https://github.com/vexip-ui/lint-config/commit/37cdee8a75a8b33f20546b8b3c2ccfd2d0544826))
149 |
150 | # [0.4.0](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.3.1...eslint-config@0.4.0) (2022-11-03)
151 |
152 | ### Features
153 |
154 | - **eslint-config:** switch to standard-with-typescript ([989cd93](https://github.com/vexip-ui/lint-config/commit/989cd93a92ac132999ccc48143e7d29242c8ea41))
155 |
156 | ## [0.3.1](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.3.0...eslint-config@0.3.1) (2022-10-13)
157 |
158 | ### Bug Fixes
159 |
160 | - **eslint-config:** support auto import ([8f4fa86](https://github.com/vexip-ui/lint-config/commit/8f4fa86b36af39a22d291125f0af49ed2cd76181))
161 |
162 | # [0.3.0](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.2.0...eslint-config@0.3.0) (2022-10-11)
163 |
164 | ### Features
165 |
166 | - **eslint-config:** off @typescript-eslint/no-unused-vars for dts ([3335258](https://github.com/vexip-ui/lint-config/commit/3335258856d41cabe335973f6f11b545faf1b500))
167 |
168 | # [0.2.0](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.1.1...eslint-config@0.2.0) (2022-10-06)
169 |
170 | ### Features
171 |
172 | - **eslint-config:** off ts/ban-ts-comment rule ([94caf2e](https://github.com/vexip-ui/lint-config/commit/94caf2e51689ea926642fd2f38da39b0a20ee995))
173 |
174 | ## [0.1.1](https://github.com/vexip-ui/lint-config/compare/eslint-config@0.1.0...eslint-config@0.1.1) (2022-09-28)
175 |
176 | ### Bug Fixes
177 |
178 | - **eslint:** using ts rules override then same js rules ([006fd3e](https://github.com/vexip-ui/lint-config/commit/006fd3e7a249caeac23baa7534c4adbfebeefd25))
179 |
180 | # 0.1.0 (2022-09-27)
181 |
--------------------------------------------------------------------------------
/packages/eslint-config/build.config.ts:
--------------------------------------------------------------------------------
1 | import { defineBuildConfig } from 'unbuild'
2 |
3 | export default defineBuildConfig({
4 | entries: ['src/index'],
5 | clean: true,
6 | declaration: true,
7 | rollup: {
8 | emitCJS: true
9 | }
10 | })
11 |
--------------------------------------------------------------------------------
/packages/eslint-config/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@vexip-ui/eslint-config",
3 | "version": "0.12.1",
4 | "type": "module",
5 | "license": "MIT",
6 | "author": "qmhc",
7 | "scripts": {
8 | "build": "unbuild"
9 | },
10 | "main": "dist/index.cjs",
11 | "module": "dist/index.mjs",
12 | "types": "dist/index.d.ts",
13 | "exports": {
14 | ".": {
15 | "types": "./dist/index.d.ts",
16 | "require": "./dist/index.cjs",
17 | "import": "./dist/index.mjs"
18 | },
19 | "./package.json": "./package.json"
20 | },
21 | "keywords": [
22 | "vexip-ui",
23 | "eslint",
24 | "eslint-config"
25 | ],
26 | "homepage": "https://github.com/vexip-ui/lint-config",
27 | "dependencies": {
28 | "@typescript-eslint/eslint-plugin": "^6.19.1",
29 | "@typescript-eslint/parser": "^6.19.1",
30 | "@vue/eslint-config-typescript": "^12.0.0",
31 | "eslint-config-standard": "^17.1.0",
32 | "eslint-config-standard-jsx": "^11.0.0",
33 | "eslint-define-config": "^2.1.0",
34 | "eslint-plugin-import": "^2.29.1",
35 | "eslint-plugin-jsonc": "^2.13.0",
36 | "eslint-plugin-markdown": "^3.0.1",
37 | "eslint-plugin-n": "^16.6.2",
38 | "eslint-plugin-node": "^11.1.0",
39 | "eslint-plugin-promise": "^6.1.1",
40 | "eslint-plugin-react": "^7.33.2",
41 | "eslint-plugin-vue": "^9.20.1",
42 | "eslint-plugin-yml": "^1.12.2",
43 | "jsonc-eslint-parser": "^2.4.0",
44 | "vue-eslint-parser": "^9.4.2",
45 | "yaml-eslint-parser": "^1.2.2"
46 | },
47 | "peerDependencies": {
48 | "eslint": ">=8"
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/packages/eslint-config/src/index.ts:
--------------------------------------------------------------------------------
1 | import configStandard from 'eslint-config-standard/.eslintrc.json'
2 | import { defineConfig } from 'eslint-define-config'
3 |
4 | import type { Rules } from 'eslint-define-config'
5 |
6 | type StandardRuleName = keyof typeof configStandard.rules
7 |
8 | const equivalents = [
9 | 'indent',
10 | 'no-unused-vars',
11 | 'no-redeclare',
12 | 'no-use-before-define',
13 | 'brace-style',
14 | 'comma-dangle',
15 | 'object-curly-spacing',
16 | 'semi',
17 | 'quotes',
18 | 'space-before-blocks',
19 | 'space-before-function-paren',
20 | 'space-infix-ops',
21 | 'keyword-spacing',
22 | 'comma-spacing',
23 | 'no-extra-parens',
24 | 'no-dupe-class-members',
25 | 'no-loss-of-precision',
26 | 'lines-between-class-members',
27 | 'func-call-spacing',
28 | 'no-array-constructor',
29 | 'no-unused-expressions',
30 | 'no-useless-constructor'
31 | ] as const
32 |
33 | function fromEntries(iterable: [K, V][]) {
34 | return [...iterable].reduce(
35 | (obj, [key, val]) => {
36 | obj[key] = val
37 | return obj
38 | },
39 | {} as Record
40 | )
41 | }
42 |
43 | function ruleFromStandard(name: StandardRuleName) {
44 | const rule = configStandard.rules[name]
45 |
46 | return rule || 'off'
47 | }
48 |
49 | const typeScriptRules = {
50 | 'no-console':
51 | process.env.NODE_ENV === 'production'
52 | ? [
53 | 'error',
54 | {
55 | allow: ['warn', 'error']
56 | }
57 | ]
58 | : 'off',
59 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
60 | 'no-return-assign': 'off',
61 |
62 | 'import/no-mutable-exports': 'error',
63 | 'import/order': [
64 | 'error',
65 | {
66 | groups: [
67 | 'unknown',
68 | ['builtin', 'external', 'internal', 'parent', 'index', 'sibling', 'object'],
69 | 'type'
70 | ],
71 | pathGroups: [
72 | {
73 | pattern: '**/*.{css,scss,sass,less,styl,stylus,json,xml}',
74 | group: 'unknown',
75 | position: 'before'
76 | },
77 | {
78 | pattern: '{node:*,node:**/*}',
79 | group: 'builtin',
80 | position: 'before'
81 | },
82 | {
83 | pattern: '{vitest,vue,vue-router,pinia,vuex,vue-i18n,axios,@vue/*}',
84 | group: 'external',
85 | position: 'before'
86 | }
87 | ],
88 | pathGroupsExcludedImportTypes: ['unknown', 'type'],
89 | 'newlines-between': 'always-and-inside-groups',
90 | warnOnUnassignedImports: false
91 | }
92 | ],
93 | 'sort-imports': [
94 | 'error',
95 | {
96 | ignoreCase: false,
97 | ignoreDeclarationSort: true,
98 | ignoreMemberSort: false,
99 | memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
100 | allowSeparatedGroups: false
101 | }
102 | ],
103 |
104 | ...fromEntries(equivalents.map(name => [name, 'off'])),
105 | ...fromEntries(equivalents.map(name => [`@typescript-eslint/${name}`, ruleFromStandard(name)])),
106 |
107 | '@typescript-eslint/indent': [
108 | 'error',
109 | 2,
110 | {
111 | SwitchCase: 1,
112 | VariableDeclarator: 1,
113 | outerIIFEBody: 1,
114 | MemberExpression: 1,
115 | FunctionDeclaration: { parameters: 1, body: 1 },
116 | FunctionExpression: { parameters: 1, body: 1 },
117 | CallExpression: { arguments: 1 },
118 | ArrayExpression: 1,
119 | ObjectExpression: 1,
120 | ImportDeclaration: 1,
121 | flatTernaryExpressions: false,
122 | ignoreComments: false,
123 | ignoredNodes: [
124 | 'TemplateLiteral *',
125 | 'JSXElement',
126 | 'JSXElement > *',
127 | 'JSXAttribute',
128 | 'JSXIdentifier',
129 | 'JSXNamespacedName',
130 | 'JSXMemberExpression',
131 | 'JSXSpreadAttribute',
132 | 'JSXExpressionContainer',
133 | 'JSXOpeningElement',
134 | 'JSXClosingElement',
135 | 'JSXFragment',
136 | 'JSXOpeningFragment',
137 | 'JSXClosingFragment',
138 | 'JSXText',
139 | 'JSXEmptyExpression',
140 | 'JSXSpreadChild',
141 | 'TSTypeParameterInstantiation',
142 | 'FunctionExpression > .params[decorators.length > 0]',
143 | 'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',
144 | 'ClassBody.body > PropertyDefinition[decorators.length > 0] > .key'
145 | ],
146 | offsetTernaryExpressions: true
147 | }
148 | ],
149 | '@typescript-eslint/no-explicit-any': 'off',
150 | '@typescript-eslint/strict-boolean-expressions': 'off',
151 | '@typescript-eslint/space-before-function-paren': [
152 | 'error',
153 | {
154 | anonymous: 'always',
155 | named: 'never',
156 | asyncArrow: 'always'
157 | }
158 | ],
159 | '@typescript-eslint/no-use-before-define': [
160 | 'error',
161 | {
162 | functions: false,
163 | classes: false,
164 | variables: true,
165 | enums: false,
166 | typedefs: false
167 | }
168 | ],
169 | '@typescript-eslint/member-delimiter-style': [
170 | 'error',
171 | {
172 | multiline: {
173 | delimiter: 'comma',
174 | requireLast: false
175 | },
176 | singleline: {
177 | delimiter: 'comma',
178 | requireLast: false
179 | }
180 | }
181 | ],
182 | '@typescript-eslint/no-inferrable-types': 'error',
183 | '@typescript-eslint/no-this-alias': [
184 | 'error',
185 | {
186 | allowDestructuring: true
187 | }
188 | ],
189 | '@typescript-eslint/no-unnecessary-condition': 'off',
190 | '@typescript-eslint/explicit-module-boundary-types': 'off',
191 | '@typescript-eslint/explicit-function-return-type': 'off',
192 | '@typescript-eslint/no-non-null-assertion': 'off',
193 | '@typescript-eslint/consistent-type-assertions': 'off',
194 | '@typescript-eslint/consistent-type-imports': [
195 | 'error',
196 | {
197 | prefer: 'type-imports',
198 | disallowTypeAnnotations: false
199 | }
200 | ],
201 | '@typescript-eslint/ban-ts-comment': 'off',
202 | '@typescript-eslint/array-type': 'off',
203 | '@typescript-eslint/no-unused-vars': [
204 | 'warn',
205 | {
206 | args: 'after-used',
207 | argsIgnorePattern: '^_',
208 | caughtErrors: 'none',
209 | ignoreRestSiblings: true
210 | }
211 | ]
212 | } as Partial
213 |
214 | export default defineConfig({
215 | extends: [
216 | 'standard-jsx',
217 | 'plugin:jsonc/recommended-with-jsonc',
218 | 'plugin:yml/standard',
219 | 'plugin:markdown/recommended',
220 | 'plugin:vue/vue3-recommended',
221 | '@vue/eslint-config-typescript/recommended'
222 | ],
223 | env: {
224 | es6: true,
225 | browser: true,
226 | node: true
227 | },
228 | parser: 'vue-eslint-parser',
229 | parserOptions: {
230 | ecmaVersion: 'latest'
231 | },
232 | plugins: ['import', 'n', 'promise', 'react'],
233 | reportUnusedDisableDirectives: true,
234 | settings: {
235 | 'import/resolver': {
236 | node: {
237 | extensions: ['.mts', '.ts', '.tsx', '.mjs', '.js', '.jsx', '.json', '.node']
238 | }
239 | }
240 | },
241 | rules: {
242 | ...typeScriptRules,
243 |
244 | 'vue/eqeqeq': 'error',
245 | 'vue/object-curly-spacing': ['error', 'always'],
246 | 'vue/require-direct-export': 'error',
247 | 'vue/no-parsing-error': [
248 | 'error',
249 | {
250 | 'x-invalid-end-tag': false
251 | }
252 | ],
253 | 'vue/max-attributes-per-line': [
254 | 'warn',
255 | {
256 | singleline: 3,
257 | multiline: 1
258 | }
259 | ],
260 | 'vue/match-component-file-name': [
261 | 'error',
262 | {
263 | extensions: ['vue'],
264 | shouldMatchCase: false
265 | }
266 | ],
267 | 'vue/space-infix-ops': [
268 | 'error',
269 | {
270 | int32Hint: false
271 | }
272 | ],
273 | 'vue/html-self-closing': [
274 | 'error',
275 | {
276 | html: {
277 | void: 'always',
278 | normal: 'never',
279 | component: 'never'
280 | },
281 | svg: 'always',
282 | math: 'always'
283 | }
284 | ],
285 | 'vue/no-reserved-component-names': 'off',
286 | 'vue/comment-directive': 'off',
287 | 'vue/multi-word-component-names': 'off',
288 | 'vue/no-setup-props-destructure': 'off',
289 | 'vue/require-default-prop': 'off',
290 | 'vue/padding-line-between-blocks': ['error', 'always']
291 | },
292 | overrides: [
293 | {
294 | files: ['*.vue'],
295 | rules: {
296 | // Need override for vue files, otherwise typescript rules will not effective
297 | ...typeScriptRules,
298 | 'no-unused-vars': 'off',
299 | 'no-undef': 'off',
300 | '@typescript-eslint/no-unused-vars': 'off',
301 | '@typescript-eslint/consistent-type-imports': 'off'
302 | }
303 | },
304 | {
305 | files: ['*.jsx', '*.tsx', '*.vue'],
306 | rules: {
307 | 'no-sequences': 'off',
308 | 'react/self-closing-comp': 'off',
309 | 'react/jsx-key': 'off',
310 | 'react/jsx-curly-brace-presence': [
311 | 'error',
312 | {
313 | props: 'always',
314 | children: 'always',
315 | propElementValues: 'always'
316 | }
317 | ],
318 | 'react/jsx-pascal-case': [
319 | 'error',
320 | {
321 | allowAllCaps: true
322 | }
323 | ],
324 | 'react/jsx-closing-tag-location': 'off',
325 | 'react/no-children-prop': 'off'
326 | }
327 | },
328 | {
329 | files: ['*.d.ts'],
330 | rules: {
331 | '@typescript-eslint/no-empty-interface': 'off',
332 | '@typescript-eslint/consistent-type-imports': 'off',
333 | '@typescript-eslint/no-unused-vars': 'off'
334 | }
335 | },
336 | {
337 | files: ['*.json', '*.json5'],
338 | parser: 'jsonc-eslint-parser',
339 | rules: {
340 | 'jsonc/array-bracket-spacing': ['error', 'never'],
341 | 'jsonc/comma-dangle': ['error', 'never'],
342 | 'jsonc/comma-style': ['error', 'last'],
343 | 'jsonc/indent': ['error', 2],
344 | 'jsonc/key-spacing': ['error', { beforeColon: false, afterColon: true }],
345 | 'jsonc/no-octal-escape': 'error',
346 | 'jsonc/object-curly-newline': ['error', { multiline: true, consistent: true }],
347 | 'jsonc/object-curly-spacing': ['error', 'always'],
348 | 'jsonc/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }]
349 | }
350 | },
351 | {
352 | files: ['*.yaml', '*.yml'],
353 | parser: 'yaml-eslint-parser',
354 | rules: {
355 | 'spaced-comment': 'off'
356 | }
357 | },
358 | {
359 | // Code blocks in markdown file
360 | files: ['**/*.md/*.*'],
361 | rules: {
362 | '@typescript-eslint/no-redeclare': 'off',
363 | '@typescript-eslint/no-unused-vars': 'off',
364 | '@typescript-eslint/no-use-before-define': 'off',
365 | '@typescript-eslint/no-var-requires': 'off',
366 | '@typescript-eslint/comma-dangle': 'off',
367 | 'import/no-unresolved': 'off',
368 | 'no-alert': 'off',
369 | 'no-console': 'off',
370 | 'no-restricted-imports': 'off',
371 | 'no-undef': 'off',
372 | 'no-unused-expressions': 'off',
373 | 'no-unused-vars': 'off'
374 | }
375 | }
376 | ],
377 | ignorePatterns: [
378 | '*.min.*',
379 | '*.log',
380 | '*.svg',
381 | '.env.*',
382 | 'CHANGELOG.md',
383 | 'dist',
384 | 'LICENSE*',
385 | 'output',
386 | 'coverage',
387 | 'public',
388 | 'temp',
389 | 'node_modules',
390 | 'package-lock.json',
391 | 'pnpm-lock.yaml',
392 | 'yarn.lock',
393 | '__snapshots__',
394 | '.husky',
395 | '!.github',
396 | '!.vitepress',
397 | '!.vscode'
398 | ]
399 | })
400 |
--------------------------------------------------------------------------------
/packages/prettier-config/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [1.0.3](https://github.com/vexip-ui/lint-config/compare/prettier-config@1.0.2...prettier-config@1.0.3) (2025-05-27)
2 |
3 |
4 | ### Bug Fixes
5 |
6 | * **prettier-config:** include packagejson plugin ([bb87b35](https://github.com/vexip-ui/lint-config/commit/bb87b35a9ca8becce4b24f80dfa96ac8f7edba7e))
7 |
8 |
9 |
10 | ## [1.0.2](https://github.com/vexip-ui/lint-config/compare/prettier-config@1.0.1...prettier-config@1.0.2) (2025-05-27)
11 |
12 |
13 | ### Bug Fixes
14 |
15 | * **prettier-config:** include packagejson plugin ([a2ce270](https://github.com/vexip-ui/lint-config/commit/a2ce270fee19d49fe536f7097ee3e4041effc0c6))
16 |
17 |
18 |
19 | ## [1.0.1](https://github.com/vexip-ui/lint-config/compare/prettier-config@1.0.0...prettier-config@1.0.1) (2025-05-27)
20 |
21 |
22 | ### Bug Fixes
23 |
24 | * **prettier-config:** include packagejson plugin ([1a13138](https://github.com/vexip-ui/lint-config/commit/1a13138105e6438365851189f40a8ee404bf52e0))
25 |
26 |
27 |
28 | # [1.0.0](https://github.com/vexip-ui/lint-config/compare/prettier-config@0.2.0...prettier-config@1.0.0) (2024-07-16)
29 |
30 |
31 |
32 | # [0.2.0](https://github.com/vexip-ui/lint-config/compare/prettier-config@0.1.0...prettier-config@0.2.0) (2023-06-13)
33 |
34 | ### Features
35 |
36 | - **prettier-config:** add `jsxSingleQuote: true` ([95ed88f](https://github.com/vexip-ui/lint-config/commit/95ed88f9930fa88a60f0da4d51f03e6e85672781))
37 |
38 | # 0.1.0 (2022-09-27)
39 |
--------------------------------------------------------------------------------
/packages/prettier-config/build.config.ts:
--------------------------------------------------------------------------------
1 | import { defineBuildConfig } from 'unbuild'
2 |
3 | export default defineBuildConfig({
4 | entries: ['src/index'],
5 | clean: true,
6 | declaration: true,
7 | rollup: {
8 | emitCJS: true
9 | }
10 | })
11 |
--------------------------------------------------------------------------------
/packages/prettier-config/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@vexip-ui/prettier-config",
3 | "version": "1.0.3",
4 | "type": "module",
5 | "license": "MIT",
6 | "author": "qmhc",
7 | "scripts": {
8 | "build": "unbuild"
9 | },
10 | "main": "dist/index.cjs",
11 | "module": "dist/index.mjs",
12 | "types": "dist/index.d.ts",
13 | "exports": {
14 | ".": {
15 | "types": "./dist/index.d.ts",
16 | "require": "./dist/index.cjs",
17 | "import": "./dist/index.mjs"
18 | },
19 | "./package.json": "./package.json"
20 | },
21 | "keywords": [
22 | "vexip-ui",
23 | "prettier",
24 | "prettier-config"
25 | ],
26 | "homepage": "https://github.com/vexip-ui/lint-config",
27 | "dependencies": {
28 | "prettier-plugin-packagejson": "^2.5.14"
29 | },
30 | "peerDependencies": {
31 | "prettier": ">=3.0.0"
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/packages/prettier-config/src/index.ts:
--------------------------------------------------------------------------------
1 | import type { Config } from 'prettier'
2 | import * as packagejson from 'prettier-plugin-packagejson'
3 |
4 | export default {
5 | plugins: [packagejson],
6 | printWidth: 100,
7 | arrowParens: 'avoid',
8 | bracketSpacing: true,
9 | endOfLine: 'lf',
10 | bracketSameLine: false,
11 | quoteProps: 'as-needed',
12 | semi: false,
13 | singleQuote: true,
14 | tabWidth: 2,
15 | trailingComma: 'none',
16 | useTabs: false,
17 | vueIndentScriptAndStyle: false,
18 | jsxSingleQuote: true,
19 | packageSortOrder: [
20 | 'name',
21 | 'version',
22 | 'type',
23 | 'packageManager',
24 | 'license',
25 | 'private',
26 | 'author',
27 | 'description',
28 | 'scripts',
29 | 'bin',
30 | 'main',
31 | 'module',
32 | 'types',
33 | 'exports',
34 | 'sideEffects',
35 | 'files',
36 | 'engines',
37 | 'keywords',
38 | 'publishConfig',
39 | 'repository',
40 | 'bugs',
41 | 'homepage',
42 | 'dependencies',
43 | 'devDependencies',
44 | 'peerDependencies',
45 | 'peerDependenciesMeta',
46 | 'optionalDependencies',
47 | 'pnpm',
48 | 'resolutions',
49 | 'husky',
50 | 'gitHooks',
51 | 'lint-staged',
52 | 'prettier',
53 | 'eslintConfig'
54 | ],
55 | overrides: [
56 | {
57 | files: '*.md',
58 | options: {
59 | embeddedLanguageFormatting: 'off'
60 | }
61 | }
62 | ]
63 | } satisfies Config
64 |
--------------------------------------------------------------------------------
/packages/prettier-config/src/prettier-plugin-packagejson.d.ts:
--------------------------------------------------------------------------------
1 | declare module 'prettier-plugin-packagejson'
2 |
--------------------------------------------------------------------------------
/packages/stylelint-config/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # [1.1.0](https://github.com/vexip-ui/lint-config/compare/stylelint-config@1.0.0...stylelint-config@1.1.0) (2024-01-25)
2 |
3 |
4 |
5 | # [1.0.0](https://github.com/vexip-ui/lint-config/compare/stylelint-config@0.7.0...stylelint-config@1.0.0) (2023-12-15)
6 |
7 |
8 |
9 | # [0.7.0](https://github.com/vexip-ui/lint-config/compare/stylelint-config@0.6.0...stylelint-config@0.7.0) (2023-12-07)
10 |
11 |
12 |
13 | # [0.6.0](https://github.com/vexip-ui/lint-config/compare/stylelint-config@0.5.2...stylelint-config@0.6.0) (2023-10-25)
14 |
15 |
16 |
17 | ## [0.5.2](https://github.com/vexip-ui/lint-config/compare/stylelint-config@0.5.1...stylelint-config@0.5.2) (2023-07-11)
18 |
19 |
20 | ### Bug Fixes
21 |
22 | * **stylelint-config:** ignore media-query-no-invalid for vue ([1476f27](https://github.com/vexip-ui/lint-config/commit/1476f2700b2578ff81b4a608b6656e7085c10903))
23 |
24 |
25 |
26 | ## [0.5.1](https://github.com/vexip-ui/lint-config/compare/stylelint-config@0.5.0...stylelint-config@0.5.1) (2023-07-11)
27 |
28 |
29 | ### Bug Fixes
30 |
31 | * **stylelint-config:** off media-query-no-invalid rule ([6d55ba3](https://github.com/vexip-ui/lint-config/commit/6d55ba33a2367a3693a1bf4234cc3ebf67f7589a))
32 |
33 |
34 | ### Features
35 |
36 | * **eslint-config:** support jsx syntax ([155695c](https://github.com/vexip-ui/lint-config/commit/155695c29c7bd5b6328eb2df831ec42ae413bfb8))
37 |
38 |
39 |
40 | # [0.5.0](https://github.com/vexip-ui/lint-config/compare/stylelint-config@0.4.0...stylelint-config@0.5.0) (2023-07-11)
41 |
42 | # [0.4.0](https://github.com/vexip-ui/lint-config/compare/stylelint-config@0.3.0...stylelint-config@0.4.0) (2023-05-05)
43 |
44 | # [0.3.0](https://github.com/vexip-ui/lint-config/compare/stylelint-config@0.2.1...stylelint-config@0.3.0) (2023-04-20)
45 |
46 | ### Features
47 |
48 | - **stylelint-config:** dep recommended config ([ab34c6d](https://github.com/vexip-ui/lint-config/commit/ab34c6da32bbdc46776fe207f107199f7f1bf24c))
49 |
50 | ## [0.2.1](https://github.com/vexip-ui/lint-config/compare/stylelint-config@0.2.0...stylelint-config@0.2.1) (2023-02-24)
51 |
52 | ### Bug Fixes
53 |
54 | - **stylelint-config:** add allow any for stylelint ([e0e412f](https://github.com/vexip-ui/lint-config/commit/e0e412f8a85b3e1f9c4dff3a9a13890b4167b33e))
55 |
56 | # [0.2.0](https://github.com/vexip-ui/lint-config/compare/stylelint-config@0.1.1...stylelint-config@0.2.0) (2023-02-24)
57 |
58 | ### Bug Fixes
59 |
60 | - **stylelint-config:** allows any stylelint version ([f07686d](https://github.com/vexip-ui/lint-config/commit/f07686d1ddcbcbfa808bb6a22087b2a39298747b))
61 |
62 | ## [0.1.1](https://github.com/vexip-ui/lint-config/compare/stylelint-config@0.1.0...stylelint-config@0.1.1) (2022-09-27)
63 |
64 | ### Bug Fixes
65 |
66 | - **stylelint:** add annotation-no-unknown rule ([564ee6d](https://github.com/vexip-ui/lint-config/commit/564ee6d177d726c2df3070e89203c5d9452b0dbe))
67 |
68 | # 0.1.0 (2022-09-27)
69 |
--------------------------------------------------------------------------------
/packages/stylelint-config/build.config.ts:
--------------------------------------------------------------------------------
1 | import { defineBuildConfig } from 'unbuild'
2 |
3 | export default defineBuildConfig({
4 | entries: ['src/index'],
5 | clean: true,
6 | declaration: true,
7 | rollup: {
8 | emitCJS: true
9 | }
10 | })
11 |
--------------------------------------------------------------------------------
/packages/stylelint-config/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@vexip-ui/stylelint-config",
3 | "version": "1.1.0",
4 | "type": "module",
5 | "license": "MIT",
6 | "author": "qmhc",
7 | "scripts": {
8 | "build": "unbuild"
9 | },
10 | "main": "dist/index.cjs",
11 | "module": "dist/index.mjs",
12 | "types": "dist/index.d.ts",
13 | "exports": {
14 | ".": {
15 | "types": "./dist/index.d.ts",
16 | "require": "./dist/index.cjs",
17 | "import": "./dist/index.mjs"
18 | },
19 | "./package.json": "./package.json"
20 | },
21 | "keywords": [
22 | "vexip-ui",
23 | "stylelint",
24 | "stylelint-config"
25 | ],
26 | "homepage": "https://github.com/vexip-ui/lint-config",
27 | "dependencies": {
28 | "postcss": "^8.4.33",
29 | "postcss-html": "^1.6.0",
30 | "postcss-preset-env": "^9.3.0",
31 | "stylelint-config-html": "^1.1.0",
32 | "stylelint-config-recess-order": "^4.4.0",
33 | "stylelint-config-recommended": "^14.0.0",
34 | "stylelint-config-recommended-vue": "^1.5.0",
35 | "stylelint-config-standard": "^36.0.0",
36 | "stylelint-config-standard-scss": "^13.0.0",
37 | "stylelint-order": "^6.0.4"
38 | },
39 | "devDependencies": {
40 | "stylelint": "^16.2.0"
41 | },
42 | "peerDependencies": {
43 | "stylelint": ">=16"
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/packages/stylelint-config/src/index.ts:
--------------------------------------------------------------------------------
1 | import type { Config } from 'stylelint'
2 |
3 | export default {
4 | defaultSeverity: 'error',
5 | extends: [
6 | 'stylelint-config-standard',
7 | 'stylelint-config-standard-scss',
8 | 'stylelint-config-html',
9 | 'stylelint-config-recommended-vue',
10 | 'stylelint-config-recess-order'
11 | ],
12 | plugins: ['stylelint-order'],
13 | rules: {
14 | 'no-empty-source': process.env.NODE_ENV === 'production' ? true : null,
15 | 'block-no-empty': process.env.NODE_ENV === 'production' ? true : null,
16 | 'at-rule-no-unknown': null,
17 | 'at-rule-no-vendor-prefix': true,
18 | 'declaration-property-value-disallowed-list': {
19 | '/^transition/': ['/all/'],
20 | '/^background/': ['http:', 'https:'],
21 | '/^border/': ['none'],
22 | '/.+/': ['initial']
23 | },
24 | 'media-feature-name-no-vendor-prefix': true,
25 | 'property-no-vendor-prefix': true,
26 | 'selector-no-vendor-prefix': true,
27 | 'value-no-vendor-prefix': true,
28 | 'at-rule-empty-line-before': [
29 | 'always',
30 | {
31 | except: ['first-nested'],
32 | ignore: [
33 | 'after-comment',
34 | 'blockless-after-same-name-blockless',
35 | 'blockless-after-blockless'
36 | ],
37 | ignoreAtRules: ['else']
38 | }
39 | ],
40 | 'no-descending-specificity': null,
41 | 'custom-property-empty-line-before': null,
42 | 'selector-class-pattern': [
43 | '^([#a-z][$#{}a-z0-9]*)((-{1,2}|_{2})[$#{}a-z0-9]+)*$',
44 | {
45 | message: 'Expected class selector to be kebab-case'
46 | }
47 | ],
48 | 'keyframes-name-pattern': [
49 | '^([#a-z][$#{}a-z0-9]*)((-{1,2}|_{2})[$#{}a-z0-9]+)*$',
50 | {
51 | message: 'Expected keyframe name to be kebab-case'
52 | }
53 | ],
54 | 'color-function-notation': null,
55 | 'function-no-unknown': null,
56 | 'alpha-value-notation': 'percentage',
57 | 'annotation-no-unknown': [
58 | true,
59 | {
60 | ignoreAnnotations: ['default', 'global']
61 | }
62 | ],
63 | 'scss/at-import-partial-extension': 'always',
64 | 'scss/dollar-variable-empty-line-before': null,
65 | 'scss/operator-no-newline-after': null
66 | },
67 | overrides: [
68 | {
69 | files: ['*.scss', '*.vue'],
70 | rules: {
71 | 'media-query-no-invalid': null
72 | }
73 | }
74 | ],
75 | ignoreFiles: [
76 | 'node_modules',
77 | 'dist',
78 | 'public',
79 | 'output',
80 | 'coverage',
81 | 'temp',
82 | '*.js',
83 | '*.cjs',
84 | '*.mjs',
85 | '*.ts',
86 | '*.tsx',
87 | '*.svg',
88 | '*.gif',
89 | '*.md'
90 | ]
91 | } satisfies Config
92 |
--------------------------------------------------------------------------------
/pnpm-workspace.yaml:
--------------------------------------------------------------------------------
1 | packages:
2 | - packages/*
3 |
--------------------------------------------------------------------------------
/scripts/constant.ts:
--------------------------------------------------------------------------------
1 | import { resolve } from 'node:path'
2 | import { fileURLToPath } from 'node:url'
3 |
4 | export const rootDir = resolve(fileURLToPath(import.meta.url), '../..')
--------------------------------------------------------------------------------
/scripts/publish.ts:
--------------------------------------------------------------------------------
1 | import { resolve } from 'node:path'
2 |
3 | import minimist from 'minimist'
4 | import { logger, publish } from '@vexip-ui/scripts'
5 | import { rootDir } from './constant'
6 |
7 | const args = minimist<{
8 | d?: boolean,
9 | dry?: boolean,
10 | t?: string,
11 | tag?: string
12 | }>(process.argv.slice(2))
13 |
14 | const target = args._[0]
15 | const isDryRun = args.dry || args.d
16 | const releaseTag = args.tag || args.t
17 |
18 | async function main() {
19 | if (!target?.includes('@')) throw new Error('Invaild package!')
20 |
21 | const [pkgName] = target.split('@')
22 |
23 | await publish({ pkgDir: resolve(rootDir, `packages/${pkgName}`), isDryRun, releaseTag })
24 | }
25 |
26 | main().catch(error => {
27 | logger.error(error)
28 | process.exit(1)
29 | })
30 |
--------------------------------------------------------------------------------
/scripts/release.ts:
--------------------------------------------------------------------------------
1 | import minimist from 'minimist'
2 | import semver from 'semver'
3 | import { logger, release, run } from '@vexip-ui/scripts'
4 |
5 | import { getPackageInfo } from './utils'
6 |
7 | const args = minimist<{
8 | d?: boolean,
9 | dry?: boolean,
10 | t?: string,
11 | tag?: string
12 | }>(process.argv.slice(2))
13 |
14 | const inputPkg = args._[0]
15 | const isDryRun = args.dry || args.d
16 |
17 | async function main() {
18 | const { pkgName, pkgDir, pkg, currentVersion } = await getPackageInfo(inputPkg)
19 | const preId = args.preid || args.p || semver.prerelease(currentVersion)?.[0]
20 |
21 | await release({
22 | pkgDir,
23 | isDryRun,
24 | preId,
25 | gitCommitScope: pkgName,
26 | runBuild: async () => {
27 | if (pkg.scripts?.build) {
28 | await run('pnpm', ['build'], { cwd: pkgDir })
29 | }
30 | },
31 | runChangelog: async () => {
32 | const changelogArgs = [
33 | 'conventional-changelog',
34 | '-p',
35 | 'angular',
36 | '-i',
37 | 'CHANGELOG.md',
38 | '-s',
39 | '--commit-path',
40 | '.',
41 | '--lerna-package',
42 | pkgName
43 | ]
44 |
45 | await run('npx', changelogArgs, { cwd: pkgDir })
46 | }
47 | })
48 | }
49 |
50 | main().catch(error => {
51 | logger.error(error)
52 | process.exit(1)
53 | })
54 |
--------------------------------------------------------------------------------
/scripts/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "module": "esnext",
5 | "allowJs": false,
6 | "strict": true,
7 | "moduleResolution": "node",
8 | "noUnusedLocals": true,
9 | "resolveJsonModule": true,
10 | "esModuleInterop": true,
11 | "allowSyntheticDefaultImports": true,
12 | "useUnknownInCatchVariables": false,
13 | "types": ["node"]
14 | },
15 | "include": ["*.ts"]
16 | }
17 |
--------------------------------------------------------------------------------
/scripts/utils.ts:
--------------------------------------------------------------------------------
1 | import { resolve } from 'node:path'
2 | import { existsSync, readFileSync, readdirSync } from 'node:fs'
3 | import { fileURLToPath } from 'node:url'
4 |
5 | import prompts from 'prompts'
6 |
7 | export const rootDir = resolve(fileURLToPath(import.meta.url), '../..')
8 | export const pkgNames = readdirSync(resolve(rootDir, 'packages'))
9 |
10 | export async function getPackageInfo(inputPkg: string) {
11 | let pkgName: string | null = null
12 |
13 | if (pkgNames.includes(inputPkg)) {
14 | pkgName = inputPkg
15 | } else {
16 | let options = inputPkg ? pkgNames.filter(p => p.includes(inputPkg)) : pkgNames
17 |
18 | if (!options.length) {
19 | options = pkgNames
20 | } else if (options.length === 1) {
21 | pkgName = options[0]
22 | } else {
23 | pkgName = (
24 | await prompts({
25 | type: 'select',
26 | name: 'pkgName',
27 | message: 'Select release package:',
28 | choices: options.map(n => ({ title: n, value: n }))
29 | })
30 | ).pkgName
31 | }
32 | }
33 |
34 | if (!pkgName) {
35 | throw new Error('Release package must not be null')
36 | }
37 |
38 | const pkgDir = resolve(rootDir, `packages/${pkgName}`)
39 | const pkgPath = resolve(pkgDir, 'package.json')
40 |
41 | if (!existsSync(pkgPath)) {
42 | throw new Error(`Release package ${pkgName} not found`)
43 | }
44 |
45 | const rawPkg = readFileSync(pkgPath, 'utf-8')
46 | const pkg = JSON.parse(rawPkg)
47 |
48 | if (pkg.private) {
49 | throw new Error(`Release package ${pkgName} is private`)
50 | }
51 |
52 | return {
53 | pkgName,
54 | pkgDir,
55 | pkgPath,
56 | pkg,
57 | currentVersion: pkg.version
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "module": "esnext",
5 | "allowJs": false,
6 | "strict": true,
7 | "moduleResolution": "bundler",
8 | "skipLibCheck": true,
9 | "noUnusedLocals": true,
10 | "experimentalDecorators": true,
11 | "resolveJsonModule": true,
12 | "esModuleInterop": true,
13 | "sourceMap": false,
14 | "outDir": "dist",
15 | "types": ["node"]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------