@gesslar/uglier 0.0.7 → 0.0.9
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 +1 -60
- package/bin/install.js +6 -2
- package/package.json +17 -9
- package/src/uglier.js +15 -2
package/README.md
CHANGED
|
@@ -172,70 +172,11 @@ npx @gesslar/uglier --help
|
|
|
172
172
|
If you prefer manual control:
|
|
173
173
|
|
|
174
174
|
```bash
|
|
175
|
-
npm install
|
|
175
|
+
npm install -D @gesslar/uglier eslint
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
Note: `@stylistic/eslint-plugin`, `eslint-plugin-jsdoc`, and `globals` are bundled as dependencies.
|
|
179
179
|
|
|
180
|
-
## Advanced Integration
|
|
181
|
-
|
|
182
|
-
### ServiceNow Projects
|
|
183
|
-
|
|
184
|
-
ServiceNow development requires special handling because your code runs in two environments: the ServiceNow SDK tools use Node.js, but your application code runs on the ServiceNow Rhino engine (which doesn't support Node APIs).
|
|
185
|
-
|
|
186
|
-
The `@servicenow/eslint-plugin-sdk-app-plugin` uses the legacy `.eslintrc` format. To integrate it with `uglier`, you'll need the `FlatCompat` compatibility layer.
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
npm install --save-dev @eslint/eslintrc @servicenow/eslint-plugin-sdk-app-plugin
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
```js
|
|
193
|
-
import uglify from "@gesslar/uglier"
|
|
194
|
-
import {FlatCompat} from "@eslint/eslintrc"
|
|
195
|
-
import path from "path"
|
|
196
|
-
import {fileURLToPath} from "url"
|
|
197
|
-
import serviceNowPlugin from "@servicenow/eslint-plugin-sdk-app-plugin"
|
|
198
|
-
|
|
199
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
200
|
-
const __dirname = path.dirname(__filename)
|
|
201
|
-
const compat = new FlatCompat({baseDirectory: __dirname})
|
|
202
|
-
|
|
203
|
-
export default [
|
|
204
|
-
...uglify({
|
|
205
|
-
with: ["lints-js"],
|
|
206
|
-
overrides: {
|
|
207
|
-
"lints-js": {files: ["src/**/*.js"]}
|
|
208
|
-
}
|
|
209
|
-
}),
|
|
210
|
-
{
|
|
211
|
-
files: ["src/**/*.js"],
|
|
212
|
-
plugins: {"@servicenow/sdk-app-plugin": serviceNowPlugin}
|
|
213
|
-
},
|
|
214
|
-
...compat.extends("plugin:@servicenow/sdk-app-plugin/recommended")
|
|
215
|
-
]
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
The `FlatCompat` layer bridges legacy plugins into flat config. When ServiceNow releases a flat config version of their plugin, you can drop the compatibility layer and use it directly.
|
|
219
|
-
|
|
220
|
-
### Other Legacy Plugins
|
|
221
|
-
|
|
222
|
-
Many enterprise plugins haven't migrated to flat config yet. Use the same `FlatCompat` pattern:
|
|
223
|
-
|
|
224
|
-
```js
|
|
225
|
-
import {FlatCompat} from "@eslint/eslintrc"
|
|
226
|
-
import path from "path"
|
|
227
|
-
import {fileURLToPath} from "url"
|
|
228
|
-
|
|
229
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
230
|
-
const __dirname = path.dirname(__filename)
|
|
231
|
-
const compat = new FlatCompat({baseDirectory: __dirname})
|
|
232
|
-
|
|
233
|
-
export default [
|
|
234
|
-
...uglify({with: ["lints-js", "node"]}),
|
|
235
|
-
...compat.extends("plugin:legacy-plugin/recommended")
|
|
236
|
-
]
|
|
237
|
-
```
|
|
238
|
-
|
|
239
180
|
## Philosophy
|
|
240
181
|
|
|
241
182
|
This config enforces:
|
package/bin/install.js
CHANGED
|
@@ -40,6 +40,7 @@ const PEER_DEPS = [
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Execute a command and return output
|
|
43
|
+
*
|
|
43
44
|
* @param {string} cmd - Command to execute
|
|
44
45
|
* @returns {string} Command output
|
|
45
46
|
*/
|
|
@@ -55,6 +56,7 @@ function exec(cmd) {
|
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
58
|
* Get available configs from the source file
|
|
59
|
+
*
|
|
58
60
|
* @returns {Promise<Array<{name: string, description: string, files: string}>|null>} Available configs
|
|
59
61
|
*/
|
|
60
62
|
async function getAvailableConfigs() {
|
|
@@ -95,7 +97,7 @@ async function getAvailableConfigs() {
|
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
return configs
|
|
98
|
-
} catch
|
|
100
|
+
} catch {
|
|
99
101
|
return null
|
|
100
102
|
}
|
|
101
103
|
}
|
|
@@ -134,6 +136,7 @@ async function showHelp() {
|
|
|
134
136
|
|
|
135
137
|
/**
|
|
136
138
|
* Check if a package is already installed
|
|
139
|
+
*
|
|
137
140
|
* @param {string} packageName - Name of package to check
|
|
138
141
|
* @returns {Promise<boolean>} True if installed
|
|
139
142
|
*/
|
|
@@ -154,7 +157,7 @@ async function isInstalled(packageName) {
|
|
|
154
157
|
}
|
|
155
158
|
|
|
156
159
|
return packageName in allDeps
|
|
157
|
-
} catch
|
|
160
|
+
} catch {
|
|
158
161
|
return false
|
|
159
162
|
}
|
|
160
163
|
}
|
|
@@ -204,6 +207,7 @@ async function install() {
|
|
|
204
207
|
|
|
205
208
|
/**
|
|
206
209
|
* Generate eslint.config.js file
|
|
210
|
+
*
|
|
207
211
|
* @param {string[]} targets - Target environments (node, web, react, etc.)
|
|
208
212
|
*/
|
|
209
213
|
async function generateConfig(targets = []) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gesslar/uglier",
|
|
3
|
-
"version": "0.0.7",
|
|
4
3
|
"description": "Composable ESLint flat config blocks for stylistic, JSDoc, and environment presets.",
|
|
4
|
+
"author": "gesslar",
|
|
5
|
+
"version": "0.0.9",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/gesslar/uglier.git"
|
|
9
|
+
},
|
|
5
10
|
"type": "module",
|
|
6
11
|
"main": "src/uglier.js",
|
|
7
12
|
"exports": "./src/uglier.js",
|
|
@@ -24,23 +29,26 @@
|
|
|
24
29
|
"found",
|
|
25
30
|
"cat.gif"
|
|
26
31
|
],
|
|
27
|
-
"scripts": {
|
|
28
|
-
"submit": "npm login && npm publish --access public",
|
|
29
|
-
"update": "npx npm-check-updates -u && npm install",
|
|
30
|
-
"pr": "gt submit --publish --restack --ai"
|
|
31
|
-
},
|
|
32
32
|
"license": "Unlicense",
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"eslint": "^9.0.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@gesslar/colours": "^0.0.1",
|
|
38
|
-
"@gesslar/toolkit": "^
|
|
38
|
+
"@gesslar/toolkit": "^3.0.1",
|
|
39
39
|
"@stylistic/eslint-plugin": "^5.6.1",
|
|
40
40
|
"eslint-plugin-jsdoc": "^61.5.0",
|
|
41
41
|
"globals": "^16.5.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@gesslar/uglier": "^0.0.
|
|
44
|
+
"@gesslar/uglier": "^0.0.8",
|
|
45
|
+
"eslint": "^9.39.2"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"lint": "eslint",
|
|
49
|
+
"lint:fix": "eslint --fix",
|
|
50
|
+
"update": "pnpm up -L",
|
|
51
|
+
"submit": "pnpm publish --access public --//registry.npmjs.org/:_authToken=\"${NPM_ACCESS_TOKEN}\"",
|
|
52
|
+
"pr": "gt submit -p --ai"
|
|
45
53
|
}
|
|
46
|
-
}
|
|
54
|
+
}
|
package/src/uglier.js
CHANGED
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
* })
|
|
61
61
|
* ]
|
|
62
62
|
*
|
|
63
|
-
*
|
|
63
|
+
* available-configs
|
|
64
|
+
*
|
|
64
65
|
* - lints-js: Core stylistic rules (indent, spacing, quotes, etc.)
|
|
65
66
|
* - lints-jsdoc: JSDoc documentation requirements
|
|
66
67
|
* - languageOptions: Base ECMAScript language configuration
|
|
@@ -80,11 +81,13 @@ import globals from "globals"
|
|
|
80
81
|
/**
|
|
81
82
|
* Registry of named configuration blocks
|
|
82
83
|
* Each config is a factory function that returns an ESLint config object
|
|
83
|
-
*
|
|
84
|
+
*
|
|
85
|
+
* @type {{[key: string]: Function}}
|
|
84
86
|
*/
|
|
85
87
|
const CONFIGS = {
|
|
86
88
|
/**
|
|
87
89
|
* Core stylistic linting rules
|
|
90
|
+
*
|
|
88
91
|
* @param {object} options - Configuration options
|
|
89
92
|
* @returns {object} Config object
|
|
90
93
|
*/
|
|
@@ -197,6 +200,7 @@ const CONFIGS = {
|
|
|
197
200
|
|
|
198
201
|
/**
|
|
199
202
|
* JSDoc linting rules
|
|
203
|
+
*
|
|
200
204
|
* @param {object} options - Configuration options
|
|
201
205
|
* @returns {object} Config object
|
|
202
206
|
*/
|
|
@@ -227,6 +231,7 @@ const CONFIGS = {
|
|
|
227
231
|
|
|
228
232
|
/**
|
|
229
233
|
* Language options configuration
|
|
234
|
+
*
|
|
230
235
|
* @param {object} options - Configuration options
|
|
231
236
|
* @returns {object} Config object
|
|
232
237
|
*/
|
|
@@ -249,6 +254,7 @@ const CONFIGS = {
|
|
|
249
254
|
|
|
250
255
|
/**
|
|
251
256
|
* Browser/web globals configuration
|
|
257
|
+
*
|
|
252
258
|
* @param {object} options - Configuration options
|
|
253
259
|
* @returns {object} Config object
|
|
254
260
|
*/
|
|
@@ -272,6 +278,7 @@ const CONFIGS = {
|
|
|
272
278
|
|
|
273
279
|
/**
|
|
274
280
|
* VSCode extension globals
|
|
281
|
+
*
|
|
275
282
|
* @param {object} options - Configuration options
|
|
276
283
|
* @returns {object} Config object
|
|
277
284
|
*/
|
|
@@ -295,6 +302,7 @@ const CONFIGS = {
|
|
|
295
302
|
|
|
296
303
|
/**
|
|
297
304
|
* Node.js globals
|
|
305
|
+
*
|
|
298
306
|
* @param {object} options - Configuration options
|
|
299
307
|
* @returns {object} Config object
|
|
300
308
|
*/
|
|
@@ -320,6 +328,7 @@ const CONFIGS = {
|
|
|
320
328
|
|
|
321
329
|
/**
|
|
322
330
|
* React application globals
|
|
331
|
+
*
|
|
323
332
|
* @param {object} options - Configuration options
|
|
324
333
|
* @returns {object} Config object
|
|
325
334
|
*/
|
|
@@ -345,6 +354,7 @@ const CONFIGS = {
|
|
|
345
354
|
|
|
346
355
|
/**
|
|
347
356
|
* CommonJS file override
|
|
357
|
+
*
|
|
348
358
|
* @param {object} options - Configuration options
|
|
349
359
|
* @returns {object} Config object
|
|
350
360
|
*/
|
|
@@ -365,6 +375,7 @@ const CONFIGS = {
|
|
|
365
375
|
|
|
366
376
|
/**
|
|
367
377
|
* ES Module file override
|
|
378
|
+
*
|
|
368
379
|
* @param {object} options - Configuration options
|
|
369
380
|
* @returns {object} Config object
|
|
370
381
|
*/
|
|
@@ -385,6 +396,7 @@ const CONFIGS = {
|
|
|
385
396
|
|
|
386
397
|
/**
|
|
387
398
|
* Tauri application configuration (browser + Tauri APIs, no Node.js)
|
|
399
|
+
*
|
|
388
400
|
* @param {object} options - Configuration options
|
|
389
401
|
* @returns {object} Config object
|
|
390
402
|
*/
|
|
@@ -411,6 +423,7 @@ const CONFIGS = {
|
|
|
411
423
|
|
|
412
424
|
/**
|
|
413
425
|
* Compose ESLint configuration from named config blocks
|
|
426
|
+
*
|
|
414
427
|
* @param {object} options - Composition options
|
|
415
428
|
* @param {string[]} options.with - Config names to include
|
|
416
429
|
* @param {string[]} options.without - Config names to exclude (higher precedence)
|