@bagelink/lint-config 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Bagel Studio
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 all
13
+ 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 THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,353 @@
1
+ # @bagelink/lint-config
2
+
3
+ ESLint and Prettier configuration for Vue 3 + TypeScript projects.
4
+
5
+ ## Philosophy
6
+
7
+ - **Prettier owns formatting** — no line length, quotes, semicolons, or indentation rules in ESLint
8
+ - **ESLint owns correctness** — catch bugs, enforce best practices, no pedantic preferences
9
+ - **Zero conflict** — `eslint-config-prettier` disables all formatting rules; saving never produces lint errors from formatting
10
+ - **Minimal dependencies** — only what's needed for Vue 3 + TypeScript
11
+ - **Near-zero consumer config** — centralized configs, auto-setup script, one-line usage
12
+
13
+ ## Quick Start
14
+
15
+ ```bash
16
+ # Install all dependencies
17
+ bun add -d @bagelink/lint-config @eslint/js eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescript simple-git-hooks lint-staged vue-tsc
18
+
19
+ # Auto-setup (copies config files)
20
+ bunx bagel-lint-setup
21
+
22
+ # Create eslint.config.js
23
+ echo "export { default } from '@bagelink/lint-config/eslint'" > eslint.config.js
24
+
25
+ # Setup git hooks
26
+ bun run prepare
27
+
28
+ # To update from GitHub and reapply configs (one command!)
29
+ bunx bagel-lint-setup --upgrade
30
+ ```
31
+
32
+ See [Full Setup Guide](#full-setup-guide) below for complete instructions.
33
+
34
+ ## Installation
35
+
36
+ ### From npm (once published)
37
+
38
+ ```bash
39
+ # Bun
40
+ bun add -d @bagelink/lint-config @eslint/js eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescript
41
+
42
+ # npm
43
+ npm install -D @bagelink/lint-config @eslint/js eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescript
44
+ ```
45
+
46
+ ### From GitHub
47
+
48
+ ```bash
49
+ # Bun
50
+ bun add -d github:bageldb/bagel-lint-config @eslint/js eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescript
51
+
52
+ # npm
53
+ npm install -D github:bageldb/bagel-lint-config @eslint/js eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescript
54
+ ```
55
+
56
+ ## Full Setup Guide
57
+
58
+ ### 1. Install Dependencies
59
+
60
+ ```bash
61
+ bun add -d @bagelink/lint-config @eslint/js eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescript simple-git-hooks lint-staged vue-tsc
62
+ ```
63
+
64
+ ### 2. Run Auto-Setup
65
+
66
+ ```bash
67
+ bunx bagel-lint-setup
68
+ ```
69
+
70
+ This copies the following to your project:
71
+ - `.prettierignore`
72
+ - `.editorconfig`
73
+ - `tsconfig.json`
74
+ - `tsconfig.app.json`
75
+ - `tsconfig.node.json`
76
+ - `.vscode/settings.json` — Format on save, ESLint integration
77
+ - `.vscode/extensions.json` — Recommended VS Code extensions
78
+
79
+ ### 3. Create ESLint Config
80
+
81
+ **Option A: Minimal (Recommended)**
82
+
83
+ Create `eslint.config.js`:
84
+
85
+ ```js
86
+ export { default } from '@bagelink/lint-config/eslint'
87
+ ```
88
+
89
+ **Option B: With Overrides**
90
+
91
+ ```js
92
+ import bagelConfig from '@bagelink/lint-config/eslint'
93
+
94
+ export default [
95
+ ...bagelConfig,
96
+ // Your project-specific overrides
97
+ {
98
+ rules: {
99
+ 'no-console': 'off',
100
+ },
101
+ },
102
+ ]
103
+ ```
104
+
105
+ ### 4. Update package.json
106
+
107
+ Add these configurations:
108
+
109
+ ```json
110
+ {
111
+ "scripts": {
112
+ "lint": "eslint .",
113
+ "lint:fix": "eslint . --fix",
114
+ "format": "prettier --write .",
115
+ "format:check": "prettier --check .",
116
+ "prepare": "simple-git-hooks"
117
+ },
118
+ "prettier": "@bagelink/lint-config/prettier",
119
+ "simple-git-hooks": {
120
+ "pre-commit": "bunx --bun lint-staged"
121
+ },
122
+ "lint-staged": {
123
+ "*.{js,mjs,cjs,ts,mts,cts,vue}": ["eslint --fix", "prettier --write"],
124
+ "*.{json,md,html,css,scss}": ["prettier --write"]
125
+ }
126
+ }
127
+ ```
128
+
129
+ ### 5. Initialize Git Hooks
130
+
131
+ ```bash
132
+ bun run prepare
133
+ ```
134
+
135
+ ### 6. Install VS Code Extensions
136
+
137
+ When you open the project in VS Code, you'll be prompted to install recommended extensions:
138
+ - Prettier
139
+ - ESLint
140
+ - Vue Language Features (Volar)
141
+
142
+ Click "Install All" when prompted, or install manually:
143
+
144
+ ```bash
145
+ code --install-extension esbenp.prettier-vscode
146
+ code --install-extension dbaeumer.vscode-eslint
147
+ code --install-extension vue.volar
148
+ code --install-extension vue.vscode-typescript-vue-plugin
149
+ ```
150
+
151
+ After installing extensions, **reload VS Code** for format-on-save to activate.
152
+
153
+ ## Advanced Usage
154
+
155
+ ### Custom Prettier Config
156
+
157
+ If you need to override Prettier settings, create `prettier.config.cjs`:
158
+
159
+ ```js
160
+ const bagelPrettier = require('@bagelink/lint-config/prettier')
161
+
162
+ module.exports = {
163
+ ...bagelPrettier,
164
+ printWidth: 120, // Override
165
+ }
166
+ ```
167
+
168
+ ### Custom ESLint Rules
169
+
170
+ See Option B in [Step 3](#3-create-eslint-config) above.
171
+
172
+ ## CI Integration
173
+
174
+ ### GitHub Actions
175
+
176
+ ```yaml
177
+ name: Lint & Format
178
+
179
+ on: [push, pull_request]
180
+
181
+ jobs:
182
+ lint:
183
+ runs-on: ubuntu-latest
184
+ steps:
185
+ - uses: actions/checkout@v4
186
+ - uses: oven-sh/setup-bun@v1
187
+
188
+ - name: Install dependencies
189
+ run: bun install
190
+
191
+ - name: Check formatting
192
+ run: bun run format:check
193
+
194
+ - name: Lint
195
+ run: bun run lint
196
+ ```
197
+
198
+ ### Pre-commit Hook
199
+
200
+ Automatically runs on every commit (configured via `simple-git-hooks`):
201
+
202
+ - ESLint auto-fix on JS/TS/Vue files
203
+ - Prettier format on all supported files
204
+ - Only stages changed files via `lint-staged`
205
+
206
+ ## What's Included
207
+
208
+ ### ESLint Rules
209
+
210
+ - ✅ Vue 3 recommended rules (including `<script setup>`)
211
+ - ✅ TypeScript recommended rules
212
+ - ✅ Browser, Node, and ES2021 globals
213
+ - ✅ `prefer-const`, `no-debugger`
214
+ - ✅ Unused variables error (except `_` prefixed)
215
+ - ✅ Consistent type imports (allows splitting type and regular imports)
216
+ - ✅ `console` and `any` are allowed
217
+ - ❌ No formatting rules (handled by Prettier)
218
+ - ❌ No pedantic preferences
219
+
220
+ ### Prettier Settings
221
+
222
+ - `printWidth: 100`
223
+ - `singleQuote: true`
224
+ - `semi: false`
225
+ - `trailingComma: 'all'`
226
+ - `arrowParens: 'always'`
227
+ - `endOfLine: 'lf'`
228
+
229
+ ### Additional Files
230
+
231
+ - `.prettierignore` — Ignore build outputs, dependencies, IDE files
232
+ - `.editorconfig` — Consistent editor settings (2 spaces, LF, UTF-8)
233
+ - `tsconfig.json` / `tsconfig.app.json` / `tsconfig.node.json` — TypeScript configuration for Vue 3 + Vite
234
+ - `.vscode/settings.json` — Format on save, ESLint auto-fix
235
+ - `.vscode/extensions.json` — Recommended VS Code extensions
236
+ - Git hooks config — Auto-format and lint on commit
237
+
238
+ ### TypeScript Configuration
239
+
240
+ The included TypeScript configs are optimized for Vue 3 + Vite projects:
241
+
242
+ **Key Features:**
243
+ - ✅ `types: []` in app config — prevents @types conflicts with ESLint
244
+ - ✅ `lib: ["ES2022"]` — modern JS features (Object.hasOwn, String.replaceAll)
245
+ - ✅ `exclude: ["**/.*"]` — excludes hidden config files from type checking
246
+ - ✅ Project references — separate configs for app code vs build tooling
247
+ - ✅ Strict mode enabled with unused variable checks
248
+ - ✅ Path aliases (`@/*` → `./src/*`)
249
+
250
+ ## Upgrading
251
+
252
+ ### Update to Latest Version (One Command)
253
+
254
+ ```bash
255
+ # Update from GitHub and reapply all configs
256
+ bunx bagel-lint-setup --upgrade
257
+
258
+ # Then test
259
+ bun run lint
260
+ bun run format
261
+ ```
262
+
263
+ This single command:
264
+ 1. ✅ Pulls latest version from GitHub
265
+ 2. ✅ Overwrites all config files with updates
266
+ 3. ✅ Auto-detects your package manager (bun/npm/yarn/pnpm)
267
+
268
+ ## Migration Guide
269
+
270
+ ### From Previous Versions
271
+
272
+ ```bash
273
+ # 1. Pull latest and reapply configs
274
+ bunx bagel-lint-setup --upgrade
275
+
276
+ # 2. Simplify eslint.config.js to one line
277
+ echo "export { default } from '@bagelink/lint-config/eslint'" > eslint.config.js
278
+
279
+ # 3. Remove old config files (if upgrading from older setup)
280
+ rm -f prettier.config.cjs .eslintrc.* .prettierrc.*
281
+
282
+ # 4. Update package.json (see Full Setup Guide)
283
+
284
+ # 5. Test
285
+ bun run lint
286
+ bun run format
287
+ ```
288
+
289
+ ### Manual Update (Alternative)
290
+
291
+ If you prefer to control each step:
292
+
293
+ ```bash
294
+ # 1. Update package manually
295
+ bun update @bagelink/lint-config
296
+
297
+ # 2. Force reapply configs
298
+ bunx bagel-lint-setup --force
299
+ ```
300
+
301
+ ## Troubleshooting
302
+
303
+ ### Git Hooks Not Running
304
+
305
+ ```bash
306
+ # Reinitialize hooks
307
+ bun run prepare
308
+ ```
309
+
310
+ ### ESLint Not Finding Config
311
+
312
+ Ensure `eslint.config.js` is at your project root and uses ES module syntax.
313
+
314
+ ### Format on Save Not Working
315
+
316
+ 1. **Install required VS Code extensions** (see `.vscode/extensions.json`)
317
+ 2. **Reload VS Code** after installing
318
+ 3. Check `.vscode/settings.json` exists with `"editor.formatOnSave": true`
319
+ 4. Verify Prettier is set as default formatter:
320
+ - Right-click in a file → "Format Document With..." → "Configure Default Formatter"
321
+ - Select "Prettier - Code formatter"
322
+
323
+ ### Prettier Ignoring Files
324
+
325
+ Check `.prettierignore` is in your project root. Run `bunx bagel-lint-setup` to regenerate.
326
+
327
+ ### TypeScript Errors
328
+
329
+ If you get TypeScript errors about conflicting types:
330
+ - Check that `tsconfig.app.json` has `"types": []` (prevents auto-including @types)
331
+ - Ensure `exclude: ["**/.*"]` is present to exclude config files
332
+ - Run `bunx bagel-lint-setup` to regenerate configs from the latest version
333
+
334
+ ## Package Exports
335
+
336
+ The following can be imported in your project:
337
+
338
+ - `@bagelink/lint-config/eslint` — ESLint flat config
339
+ - `@bagelink/lint-config/prettier` — Prettier config
340
+ - `@bagelink/lint-config/lint-staged` — lint-staged config
341
+ - `@bagelink/lint-config/git-hooks` — simple-git-hooks config
342
+ - `@bagelink/lint-config/vscode/settings` — VS Code settings
343
+ - `@bagelink/lint-config/vscode/extensions` — VS Code extensions
344
+ - `@bagelink/lint-config/prettierignore` — Prettier ignore patterns
345
+ - `@bagelink/lint-config/editorconfig` — EditorConfig settings
346
+ - `@bagelink/lint-config/tsconfig` — Root TypeScript config
347
+ - `@bagelink/lint-config/tsconfig/app` — App TypeScript config
348
+ - `@bagelink/lint-config/tsconfig/node` — Node/Vite TypeScript config
349
+
350
+ ## License
351
+
352
+ MIT
353
+
@@ -0,0 +1,10 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
@@ -0,0 +1,5 @@
1
+ import vue3 from './vue3.js'
2
+
3
+ export { vue3 }
4
+ export default vue3
5
+
package/eslint/vue3.js ADDED
@@ -0,0 +1,143 @@
1
+ import js from '@eslint/js'
2
+ import pluginVue from 'eslint-plugin-vue'
3
+ import tseslint from '@typescript-eslint/eslint-plugin'
4
+ import tsparser from '@typescript-eslint/parser'
5
+ import vueParser from 'vue-eslint-parser'
6
+ import eslintConfigPrettier from 'eslint-config-prettier'
7
+ import globals from 'globals'
8
+
9
+ export default [
10
+ // Base recommended rules
11
+ js.configs.recommended,
12
+
13
+ // Vue 3 recommended rules
14
+ ...pluginVue.configs['flat/recommended'],
15
+
16
+ // Disable formatting rules
17
+ eslintConfigPrettier,
18
+
19
+ // File matching and parser configuration
20
+ {
21
+ files: ['**/*.{js,mjs,cjs,ts,tsx,vue}'],
22
+ languageOptions: {
23
+ ecmaVersion: 'latest',
24
+ sourceType: 'module',
25
+ parser: vueParser,
26
+ parserOptions: {
27
+ ecmaVersion: 'latest',
28
+ sourceType: 'module',
29
+ parser: tsparser,
30
+ extraFileExtensions: ['.vue'],
31
+ },
32
+ globals: {
33
+ ...globals.browser,
34
+ ...globals.node,
35
+ ...globals.es2021,
36
+ },
37
+ },
38
+ },
39
+
40
+ // CommonJS files configuration
41
+ {
42
+ files: ['**/*.cjs'],
43
+ languageOptions: {
44
+ sourceType: 'commonjs',
45
+ globals: {
46
+ ...globals.node,
47
+ ...globals.commonjs,
48
+ },
49
+ },
50
+ },
51
+
52
+ // TypeScript-specific configuration
53
+ {
54
+ files: ['**/*.{ts,tsx,vue}'],
55
+ plugins: {
56
+ '@typescript-eslint': tseslint,
57
+ },
58
+ languageOptions: {
59
+ parser: vueParser,
60
+ parserOptions: {
61
+ parser: tsparser,
62
+ project: null, // Disable type-aware linting by default for speed
63
+ extraFileExtensions: ['.vue'],
64
+ },
65
+ },
66
+ rules: {
67
+ // TypeScript recommended rules (manually applied)
68
+ '@typescript-eslint/no-unused-vars': [
69
+ 'error',
70
+ {
71
+ argsIgnorePattern: '^_',
72
+ varsIgnorePattern: '^_',
73
+ caughtErrorsIgnorePattern: '^_',
74
+ },
75
+ ],
76
+ '@typescript-eslint/no-explicit-any': 'off',
77
+ '@typescript-eslint/no-non-null-assertion': 'warn',
78
+ '@typescript-eslint/consistent-type-imports': [
79
+ 'error',
80
+ {
81
+ prefer: 'type-imports',
82
+ disallowTypeAnnotations: false,
83
+ fixStyle: 'inline-type-imports',
84
+ },
85
+ ],
86
+ '@typescript-eslint/no-duplicate-imports': 'off',
87
+
88
+ // Explicitly disable type-aware rules that require parserOptions.project
89
+ '@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
90
+ '@typescript-eslint/await-thenable': 'off',
91
+ '@typescript-eslint/no-floating-promises': 'off',
92
+ '@typescript-eslint/no-misused-promises': 'off',
93
+ '@typescript-eslint/require-await': 'off',
94
+ '@typescript-eslint/no-unnecessary-type-assertion': 'off',
95
+
96
+ // Disable base rule as it conflicts with TS version
97
+ 'no-unused-vars': 'off',
98
+ 'no-unused-expressions': 'off',
99
+ },
100
+ },
101
+
102
+ // General quality rules
103
+ {
104
+ files: ['**/*.{js,mjs,cjs,ts,tsx,vue}'],
105
+ rules: {
106
+ // Correctness and quality
107
+ 'prefer-const': 'error',
108
+ 'no-debugger': 'error',
109
+ 'no-console': 'off',
110
+ 'no-var': 'error',
111
+ 'no-undef': 'error',
112
+ 'eqeqeq': ['error', 'always', { null: 'ignore' }],
113
+ 'no-constant-condition': 'error',
114
+ 'no-duplicate-imports': 'off',
115
+
116
+ // Vue 3 + <script setup> specific overrides
117
+ 'vue/multi-word-component-names': 'off',
118
+ 'vue/require-default-prop': 'off',
119
+ 'vue/no-v-html': 'warn',
120
+
121
+ // Disable pedantic template formatting rules
122
+ 'vue/max-attributes-per-line': 'off',
123
+ 'vue/singleline-html-element-content-newline': 'off',
124
+ 'vue/html-self-closing': 'off',
125
+ 'vue/html-indent': 'off',
126
+ },
127
+ },
128
+
129
+ // Ignore patterns
130
+ {
131
+ ignores: [
132
+ '**/node_modules/**',
133
+ '**/dist/**',
134
+ '**/build/**',
135
+ '**/.nuxt/**',
136
+ '**/.output/**',
137
+ '**/coverage/**',
138
+ '**/.vscode/**',
139
+ '**/.idea/**',
140
+ ],
141
+ },
142
+ ]
143
+
@@ -0,0 +1,4 @@
1
+ export default {
2
+ '*.{js,mjs,cjs,ts,mts,cts,vue}': ['eslint --fix', 'prettier --write'],
3
+ '*.{json,md,html,css,scss}': ['prettier --write'],
4
+ }
@@ -0,0 +1,3 @@
1
+ export default {
2
+ 'pre-commit': 'bunx --bun lint-staged',
3
+ }
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "@bagelink/lint-config",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "ESLint and Prettier configuration for Vue 3 + TypeScript projects",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/bageldb/lint-config.git"
9
+ },
10
+ "homepage": "https://github.com/bageldb/lint-config#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/bageldb/lint-config/issues"
13
+ },
14
+ "exports": {
15
+ "./eslint": "./eslint/index.js",
16
+ "./eslint/vue3": "./eslint/vue3.js",
17
+ "./prettier": "./prettier/index.cjs",
18
+ "./prettierignore": "./prettier/.prettierignore",
19
+ "./editorconfig": "./editorconfig/.editorconfig",
20
+ "./lint-staged": "./git-hooks/lint-staged.config.js",
21
+ "./git-hooks": "./git-hooks/simple-git-hooks.config.js",
22
+ "./tsconfig": "./tsconfig/tsconfig.json",
23
+ "./tsconfig/app": "./tsconfig/tsconfig.app.json",
24
+ "./tsconfig/node": "./tsconfig/tsconfig.node.json",
25
+ "./vscode/settings": "./vscode/settings.json",
26
+ "./vscode/extensions": "./vscode/extensions.json"
27
+ },
28
+ "bin": {
29
+ "bagel-lint-setup": "./scripts/setup.js"
30
+ },
31
+ "peerDependencies": {
32
+ "@eslint/js": "^9.0.0",
33
+ "eslint": "^9.0.0",
34
+ "eslint-config-prettier": "^9.0.0",
35
+ "eslint-plugin-vue": "^9.0.0",
36
+ "globals": "^15.0.0",
37
+ "prettier": "^3.0.0",
38
+ "typescript": "^5.0.0",
39
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
40
+ "@typescript-eslint/parser": "^8.0.0",
41
+ "vue-eslint-parser": "^9.0.0"
42
+ },
43
+ "devDependencies": {
44
+ "@eslint/js": "^9.17.0",
45
+ "eslint": "^9.17.0",
46
+ "eslint-config-prettier": "^9.1.0",
47
+ "eslint-plugin-vue": "^9.31.0",
48
+ "globals": "^15.13.0",
49
+ "prettier": "^3.4.2",
50
+ "typescript": "^5.7.2",
51
+ "@typescript-eslint/eslint-plugin": "^8.18.2",
52
+ "@typescript-eslint/parser": "^8.18.2",
53
+ "vue-eslint-parser": "^9.4.3"
54
+ },
55
+ "keywords": [
56
+ "eslint",
57
+ "prettier",
58
+ "vue",
59
+ "vue3",
60
+ "typescript",
61
+ "lint-config"
62
+ ],
63
+ "files": [
64
+ "eslint",
65
+ "prettier",
66
+ "editorconfig",
67
+ "git-hooks",
68
+ "scripts",
69
+ "tsconfig",
70
+ "vscode",
71
+ "README.md"
72
+ ],
73
+ "license": "MIT",
74
+ "scripts": {
75
+ "lint": "eslint . --max-warnings=0",
76
+ "format": "prettier . --write",
77
+ "format:check": "prettier . --check"
78
+ }
79
+ }
@@ -0,0 +1,37 @@
1
+ # Dependencies
2
+ node_modules
3
+ bun.lock
4
+ package-lock.json
5
+ yarn.lock
6
+ pnpm-lock.yaml
7
+
8
+ # Build outputs
9
+ dist
10
+ build
11
+ .output
12
+ .vite
13
+ .cache
14
+
15
+ # IDE
16
+ .vscode
17
+ .idea
18
+ *.suo
19
+ *.ntvs*
20
+ *.njsproj
21
+ *.sln
22
+ *.sw?
23
+
24
+ # Public assets
25
+ public
26
+
27
+ # Generated files
28
+ *.min.js
29
+ *.min.css
30
+
31
+ # Bagel specific
32
+ **/bagelink/packages/**
33
+
34
+ # Config files (handled by linter)
35
+ .eslintrc*
36
+ .prettierrc*
37
+
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ printWidth: 100,
3
+ singleQuote: true,
4
+ semi: false,
5
+ trailingComma: 'all',
6
+ arrowParens: 'always',
7
+ endOfLine: 'lf',
8
+ tabWidth: 2,
9
+ useTabs: false,
10
+
11
+ // Vue-specific settings
12
+ vueIndentScriptAndStyle: false,
13
+ }
14
+
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'fs'
3
+ import path from 'path'
4
+ import { fileURLToPath } from 'url'
5
+ import { execSync } from 'child_process'
6
+
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
8
+
9
+ // Parse command line arguments
10
+ const args = process.argv.slice(2)
11
+ const forceOverwrite = args.includes('--force') || args.includes('-f')
12
+ const upgrade = args.includes('--upgrade') || args.includes('--update') || args.includes('-u')
13
+
14
+ // If upgrade flag is set, update the package first
15
+ if (upgrade) {
16
+ console.log('🔄 Updating @bagelink/lint-config from GitHub...\n')
17
+
18
+ try {
19
+ // Detect package manager
20
+ const hasBun = fs.existsSync('bun.lockb')
21
+ const hasYarn = fs.existsSync('yarn.lock')
22
+ const hasPnpm = fs.existsSync('pnpm-lock.yaml')
23
+
24
+ let updateCmd
25
+ if (hasBun) {
26
+ updateCmd = 'bun update @bagelink/lint-config'
27
+ } else if (hasYarn) {
28
+ updateCmd = 'yarn upgrade @bagelink/lint-config'
29
+ } else if (hasPnpm) {
30
+ updateCmd = 'pnpm update @bagelink/lint-config'
31
+ } else {
32
+ updateCmd = 'npm update @bagelink/lint-config'
33
+ }
34
+
35
+ console.log(` Running: ${updateCmd}\n`)
36
+ execSync(updateCmd, { stdio: 'inherit' })
37
+ console.log('\n✅ Package updated!\n')
38
+ } catch (error) {
39
+ console.error('❌ Failed to update package:', error.message)
40
+ process.exit(1)
41
+ }
42
+ }
43
+
44
+ // Files to copy
45
+ const filesToCopy = [
46
+ {
47
+ src: path.join(__dirname, '../prettier/.prettierignore'),
48
+ dest: path.join(process.cwd(), '.prettierignore'),
49
+ },
50
+ {
51
+ src: path.join(__dirname, '../editorconfig/.editorconfig'),
52
+ dest: path.join(process.cwd(), '.editorconfig'),
53
+ },
54
+ {
55
+ src: path.join(__dirname, '../tsconfig/tsconfig.json'),
56
+ dest: path.join(process.cwd(), 'tsconfig.json'),
57
+ },
58
+ {
59
+ src: path.join(__dirname, '../tsconfig/tsconfig.app.json'),
60
+ dest: path.join(process.cwd(), 'tsconfig.app.json'),
61
+ },
62
+ {
63
+ src: path.join(__dirname, '../tsconfig/tsconfig.node.json'),
64
+ dest: path.join(process.cwd(), 'tsconfig.node.json'),
65
+ },
66
+ {
67
+ src: path.join(__dirname, '../vscode/settings.json'),
68
+ dest: path.join(process.cwd(), '.vscode/settings.json'),
69
+ },
70
+ {
71
+ src: path.join(__dirname, '../vscode/extensions.json'),
72
+ dest: path.join(process.cwd(), '.vscode/extensions.json'),
73
+ },
74
+ ]
75
+
76
+ console.log('📦 Setting up @bagelink/lint-config...\n')
77
+
78
+ if (upgrade || forceOverwrite) {
79
+ console.log('⚠️ Force mode enabled - will overwrite existing files\n')
80
+ }
81
+
82
+ let copied = 0
83
+ let skipped = 0
84
+ let overwritten = 0
85
+
86
+ filesToCopy.forEach(({ src, dest }) => {
87
+ try {
88
+ // Create parent directory if it doesn't exist
89
+ const destDir = path.dirname(dest)
90
+ if (!fs.existsSync(destDir)) {
91
+ fs.mkdirSync(destDir, { recursive: true })
92
+ }
93
+
94
+ const exists = fs.existsSync(dest)
95
+
96
+ if (!exists) {
97
+ fs.copyFileSync(src, dest)
98
+ console.log(`✅ Copied ${path.basename(dest)}`)
99
+ copied++
100
+ } else if (forceOverwrite || upgrade) {
101
+ fs.copyFileSync(src, dest)
102
+ console.log(`🔄 Overwrote ${path.basename(dest)}`)
103
+ overwritten++
104
+ } else {
105
+ console.log(`⏭️ Skipped ${path.basename(dest)} (already exists)`)
106
+ skipped++
107
+ }
108
+ } catch (error) {
109
+ console.warn(`⚠️ Failed to copy ${path.basename(dest)}:`, error.message)
110
+ }
111
+ })
112
+
113
+ console.log('\n✨ Setup complete!')
114
+ console.log(` ${copied} copied, ${overwritten} overwritten, ${skipped} skipped\n`)
115
+
116
+ if (skipped > 0 && !forceOverwrite && !upgrade) {
117
+ console.log('💡 Tip: Use --force to overwrite existing files or --upgrade to update from GitHub')
118
+ console.log(' bunx bagel-lint-setup --force')
119
+ console.log(' bunx bagel-lint-setup --upgrade\n')
120
+ }
121
+
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "target": "ES2020",
6
+ "module": "ESNext",
7
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
8
+ "skipLibCheck": true,
9
+ "moduleResolution": "bundler",
10
+ "allowImportingTsExtensions": true,
11
+ "resolveJsonModule": true,
12
+ "isolatedModules": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true,
15
+ "jsx": "preserve",
16
+ "strict": true,
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": true,
19
+ "noFallthroughCasesInSwitch": true,
20
+ "paths": {
21
+ "@/*": ["./src/*"]
22
+ },
23
+ "types": []
24
+ },
25
+ "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
26
+ "exclude": ["**/node_modules", "**/.*"]
27
+ }
28
+
@@ -0,0 +1,6 @@
1
+ {
2
+ "files": [],
3
+ "references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }],
4
+ "exclude": ["node_modules"]
5
+ }
6
+
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
5
+ "target": "ES2022",
6
+ "module": "ESNext",
7
+ "lib": ["ES2023"],
8
+ "skipLibCheck": true,
9
+ "moduleResolution": "bundler",
10
+ "allowImportingTsExtensions": true,
11
+ "resolveJsonModule": true,
12
+ "isolatedModules": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true,
15
+ "strict": true,
16
+ "noUnusedLocals": true,
17
+ "noUnusedParameters": true,
18
+ "noFallthroughCasesInSwitch": true,
19
+ "types": ["node"]
20
+ },
21
+ "include": ["vite.config.ts"]
22
+ }
23
+
@@ -0,0 +1,8 @@
1
+ {
2
+ "recommendations": [
3
+ "esbenp.prettier-vscode",
4
+ "dbaeumer.vscode-eslint",
5
+ "vue.volar",
6
+ "vue.vscode-typescript-vue-plugin"
7
+ ]
8
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll.eslint": "explicit"
6
+ },
7
+ "eslint.enable": true,
8
+ "eslint.useFlatConfig": true,
9
+ "eslint.validate": [
10
+ "javascript",
11
+ "javascriptreact",
12
+ "typescript",
13
+ "typescriptreact",
14
+ "vue"
15
+ ],
16
+ "[javascript]": {
17
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
18
+ },
19
+ "[javascriptreact]": {
20
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
21
+ },
22
+ "[typescript]": {
23
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
24
+ },
25
+ "[typescriptreact]": {
26
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
27
+ },
28
+ "[vue]": {
29
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
30
+ },
31
+ "[json]": {
32
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
33
+ }
34
+ }
35
+