Skip to content

Commit e06e7f2

Browse files
committed
First commit
0 parents  commit e06e7f2

17 files changed

Lines changed: 1612 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: write
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: pnpm/action-setup@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 22
20+
registry-url: https://registry.npmjs.org
21+
22+
- run: pnpm install --frozen-lockfile
23+
24+
- run: pnpm build
25+
26+
- run: pnpm publish -r --access public --no-git-checks --provenance

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.turbo

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@byscripts/toolbox",
3+
"scripts": {
4+
"build": "turbo build"
5+
},
6+
"keywords": [],
7+
"author": "",
8+
"license": "MIT",
9+
"devDependencies": {
10+
"turbo": "^2.8.10"
11+
},
12+
"packageManager": "pnpm@10.30.1"
13+
}

packages/eslint-config/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

packages/eslint-config/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# @byscripts/eslint-config
2+
3+
Shared ESLint flat config for Vue 3 + TypeScript projects.
4+
5+
## Install
6+
7+
```bash
8+
pnpm add -D @byscripts/eslint-config eslint
9+
```
10+
11+
The config references rules from `eslint-plugin-vue`, `typescript-eslint`, and `vue-eslint-parser`. These must be available at runtime. In a typical Vue + TypeScript project, they are already installed (via `@vue/eslint-config-typescript`, `eslint-plugin-vue`, etc.). If not, install them explicitly:
12+
13+
```bash
14+
pnpm add -D eslint-plugin-vue typescript-eslint vue-eslint-parser
15+
```
16+
17+
## Usage
18+
19+
```js
20+
// eslint.config.js
21+
import byscriptsConfig from "@byscripts/eslint-config";
22+
23+
export default [
24+
...byscriptsConfig,
25+
// your overrides here
26+
];
27+
```
28+
29+
## Dev
30+
31+
```bash
32+
pnpm build # compile src/index.ts -> dist/index.mjs + dist/index.d.mts
33+
pnpm publish --access public # publish to npm (pnpm replaces workspace:* automatically)
34+
```
35+
36+
## Notes
37+
38+
- Built with `tsdown --dts`
39+
- Uses ESLint flat config (`defineConfig` from `eslint/config`, available since ESLint 9.22)
40+
- Peer dependency: `eslint ^9.22.0`
41+
- `@byscripts/eslint-plugin` is a regular dependency (installed automatically)
42+
- `eslint-plugin-vue`, `typescript-eslint`, and `vue-eslint-parser` must be available at runtime (usually already present in Vue + TS projects)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "@byscripts/eslint-config",
3+
"version": "0.3.3",
4+
"type": "module",
5+
"files": [
6+
"dist"
7+
],
8+
"exports": {
9+
".": {
10+
"types": "./dist/index.d.mts",
11+
"default": "./dist/index.mjs"
12+
}
13+
},
14+
"scripts": {
15+
"build": "tsdown --dts"
16+
},
17+
"dependencies": {
18+
"@byscripts/eslint-plugin": "workspace:*"
19+
},
20+
"peerDependencies": {
21+
"eslint": "^9.22.0"
22+
},
23+
"devDependencies": {
24+
"@tsconfig/node22": "^22.0.5",
25+
"tsdown": "^0.20.3"
26+
},
27+
"license": "MIT"
28+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { defineConfig } from "eslint/config";
2+
import byscriptsPlugins from "@byscripts/eslint-plugin";
3+
4+
export default defineConfig([
5+
{
6+
plugins: {
7+
byscripts: {
8+
rules: {
9+
"vue-block-attribute-order": byscriptsPlugins.blockAttributeOrder,
10+
},
11+
},
12+
},
13+
rules: {
14+
"vue/block-order": ["error", { order: ["script", "template", "style"] }],
15+
"vue/block-lang": [
16+
"error",
17+
{
18+
script: { lang: "ts" },
19+
style: { lang: "postcss" },
20+
},
21+
],
22+
"vue/block-tag-newline": [
23+
"error",
24+
{
25+
singleline: "consistent",
26+
multiline: "always",
27+
maxEmptyLines: 0,
28+
},
29+
],
30+
"vue/component-api-style": ["error", ["script-setup"]],
31+
"vue/component-name-in-template-casing": [
32+
"error",
33+
"PascalCase",
34+
{ registeredComponentsOnly: false },
35+
],
36+
"vue/custom-event-name-casing": ["error", "camelCase"],
37+
"vue/define-emits-declaration": ["error", "type-literal"],
38+
"vue/define-macros-order": [
39+
"error",
40+
{
41+
order: [
42+
"defineOptions",
43+
"defineProps",
44+
"defineEmits",
45+
"defineModel",
46+
"defineSlots",
47+
],
48+
defineExposeLast: true,
49+
},
50+
],
51+
"vue/define-props-declaration": ["error", "type-based"],
52+
"vue/enforce-style-attribute": ["error", { allow: ["scoped", "module"] }],
53+
"vue/html-button-has-type": "error",
54+
"vue/html-comment-content-newline": [
55+
"error",
56+
{
57+
singleline: "never",
58+
multiline: "always",
59+
},
60+
],
61+
"vue/html-comment-content-spacing": ["error", "always"],
62+
"vue/no-duplicate-attr-inheritance": "error",
63+
"vue/no-empty-component-block": "error",
64+
"vue/no-multiple-objects-in-class": "error",
65+
"vue/no-ref-object-reactivity-loss": "error",
66+
"vue/no-static-inline-styles": "error",
67+
"vue/no-template-target-blank": "error",
68+
"vue/no-undef-components": [
69+
"error",
70+
{ ignorePatterns: ["RouterLink", "RouterView", "I18nT"] },
71+
],
72+
"vue/no-undef-properties": "error",
73+
"vue/no-unused-refs": "error",
74+
"vue/no-use-v-else-with-v-for": "error",
75+
"vue/no-useless-mustaches": "error",
76+
"vue/no-useless-v-bind": "error",
77+
"vue/no-v-text": "error",
78+
"vue/padding-line-between-blocks": "error",
79+
"vue/prefer-define-options": "error",
80+
"vue/prefer-separate-static-class": "error",
81+
"vue/prefer-true-attribute-shorthand": "error",
82+
"vue/require-macro-variable-name": "error",
83+
"vue/valid-define-options": "error",
84+
"byscripts/vue-block-attribute-order": "error",
85+
},
86+
},
87+
]);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@tsconfig/node22/tsconfig.json"
3+
}

