@gesslar/uglier 2.3.0 → 2.4.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/package.json +3 -2
- package/src/types/uglier.d.ts +4 -2
- package/src/uglier.js +67 -6
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "gesslar",
|
|
6
6
|
"url": "https://gesslar.dev"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.4.0",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/gesslar/uglier.git"
|
|
@@ -61,11 +61,12 @@
|
|
|
61
61
|
"@gesslar/toolkit": ">=4.4.0",
|
|
62
62
|
"@skarab/detect-package-manager": ">=1.0.0",
|
|
63
63
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
64
|
+
"eslint-plugin-astro": "^1.6.0",
|
|
64
65
|
"eslint-plugin-jsdoc": ">=62.8.1",
|
|
65
66
|
"globals": ">=17.4.0"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
|
-
"@gesslar/uglier": ">=2.
|
|
69
|
+
"@gesslar/uglier": ">=2.3.1",
|
|
69
70
|
"eslint": ">=10.1.0",
|
|
70
71
|
"typescript": "^6.0.2"
|
|
71
72
|
}
|
package/src/types/uglier.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export const availableConfigs: Array<ConfigName>;
|
|
|
14
14
|
/**
|
|
15
15
|
* Available config block names
|
|
16
16
|
*/
|
|
17
|
-
export type ConfigName = "lints-js" | "lints-jsdoc" | "languageOptions" | "web" | "node" | "react" | "tauri" | "vscode-extension" | "cjs-override" | "mjs-override";
|
|
17
|
+
export type ConfigName = "lints-js" | "lints-jsdoc" | "languageOptions" | "web" | "node" | "react" | "docusaurus" | "starlight" | "tauri" | "vscode-extension" | "cjs-override" | "mjs-override";
|
|
18
18
|
/**
|
|
19
19
|
* ESLint rule severity or configuration
|
|
20
20
|
*/
|
|
@@ -128,6 +128,8 @@ export type PerConfigOptions = {
|
|
|
128
128
|
web?: EnvironmentOptions;
|
|
129
129
|
node?: EnvironmentOptions;
|
|
130
130
|
react?: EnvironmentOptions;
|
|
131
|
+
docusaurus?: EnvironmentOptions;
|
|
132
|
+
starlight?: EnvironmentOptions;
|
|
131
133
|
tauri?: EnvironmentOptions;
|
|
132
134
|
"vscode-extension"?: EnvironmentOptions;
|
|
133
135
|
"cjs-override"?: ModuleOverrideOptions;
|
|
@@ -161,7 +163,7 @@ export type FlatConfig = {
|
|
|
161
163
|
/**
|
|
162
164
|
* - Glob patterns for files this config applies to
|
|
163
165
|
*/
|
|
164
|
-
files?: Array<string>;
|
|
166
|
+
files?: Array<string | string[]>;
|
|
165
167
|
/**
|
|
166
168
|
* - Glob patterns for files to ignore
|
|
167
169
|
*/
|
package/src/uglier.js
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
/**
|
|
78
78
|
* Available config block names
|
|
79
79
|
*
|
|
80
|
-
* @typedef {"lints-js" | "lints-jsdoc" | "languageOptions" | "web" | "node" | "react" | "tauri" | "vscode-extension" | "cjs-override" | "mjs-override"} ConfigName
|
|
80
|
+
* @typedef {"lints-js" | "lints-jsdoc" | "languageOptions" | "web" | "node" | "react" | "docusaurus" | "starlight" | "tauri" | "vscode-extension" | "cjs-override" | "mjs-override"} ConfigName
|
|
81
81
|
*/
|
|
82
82
|
|
|
83
83
|
/**
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
/**
|
|
142
142
|
* Per-config options map
|
|
143
143
|
*
|
|
144
|
-
* @typedef {{"lints-js"?: LintsJsOptions, "lints-jsdoc"?: LintsJsdocOptions, languageOptions?: LanguageOptionsOptions, web?: EnvironmentOptions, node?: EnvironmentOptions, react?: EnvironmentOptions, tauri?: EnvironmentOptions, "vscode-extension"?: EnvironmentOptions, "cjs-override"?: ModuleOverrideOptions, "mjs-override"?: ModuleOverrideOptions}} PerConfigOptions
|
|
144
|
+
* @typedef {{"lints-js"?: LintsJsOptions, "lints-jsdoc"?: LintsJsdocOptions, languageOptions?: LanguageOptionsOptions, web?: EnvironmentOptions, node?: EnvironmentOptions, react?: EnvironmentOptions, docusaurus?: EnvironmentOptions, starlight?: EnvironmentOptions, tauri?: EnvironmentOptions, "vscode-extension"?: EnvironmentOptions, "cjs-override"?: ModuleOverrideOptions, "mjs-override"?: ModuleOverrideOptions}} PerConfigOptions
|
|
145
145
|
*/
|
|
146
146
|
|
|
147
147
|
/**
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
*
|
|
159
159
|
* @typedef {object} FlatConfig
|
|
160
160
|
* @property {string} [name] - Config name for debugging
|
|
161
|
-
* @property {Array<string>} [files] - Glob patterns for files this config applies to
|
|
161
|
+
* @property {Array<string | string[]>} [files] - Glob patterns for files this config applies to
|
|
162
162
|
* @property {Array<string>} [ignores] - Glob patterns for files to ignore
|
|
163
163
|
* @property {{[pluginName: string]: object}} [plugins] - ESLint plugins
|
|
164
164
|
* @property {{[ruleName: string]: RuleEntry}} [rules] - ESLint rules
|
|
@@ -167,6 +167,7 @@
|
|
|
167
167
|
*/
|
|
168
168
|
|
|
169
169
|
import jsdoc from "eslint-plugin-jsdoc"
|
|
170
|
+
import astro from "eslint-plugin-astro"
|
|
170
171
|
import stylistic from "@stylistic/eslint-plugin"
|
|
171
172
|
import globals from "globals"
|
|
172
173
|
|
|
@@ -174,7 +175,7 @@ import globals from "globals"
|
|
|
174
175
|
* Registry of named configuration blocks.
|
|
175
176
|
* Each config is a factory function that returns an ESLint flat config object.
|
|
176
177
|
*
|
|
177
|
-
* @type {{[K in ConfigName]: (options?: object) => FlatConfig}}
|
|
178
|
+
* @type {{[K in ConfigName]: (options?: object) => FlatConfig | Array<FlatConfig>}}
|
|
178
179
|
*/
|
|
179
180
|
const CONFIGS = {
|
|
180
181
|
/**
|
|
@@ -241,7 +242,7 @@ const CONFIGS = {
|
|
|
241
242
|
from: {before: true, after: true},
|
|
242
243
|
async: {before: true, after: true},
|
|
243
244
|
await: {before: true, after: false},
|
|
244
|
-
with: {before: true, after:
|
|
245
|
+
with: {before: true, after: true},
|
|
245
246
|
class: {before: true, after: true},
|
|
246
247
|
const: {before: true, after: true},
|
|
247
248
|
let: {before: true, after: true},
|
|
@@ -512,6 +513,63 @@ const CONFIGS = {
|
|
|
512
513
|
}
|
|
513
514
|
},
|
|
514
515
|
|
|
516
|
+
/**
|
|
517
|
+
* Docusaurus documentation site globals (browser + React + Docusaurus)
|
|
518
|
+
*
|
|
519
|
+
* @param {EnvironmentOptions} options - Configuration options
|
|
520
|
+
* @returns {FlatConfig} ESLint flat config object
|
|
521
|
+
*/
|
|
522
|
+
"docusaurus": (options = {}) => {
|
|
523
|
+
const {
|
|
524
|
+
files = ["src/**/*.{js,jsx,mjs,cjs}", "docs/**/*.{js,jsx,mjs,cjs}"],
|
|
525
|
+
ignores = [],
|
|
526
|
+
additionalGlobals = {},
|
|
527
|
+
} = options
|
|
528
|
+
|
|
529
|
+
return {
|
|
530
|
+
name: "gesslar/uglier/docusaurus",
|
|
531
|
+
files: Array.isArray(files) ? files : [files],
|
|
532
|
+
ignores: Array.isArray(ignores) ? ignores : [ignores],
|
|
533
|
+
languageOptions: {
|
|
534
|
+
globals: {
|
|
535
|
+
...globals.browser,
|
|
536
|
+
React: "readonly",
|
|
537
|
+
ReactDOM: "readonly",
|
|
538
|
+
...additionalGlobals,
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Starlight documentation site (browser + Astro + eslint-plugin-astro)
|
|
546
|
+
*
|
|
547
|
+
* @param {EnvironmentOptions} options - Configuration options
|
|
548
|
+
* @returns {Array<FlatConfig>} ESLint flat config array
|
|
549
|
+
*/
|
|
550
|
+
"starlight": (options = {}) => {
|
|
551
|
+
const {
|
|
552
|
+
files = ["src/**/*.{js,mjs,cjs}", "docs/**/*.{js,mjs,cjs}"],
|
|
553
|
+
ignores = [],
|
|
554
|
+
additionalGlobals = {},
|
|
555
|
+
} = options
|
|
556
|
+
|
|
557
|
+
return [
|
|
558
|
+
...astro.configs["flat/recommended"],
|
|
559
|
+
{
|
|
560
|
+
name: "gesslar/uglier/starlight",
|
|
561
|
+
files: Array.isArray(files) ? files : [files],
|
|
562
|
+
ignores: Array.isArray(ignores) ? ignores : [ignores],
|
|
563
|
+
languageOptions: {
|
|
564
|
+
globals: {
|
|
565
|
+
...globals.browser,
|
|
566
|
+
...additionalGlobals,
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
]
|
|
571
|
+
},
|
|
572
|
+
|
|
515
573
|
/**
|
|
516
574
|
* Tauri application configuration (browser + Tauri APIs, no Node.js)
|
|
517
575
|
*
|
|
@@ -570,7 +628,10 @@ export default function(options = {}) {
|
|
|
570
628
|
const configOptions = perConfigOptions[configName] || {}
|
|
571
629
|
const config = CONFIGS[configName](configOptions)
|
|
572
630
|
|
|
573
|
-
|
|
631
|
+
if(Array.isArray(config))
|
|
632
|
+
configs.push(...config)
|
|
633
|
+
else
|
|
634
|
+
configs.push(config)
|
|
574
635
|
}
|
|
575
636
|
|
|
576
637
|
return configs
|