@pezkuwi/dev 0.86.0 → 0.86.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.
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.packageInfo = void 0;
4
- exports.packageInfo = { name: '@pezkuwi/dev', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '0.86.0' };
4
+ exports.packageInfo = { name: '@pezkuwi/dev', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '0.86.1' };
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "sideEffects": false,
17
17
  "type": "module",
18
- "version": "0.86.0",
18
+ "version": "0.86.1",
19
19
  "bin": {
20
20
  "pezkuwi-ci-ghact-build": "./scripts/pezkuwi-ci-ghact-build.mjs",
21
21
  "pezkuwi-ci-ghact-docs": "./scripts/pezkuwi-ci-ghact-docs.mjs",
@@ -28,6 +28,7 @@
28
28
  "pezkuwi-dev-copy-dir": "./scripts/pezkuwi-dev-copy-dir.mjs",
29
29
  "pezkuwi-dev-copy-to": "./scripts/pezkuwi-dev-copy-to.mjs",
30
30
  "pezkuwi-dev-deno-map": "./scripts/pezkuwi-dev-deno-map.mjs",
31
+ "pezkuwi-dev-migrate-eslint10": "./scripts/pezkuwi-dev-migrate-eslint10.mjs",
31
32
  "pezkuwi-dev-run-lint": "./scripts/pezkuwi-dev-run-lint.mjs",
32
33
  "pezkuwi-dev-run-node-ts": "./scripts/pezkuwi-dev-run-node-ts.mjs",
33
34
  "pezkuwi-dev-run-test": "./scripts/pezkuwi-dev-run-test.mjs",
@@ -241,6 +242,8 @@
241
242
  "./scripts/pezkuwi-dev-copy-to": "./scripts/pezkuwi-dev-copy-to.mjs",
242
243
  "./scripts/pezkuwi-dev-deno-map.mjs": "./scripts/pezkuwi-dev-deno-map.mjs",
243
244
  "./scripts/pezkuwi-dev-deno-map": "./scripts/pezkuwi-dev-deno-map.mjs",
245
+ "./scripts/pezkuwi-dev-migrate-eslint10.mjs": "./scripts/pezkuwi-dev-migrate-eslint10.mjs",
246
+ "./scripts/pezkuwi-dev-migrate-eslint10": "./scripts/pezkuwi-dev-migrate-eslint10.mjs",
244
247
  "./scripts/pezkuwi-dev-run-lint.mjs": "./scripts/pezkuwi-dev-run-lint.mjs",
245
248
  "./scripts/pezkuwi-dev-run-lint": "./scripts/pezkuwi-dev-run-lint.mjs",
246
249
  "./scripts/pezkuwi-dev-run-node-ts.mjs": "./scripts/pezkuwi-dev-run-node-ts.mjs",
@@ -285,8 +288,8 @@
285
288
  "dependencies": {
286
289
  "@eslint/compat": "^2.1.1",
287
290
  "@eslint/js": "^10.0.1",
288
- "@pezkuwi/dev-test": "^0.86.0",
289
- "@pezkuwi/dev-ts": "^0.86.0",
291
+ "@pezkuwi/dev-test": "^0.86.1",
292
+ "@pezkuwi/dev-ts": "^0.86.1",
290
293
  "@rollup/plugin-alias": "^5.1.1",
291
294
  "@rollup/plugin-commonjs": "^29.0.3",
292
295
  "@rollup/plugin-dynamic-import-vars": "^2.1.5",
package/packageInfo.js CHANGED
@@ -1 +1 @@
1
- export const packageInfo = { name: '@pezkuwi/dev', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '0.86.0' };
1
+ export const packageInfo = { name: '@pezkuwi/dev', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '0.86.1' };
@@ -19,7 +19,7 @@ const [e, i] = fs
19
19
 
20
20
  if (!fs.existsSync('mod.ts')) {
21
21
  fs.writeFileSync('mod.ts', `// Copyright 2017-${new Date().getFullYear()} @pezkuwi/dev authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\n// auto-generated via pezkuwi-dev-deno-map, do not edit\n\n// This is a Deno file, so we can allow .ts imports
22
- /* eslint-disable import/extensions */\n\n${e.join('\n')}\n`);
22
+ /* eslint-disable import-x/extensions */\n\n${e.join('\n')}\n`);
23
23
  }
24
24
 
25
25
  if (fs.existsSync('import_map.in.json')) {
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env node
2
+ // Copyright 2017-2026 @pezkuwi/dev authors & contributors
3
+ // SPDX-License-Identifier: Apache-2.0
4
+
5
+ // Renames rules in eslint-disable / eslint-enable comments for the 0.86
6
+ // toolchain (eslint 10, typescript-eslint 8, @stylistic, import-x).
7
+ //
8
+ // A disable comment that names a rule which no longer exists under that name
9
+ // disables nothing: eslint reports it as unused and `--fix` deletes it, after
10
+ // which the rule it was meant to silence applies. Run this before the first
11
+ // lint on 0.86, in the repository root:
12
+ //
13
+ // pezkuwi-dev-migrate-eslint10 # rewrite tracked files
14
+ // pezkuwi-dev-migrate-eslint10 --check # report, change nothing (exit 1 if anything would change)
15
+ //
16
+ // It also rewrites such comments inside string literals, which is how code
17
+ // generators emit them.
18
+
19
+ import stylisticPlugin from '@stylistic/eslint-plugin';
20
+ import { builtinRules } from 'eslint/use-at-your-own-risk';
21
+ import importPlugin from 'eslint-plugin-import-x';
22
+ import { execFileSync } from 'node:child_process';
23
+ import fs from 'node:fs';
24
+
25
+ const STYLISTIC = new Set(Object.keys(stylisticPlugin.rules));
26
+ const IMPORT_X = new Set(Object.keys(importPlugin.rules));
27
+
28
+ /** @type {Map<string, string[]>} */
29
+ const RENAME = new Map();
30
+
31
+ // Core rules eslint 10 deprecated, with the successor it names itself. The
32
+ // rule metadata (meta.deprecated.replacedBy) is only exposed here, so this
33
+ // reads it rather than keeping a hand-written copy that could drift.
34
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
35
+ for (const [name, rule] of builtinRules) {
36
+ const replacedBy = rule.meta?.deprecated && typeof rule.meta.deprecated === 'object'
37
+ ? rule.meta.deprecated.replacedBy
38
+ : undefined;
39
+
40
+ if (replacedBy?.length === 1) {
41
+ const [{ plugin, rule: next }] = replacedBy;
42
+
43
+ if (next?.name) {
44
+ RENAME.set(name, [plugin?.name === '@stylistic/eslint-plugin' ? `@stylistic/${next.name}` : next.name]);
45
+ }
46
+ }
47
+ }
48
+
49
+ // typescript-eslint 8 removed its formatting rules; they live in @stylistic.
50
+ for (const name of ['block-spacing', 'brace-style', 'comma-dangle', 'comma-spacing', 'func-call-spacing', 'indent', 'key-spacing', 'keyword-spacing', 'lines-around-comment', 'lines-between-class-members', 'member-delimiter-style', 'no-extra-parens', 'no-extra-semi', 'object-curly-spacing', 'padding-line-between-statements', 'quotes', 'semi', 'space-before-blocks', 'space-before-function-paren', 'space-infix-ops', 'type-annotation-spacing']) {
51
+ const next = name === 'func-call-spacing' ? 'function-call-spacing' : name;
52
+
53
+ if (STYLISTIC.has(next)) {
54
+ RENAME.set(`@typescript-eslint/${name}`, [`@stylistic/${next}`]);
55
+ }
56
+ }
57
+
58
+ // Other typescript-eslint 8 removals and renames.
59
+ RENAME.set('@typescript-eslint/ban-types', ['@typescript-eslint/no-empty-object-type', '@typescript-eslint/no-unsafe-function-type', '@typescript-eslint/no-wrapper-object-types']);
60
+ RENAME.set('@typescript-eslint/no-empty-interface', ['@typescript-eslint/no-empty-object-type']);
61
+ RENAME.set('@typescript-eslint/no-loss-of-precision', ['no-loss-of-precision']);
62
+ RENAME.set('@typescript-eslint/no-throw-literal', ['@typescript-eslint/only-throw-error']);
63
+ RENAME.set('@typescript-eslint/no-var-requires', ['@typescript-eslint/no-require-imports']);
64
+ RENAME.set('deprecation/deprecation', ['@typescript-eslint/no-deprecated']);
65
+
66
+ // The react formatting rules config/eslint.rules.js (overrideJsx) now takes
67
+ // from @stylistic; keep this list in step with it. (The config is not
68
+ // imported here: loading it reads the repository's tsconfig.base.json.)
69
+ for (const name of ['jsx-closing-bracket-location', 'jsx-first-prop-new-line', 'jsx-max-props-per-line', 'jsx-newline', 'jsx-props-no-multi-spaces', 'jsx-sort-props', 'jsx-tag-spacing']) {
70
+ if (STYLISTIC.has(name)) {
71
+ RENAME.set(`react/${name}`, [`@stylistic/${name}`]);
72
+ }
73
+ }
74
+
75
+ /**
76
+ * @param {string} name
77
+ * @returns {string[]}
78
+ */
79
+ function rename (name) {
80
+ if (RENAME.has(name)) {
81
+ return /** @type {string[]} */ (RENAME.get(name));
82
+ } else if (name.startsWith('import/') && IMPORT_X.has(name.slice(7))) {
83
+ return [`import-x/${name.slice(7)}`];
84
+ }
85
+
86
+ return [name];
87
+ }
88
+
89
+ // eslint-disable, eslint-disable-line, eslint-disable-next-line, eslint-enable
90
+ // followed by a rule list, optionally ending in `-- description`.
91
+ const DIRECTIVE = /(eslint-(?:disable(?:-next-line|-line)?|enable))([ \t]+)([^\n*'"`]*?)([ \t]*(?:--[^\n*]*)?)(?=\*\/|\n|$|['"`])/g;
92
+
93
+ const files = execFileSync('git', ['ls-files', '-z', '--', '*.ts', '*.tsx', '*.js', '*.jsx', '*.mjs', '*.cjs', '*.cts', '*.mts'], { encoding: 'utf-8' })
94
+ .split('\0')
95
+ .filter((f) => f && !/(^|\/)(node_modules|build|build-[^/]+)\//.test(f));
96
+ const check = process.argv.includes('--check');
97
+ let changedFiles = 0;
98
+ let changedComments = 0;
99
+
100
+ for (const file of files) {
101
+ const src = fs.readFileSync(file, 'utf-8');
102
+ const out = src.replace(DIRECTIVE, (/** @type {string} */ all, /** @type {string} */ kind, /** @type {string} */ gap, /** @type {string} */ list, /** @type {string} */ tail) => {
103
+ if (!list.trim()) {
104
+ return all;
105
+ }
106
+
107
+ const names = list.split(',').map((n) => n.trim()).filter(Boolean);
108
+ const next = [...new Set(names.flatMap(rename))];
109
+
110
+ if (next.join(',') === names.join(',')) {
111
+ return all;
112
+ }
113
+
114
+ changedComments++;
115
+
116
+ return `${kind}${gap}${next.join(', ')}${tail}`;
117
+ });
118
+
119
+ if (out !== src) {
120
+ changedFiles++;
121
+
122
+ if (check) {
123
+ console.log(`would change: ${file}`);
124
+ } else {
125
+ fs.writeFileSync(file, out);
126
+ }
127
+ }
128
+ }
129
+
130
+ console.log(`${check ? 'would rewrite' : 'rewrote'} ${changedComments} directive(s) in ${changedFiles} file(s)`);
131
+
132
+ if (check && changedFiles) {
133
+ process.exit(1);
134
+ }