packages/eslint-plugin/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

packages/eslint-plugin/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# @byscripts/eslint-plugin
2+
3+
Custom ESLint rules for Vue 3 projects.
4+
5+
## Rules
6+
7+
| Rule | Description | Fixable |
8+
| ------------------------------------- | ----------------------------------------------------------- | ------- |
9+
| `byscripts/vue-block-attribute-order` | Enforces attribute order on `<script>` and `<style>` blocks | Yes |
10+
11+
### `vue-block-attribute-order`
12+
13+
Default order:
14+
15+
- `<script>`: `lang`, `setup`
16+
- `<style>`: `lang`, `scoped`
17+
18+
Custom order via rule options:
19+
20+
```js
21+
"byscripts/vue-block-attribute-order": ["error", {
22+
script: ["setup", "lang"],
23+
style: ["scoped", "lang"],
24+
}]
25+
```
26+
27+
## Dev
28+
29+
```bash
30+
pnpm build # compile src/ -> dist/index.mjs + dist/index.d.mts
31+
pnpm publish --access public # publish to npm
32+
```
33+
34+
## Notes
35+
36+
- Built with `tsdown --dts`
37+
- Peer dependency: `eslint ^9.22.0`
38+
- Requires `vue-eslint-parser` in the consumer project (for `parserServices.getDocumentFragment()`)

0 commit comments

Comments
 (0)