@gesslar/uglier 1.6.2 → 2.0.1

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/README.md CHANGED
@@ -47,7 +47,10 @@ npx @gesslar/uglier add react
47
47
 
48
48
  This automatically installs `@gesslar/uglier`, `eslint`, and all dependencies.
49
49
 
50
- **Package Manager Support:** Automatically detects and uses your preferred package manager (npm, pnpm, yarn, or Bun). Use `pnpx`, `yarn dlx`, or `bunx` instead of `npx` - the installer will detect your choice and install packages accordingly.
50
+ **Package Manager Support:** Automatically detects and uses your preferred
51
+ package manager (npm, pnpm, yarn, or Bun). Use `pnpx`, `yarn dlx`, or `bunx`
52
+ instead of `npx` - the installer will detect your choice and install packages
53
+ accordingly.
51
54
 
52
55
  ## Usage
53
56
 
@@ -61,9 +64,9 @@ import uglify from "@gesslar/uglier"
61
64
  export default [
62
65
  ...uglify({
63
66
  with: [
64
- "lints-js", // default files: ["**/*.{js,mjs,cjs}"]
65
- "lints-jsdoc", // default files: ["**/*.{js,mjs,cjs}"]
66
- "node", // default files: ["**/*.{js,mjs,cjs}"]
67
+ "lints-js", // default files: ["src/**/*.{js,mjs,cjs}"]
68
+ "lints-jsdoc", // default files: ["src/**/*.{js,mjs,cjs}"]
69
+ "node", // default files: ["src/**/*.{js,mjs,cjs}"]
67
70
  ]
68
71
  })
69
72
  ]
@@ -97,7 +100,7 @@ export default [
97
100
  export default [
98
101
  ...uglify({
99
102
  with: ["lints-js", "node", "web"],
100
- overrides: {
103
+ options: {
101
104
  "node": { files: ["server/**/*.js"] },
102
105
  "web": { files: ["client/**/*.js"] }
103
106
  }
@@ -111,7 +114,7 @@ export default [
111
114
  export default [
112
115
  ...uglify({
113
116
  with: ["lints-js"],
114
- overrides: {
117
+ options: {
115
118
  "lints-js": {
116
119
  indent: 4, // default: 2
117
120
  maxLen: 120, // default: 80
@@ -156,7 +159,8 @@ export default [
156
159
  - **`cjs-override`** - CommonJS file handling (`.cjs`)
157
160
  - **`mjs-override`** - ES Module file handling (`.mjs`)
158
161
 
159
- Run `npx @gesslar/uglier --help` to see all available configs with descriptions.
162
+ Run `npx @gesslar/uglier --help` to see all available configs with
163
+ descriptions.
160
164
 
161
165
  ## Commands
162
166
 
@@ -177,7 +181,7 @@ npx @gesslar/uglier add tauri vscode-extension # Multiple targets
177
181
  # Remove config blocks from existing eslint.config.js
178
182
  npx @gesslar/uglier remove react
179
183
  npx @gesslar/uglier remove web tauri # Multiple targets
180
- # Note: Also removes any overrides for removed targets
184
+ # Note: Also removes any options for removed targets
181
185
 
182
186
  # Show available configs
183
187
  npx @gesslar/uglier --help
@@ -206,7 +210,8 @@ yarn add -D @gesslar/uglier eslint
206
210
  bun add -d @gesslar/uglier eslint
207
211
  ```
208
212
 
209
- Note: `@stylistic/eslint-plugin`, `eslint-plugin-jsdoc`, and `globals` are bundled as dependencies.
213
+ Note: `@stylistic/eslint-plugin`, `eslint-plugin-jsdoc`, and `globals` are
214
+ bundled as dependencies.
210
215
 
211
216
  ## Development
212
217
 
@@ -227,11 +232,38 @@ This config enforces:
227
232
 
228
233
  - **Readable spacing** - Blank lines between control structures
229
234
  - **Consistent style** - Double quotes, no semicolons, 2-space indent
230
- - **Flexible customization** - Override anything via the `overrides` option
231
- - **Composability** - Mix configs for different file patterns in the same project
235
+ - **Flexible customization** - Override anything via the `options` key
236
+ - **Composability** - Mix configs for different file patterns in the same
237
+ project
232
238
 
233
- It's opinionated, but you can override any rule. The defaults just happen to be correct. 😉
239
+ It's opinionated, but you can override any rule. The defaults just happen to be
240
+ correct. 😉
241
+
242
+ ## Post Chips Ahoy
243
+
244
+ If you love code and want to support it, you should write code or hug a coder,
245
+ but maybe not physically, just emotionally, because they're busy, or instead of
246
+ telling the coder to go out and touch grass, maybe go out and touch the grass
247
+ for them and then come back and not tell them about it because first, charity
248
+ for charity's sake is its own reward and how dare you to try to cash in on your
249
+ good deeds when the entire point of doing the good deed is ... ok so, if you're
250
+ _not_ a coder, this is called recursion; but the better reason is, as stated,
251
+ they're busy. So, thanks. At the very least you can put it in Workday and claim
252
+ it, you good-deed profiteer.
234
253
 
235
254
  ## License
236
255
 
237
- [Unlicense](https://unlicense.org/) - Public domain. Do whatever you want.
256
+ uglier is released into the public domain under the
257
+ [Unlicense](UNLICENSE.txt).
258
+
259
+ This package includes or depends on third-party components under their own
260
+ licenses:
261
+
262
+ | Dependency | License |
263
+ | --- | --- |
264
+ | [@gesslar/colours](https://github.com/gesslar/colours) | Unlicense |
265
+ | [@gesslar/toolkit](https://github.com/gesslar/toolkit) | Unlicense |
266
+ | [@skarab/detect-package-manager](https://github.com/skarab42/detect-package-manager) | MIT |
267
+ | [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic) | MIT |
268
+ | [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) | BSD-3-Clause |
269
+ | [globals](https://github.com/sindresorhus/globals) | MIT |
package/bin/cli.js CHANGED
@@ -117,15 +117,13 @@ export async function getAvailableConfigs() {
117
117
 
118
118
  let uglierFile = null
119
119
 
120
- if(await localSource.exists) {
120
+ if(await localSource.exists)
121
121
  uglierFile = localSource
122
- } else if(await installedSource.exists) {
122
+ else if(await installedSource.exists)
123
123
  uglierFile = installedSource
124
- }
125
124
 
126
- if(!uglierFile) {
125
+ if(!uglierFile)
127
126
  return null
128
- }
129
127
 
130
128
  const source = await uglierFile.read()
131
129
 
@@ -162,6 +160,7 @@ export async function install() {
162
160
 
163
161
  console.log(c`{F244}Using package manager: ${manager}{/}`)
164
162
  console.log(c`{F244}Running: ${fullCmd}{/}`)
163
+
165
164
  exec(fullCmd)
166
165
 
167
166
  console.log()
@@ -395,7 +394,7 @@ export async function addToConfig(targets = []) {
395
394
  * Remove config blocks from existing eslint.config.js
396
395
  *
397
396
  * @param {Array<string>} targets - Target environments to remove (node, web, react, etc.)
398
- * @returns {Promise<{success: boolean, removedTargets: Array<string>, removedOverrides: Array<string>}>} Result info
397
+ * @returns {Promise<{success: boolean, removedTargets: Array<string>, removedOptions: Array<string>}>} Result info
399
398
  */
400
399
  export async function removeFromConfig(targets = []) {
401
400
  const cwd = DirectoryObject.fromCwd()
@@ -405,7 +404,7 @@ export async function removeFromConfig(targets = []) {
405
404
  console.log(c`{F214}Error:{/} {<B}eslint.config.js{B>} not found`)
406
405
  console.log(c`Use {<B}npx @gesslar/uglier init <targets>{B>} to create one first`)
407
406
 
408
- return {success: false, removedTargets: [], removedOverrides: []}
407
+ return {success: false, removedTargets: [], removedOptions: []}
409
408
  }
410
409
 
411
410
  // Get available configs dynamically
@@ -423,7 +422,7 @@ export async function removeFromConfig(targets = []) {
423
422
  console.log()
424
423
  console.log(c`{F244}Example: npx @gesslar/uglier remove react{/}`)
425
424
 
426
- return {success: false, removedTargets: [], removedOverrides: []}
425
+ return {success: false, removedTargets: [], removedOptions: []}
427
426
  }
428
427
 
429
428
  // Read existing config
@@ -436,7 +435,7 @@ export async function removeFromConfig(targets = []) {
436
435
  console.log(c`{F214}Error:{/} Could not parse existing config`)
437
436
  console.log(c`The config file may have a non-standard format`)
438
437
 
439
- return {success: false, removedTargets: [], removedOverrides: []}
438
+ return {success: false, removedTargets: [], removedOptions: []}
440
439
  }
441
440
 
442
441
  // Find which targets exist and can be removed
@@ -452,7 +451,7 @@ export async function removeFromConfig(targets = []) {
452
451
  console.log()
453
452
  console.log(c`Current targets: ${existingTargets.map(t => c`{F070}${t}{/}`).join(", ")}`)
454
453
 
455
- return {success: false, removedTargets: [], removedOverrides: []}
454
+ return {success: false, removedTargets: [], removedOptions: []}
456
455
  }
457
456
 
458
457
  // Build new with array content without the removed targets
@@ -489,11 +488,11 @@ export async function removeFromConfig(targets = []) {
489
488
  `with: [\n${newLines.join("\n")}\n ]`
490
489
  )
491
490
 
492
- // Check for and remove overrides for removed targets
493
- const removedOverrides = []
494
- const overridesMatch = newContent.match(/overrides:\s*\{/m)
491
+ // Check for and remove options for removed targets
492
+ const removedOptions = []
493
+ const optionsMatch = newContent.match(/options:\s*\{/m)
495
494
 
496
- if(overridesMatch) {
495
+ if(optionsMatch) {
497
496
  for(const target of targetsToRemove) {
498
497
  // Find the start of this target's override entry
499
498
  const targetPattern = new RegExp(`[\\s,]*(?:\\/\\/[^\\n]*\\n\\s*)?["']${target}["']:\\s*\\{`)
@@ -525,7 +524,7 @@ export async function removeFromConfig(targets = []) {
525
524
  }
526
525
 
527
526
  if(blockEnd !== -1) {
528
- removedOverrides.push(target)
527
+ removedOptions.push(target)
529
528
  newContent = newContent.slice(0, blockStart)
530
529
  + newContent.slice(blockEnd)
531
530
  }
@@ -537,9 +536,9 @@ export async function removeFromConfig(targets = []) {
537
536
  /\}(\s*["'][\w-]+["']:\s*\{)/g, "},$1"
538
537
  )
539
538
 
540
- // Clean up empty overrides object or trailing commas
539
+ // Clean up empty options object or trailing commas
541
540
  newContent = newContent.replace(
542
- /overrides:\s*\{\s*,?\s*\}/m, ""
541
+ /options:\s*\{\s*,?\s*\}/m, ""
543
542
  )
544
543
  newContent = newContent.replace(/,(\s*)\}/g, "$1}")
545
544
  }
@@ -554,11 +553,11 @@ export async function removeFromConfig(targets = []) {
554
553
  console.log(c` {F070}•{/} ${target}`)
555
554
  }
556
555
 
557
- if(removedOverrides.length > 0) {
556
+ if(removedOptions.length > 0) {
558
557
  console.log()
559
- console.log(c`{F039}Also removed overrides for:{/}`)
558
+ console.log(c`{F039}Also removed options for:{/}`)
560
559
 
561
- for(const target of removedOverrides) {
560
+ for(const target of removedOptions) {
562
561
  console.log(c` {F070}•{/} ${target}`)
563
562
  }
564
563
  }
@@ -568,7 +567,7 @@ export async function removeFromConfig(targets = []) {
568
567
  console.log()
569
568
  console.log(c`{F244}Run {<B}${eslintCmd}{B>} to lint your project{/}`)
570
569
 
571
- return {success: true, removedTargets: targetsToRemove, removedOverrides}
570
+ return {success: true, removedTargets: targetsToRemove, removedOptions}
572
571
  }
573
572
 
574
573
  /**
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "gesslar",
6
6
  "url": "https://gesslar.dev"
7
7
  },
8
- "version": "1.6.2",
8
+ "version": "2.0.1",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/gesslar/uglier.git"
@@ -49,14 +49,14 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@gesslar/colours": ">=0.8.0",
52
- "@gesslar/toolkit": ">=3.37.0",
52
+ "@gesslar/toolkit": ">=4.1.0",
53
53
  "@skarab/detect-package-manager": ">=1.0.0",
54
- "@stylistic/eslint-plugin": "^5.9.0",
55
- "eslint-plugin-jsdoc": ">=62.6.1",
56
- "globals": ">=17.3.0"
54
+ "@stylistic/eslint-plugin": "^5.10.0",
55
+ "eslint-plugin-jsdoc": ">=62.7.1",
56
+ "globals": ">=17.4.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@gesslar/uglier": ">=1.4.1",
60
- "eslint": ">=10.0.0"
59
+ "@gesslar/uglier": ">=2.0.0",
60
+ "eslint": ">=10.0.3"
61
61
  }
62
62
  }
package/src/uglier.js CHANGED
@@ -23,7 +23,7 @@
23
23
  * export default [
24
24
  * ...uglify({
25
25
  * with: ["lints-js", "lints-jsdoc", "tauri"],
26
- * overrides: {
26
+ * options: {
27
27
  * "lints-js": { files: ["src/**\/*.js"] },
28
28
  * "tauri": { files: ["src/**\/*.js"] }
29
29
  * }
@@ -48,7 +48,7 @@
48
48
  * export default [
49
49
  * ...uglify({
50
50
  * with: ["lints-js"],
51
- * overrides: {
51
+ * options: {
52
52
  * "lints-js": {
53
53
  * indent: 4,
54
54
  * maxLen: 120,
@@ -93,7 +93,8 @@ const CONFIGS = {
93
93
  */
94
94
  "lints-js": (options = {}) => {
95
95
  const {
96
- files = ["**/*.{js,mjs,cjs}"],
96
+ files = ["src/**/*.{js,mjs,cjs}"],
97
+ ignores = [],
97
98
  indent = 2,
98
99
  maxLen = 80,
99
100
  overrides = {},
@@ -102,6 +103,7 @@ const CONFIGS = {
102
103
  return {
103
104
  name: "gesslar/uglier/lints-js",
104
105
  files: Array.isArray(files) ? files : [files],
106
+ ignores: Array.isArray(ignores) ? ignores : [ignores],
105
107
  plugins: {
106
108
  "@stylistic": stylistic,
107
109
  },
@@ -206,13 +208,15 @@ const CONFIGS = {
206
208
  */
207
209
  "lints-jsdoc": (options = {}) => {
208
210
  const {
209
- files = ["**/*.{js,mjs,cjs}"],
211
+ files = ["src/**/*.{js,mjs,cjs}"],
212
+ ignores = [],
210
213
  overrides = {},
211
214
  } = options
212
215
 
213
216
  return {
214
217
  name: "gesslar/uglier/lints-jsdoc",
215
218
  files: Array.isArray(files) ? files : [files],
219
+ ignores: Array.isArray(ignores) ? ignores : [ignores],
216
220
  plugins: {
217
221
  jsdoc,
218
222
  },
@@ -269,12 +273,14 @@ const CONFIGS = {
269
273
  "web": (options = {}) => {
270
274
  const {
271
275
  files = ["src/**/*.{js,mjs,cjs}"],
276
+ ignores = [],
272
277
  additionalGlobals = {},
273
278
  } = options
274
279
 
275
280
  return {
276
281
  name: "gesslar/uglier/web",
277
282
  files: Array.isArray(files) ? files : [files],
283
+ ignores: Array.isArray(ignores) ? ignores : [ignores],
278
284
  languageOptions: {
279
285
  globals: {
280
286
  ...globals.browser,
@@ -293,12 +299,14 @@ const CONFIGS = {
293
299
  "vscode-extension": (options = {}) => {
294
300
  const {
295
301
  files = ["src/**/*.{js,mjs,cjs}"],
302
+ ignores = [],
296
303
  additionalGlobals = {},
297
304
  } = options
298
305
 
299
306
  return {
300
307
  name: "gesslar/uglier/vscode-extension",
301
308
  files: Array.isArray(files) ? files : [files],
309
+ ignores: Array.isArray(ignores) ? ignores : [ignores],
302
310
  languageOptions: {
303
311
  globals: {
304
312
  acquireVsCodeApi: "readonly",
@@ -316,13 +324,15 @@ const CONFIGS = {
316
324
  */
317
325
  "node": (options = {}) => {
318
326
  const {
319
- files = ["**/*.{js,mjs,cjs}"],
327
+ files = ["src/**/*.{js,mjs,cjs}"],
328
+ ignores = [],
320
329
  additionalGlobals = {},
321
330
  } = options
322
331
 
323
332
  return {
324
333
  name: "gesslar/uglier/node",
325
334
  files: Array.isArray(files) ? files : [files],
335
+ ignores: Array.isArray(ignores) ? ignores : [ignores],
326
336
  languageOptions: {
327
337
  globals: {
328
338
  ...globals.node,
@@ -343,12 +353,14 @@ const CONFIGS = {
343
353
  "react": (options = {}) => {
344
354
  const {
345
355
  files = ["src/**/*.{js,jsx,mjs,cjs}"],
356
+ ignores = [],
346
357
  additionalGlobals = {},
347
358
  } = options
348
359
 
349
360
  return {
350
361
  name: "gesslar/uglier/react",
351
362
  files: Array.isArray(files) ? files : [files],
363
+ ignores: Array.isArray(ignores) ? ignores : [ignores],
352
364
  languageOptions: {
353
365
  globals: {
354
366
  ...globals.browser,
@@ -369,11 +381,13 @@ const CONFIGS = {
369
381
  "cjs-override": (options = {}) => {
370
382
  const {
371
383
  files = ["**/*.cjs"],
384
+ ignores = [],
372
385
  } = options
373
386
 
374
387
  return {
375
388
  name: "gesslar/uglier/cjs-override",
376
389
  files: Array.isArray(files) ? files : [files],
390
+ ignores: Array.isArray(ignores) ? ignores : [ignores],
377
391
  languageOptions: {
378
392
  sourceType: "script",
379
393
  ecmaVersion: 2021
@@ -390,11 +404,13 @@ const CONFIGS = {
390
404
  "mjs-override": (options = {}) => {
391
405
  const {
392
406
  files = ["**/*.mjs"],
407
+ ignores = [],
393
408
  } = options
394
409
 
395
410
  return {
396
411
  name: "gesslar/uglier/mjs-override",
397
412
  files: Array.isArray(files) ? files : [files],
413
+ ignores: Array.isArray(ignores) ? ignores : [ignores],
398
414
  languageOptions: {
399
415
  sourceType: "module",
400
416
  ecmaVersion: 2021
@@ -411,12 +427,14 @@ const CONFIGS = {
411
427
  "tauri": (options = {}) => {
412
428
  const {
413
429
  files = ["src/**/*.{js,mjs,cjs}"],
430
+ ignores = [],
414
431
  additionalGlobals = {},
415
432
  } = options
416
433
 
417
434
  return {
418
435
  name: "gesslar/uglier/tauri",
419
436
  files: Array.isArray(files) ? files : [files],
437
+ ignores: Array.isArray(ignores) ? ignores : [ignores],
420
438
  languageOptions: {
421
439
  globals: {
422
440
  ...globals.browser,
@@ -435,14 +453,14 @@ const CONFIGS = {
435
453
  * @param {object} options - Composition options
436
454
  * @param {string[]} [options.with] - Config names to include
437
455
  * @param {string[]} [options.without] - Config names to exclude (higher precedence)
438
- * @param {object} [options.overrides] - Per-config options overrides
456
+ * @param {object} [options.options] - Per-config options
439
457
  * @returns {Array} ESLint flat config array
440
458
  */
441
459
  export default function(options = {}) {
442
460
  const {
443
461
  with: includeConfigs = ["lints-js", "lints-jsdoc"],
444
462
  without: excludeConfigs = [],
445
- overrides = {},
463
+ options: perConfigOptions = {},
446
464
  } = options
447
465
 
448
466
  const configs = []
@@ -458,7 +476,7 @@ export default function(options = {}) {
458
476
  )
459
477
  }
460
478
 
461
- const configOptions = overrides[configName] || {}
479
+ const configOptions = perConfigOptions[configName] || {}
462
480
  const config = CONFIGS[configName](configOptions)
463
481
 
464
482
  configs.push(config)