@podman-desktop/eslint-plugin 0.3.0 → 0.4.0-next.202610260324-5cce2bd
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/dist/index.js +89 -95
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,57 +1,56 @@
|
|
|
1
1
|
import { execFileSync as e } from "node:child_process";
|
|
2
2
|
import { lstatSync as t, readFileSync as n } from "node:fs";
|
|
3
3
|
import { resolve as r } from "node:path";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
var i = {
|
|
5
|
+
name: "@podman-desktop/eslint-plugin",
|
|
6
|
+
version: "0.4.0-next.202610260324-5cce2bd",
|
|
7
|
+
description: "ESLint plugin with rules for Podman Desktop",
|
|
8
|
+
license: "Apache-2.0",
|
|
9
|
+
repository: {
|
|
10
|
+
type: "git",
|
|
11
|
+
url: "https://github.com/podman-desktop/eslint-plugin"
|
|
12
|
+
},
|
|
13
|
+
type: "module",
|
|
14
|
+
main: "./dist/index.js",
|
|
9
15
|
types: "./dist/index.d.ts",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
types: d,
|
|
42
|
-
exports: f,
|
|
43
|
-
files: p,
|
|
44
|
-
scripts: m,
|
|
45
|
-
engines: h,
|
|
46
|
-
devDependencies: g,
|
|
47
|
-
peerDependencies: _,
|
|
16
|
+
exports: { ".": {
|
|
17
|
+
types: "./dist/index.d.ts",
|
|
18
|
+
import: "./dist/index.js"
|
|
19
|
+
} },
|
|
20
|
+
files: ["dist"],
|
|
21
|
+
scripts: {
|
|
22
|
+
build: "vite build",
|
|
23
|
+
test: "vitest run",
|
|
24
|
+
"lint:check": "eslint .",
|
|
25
|
+
"lint:fix": "pnpm run build && eslint --fix .",
|
|
26
|
+
"format:check": "biome format",
|
|
27
|
+
"format:fix": "biome format --write",
|
|
28
|
+
typecheck: "tsc --noEmit -p tsconfig.json",
|
|
29
|
+
prepare: "husky"
|
|
30
|
+
},
|
|
31
|
+
engines: { node: ">=24 <25" },
|
|
32
|
+
devDependencies: {
|
|
33
|
+
"@biomejs/biome": "^2.3.15",
|
|
34
|
+
"@types/eslint": "^9.6.0",
|
|
35
|
+
"@types/node": "^24",
|
|
36
|
+
eslint: "^10.0.0",
|
|
37
|
+
"eslint-plugin-yml": "^3.1.2",
|
|
38
|
+
husky: "^9.1.7",
|
|
39
|
+
"lint-staged": "^17.0.8",
|
|
40
|
+
typescript: "^5.4.0",
|
|
41
|
+
"typescript-eslint": "^8.55.0",
|
|
42
|
+
vite: "^8.0.0",
|
|
43
|
+
"vite-plugin-dts": "^5.0.3",
|
|
44
|
+
vitest: "^5.0.2"
|
|
45
|
+
},
|
|
46
|
+
peerDependencies: { eslint: ">=9.0.0" },
|
|
48
47
|
"lint-staged": { "*.{js,ts,mjs,cjs,tsx,jsx,yml,yaml}": ["eslint --fix", "biome format --write"] },
|
|
49
|
-
packageManager:
|
|
50
|
-
},
|
|
51
|
-
function
|
|
48
|
+
packageManager: "pnpm@10.29.3+sha512.498e1fb4cca5aa06c1dcf2611e6fafc50972ffe7189998c409e90de74566444298ffe43e6cd2acdc775ba1aa7cc5e092a8b7054c811ba8c5770f84693d33d2dc"
|
|
49
|
+
}, a, o, s, c, l = !1, u;
|
|
50
|
+
function d() {
|
|
52
51
|
return process.env.GITHUB_ACTIONS === "true" && process.env.GITHUB_EVENT_NAME === "pull_request";
|
|
53
52
|
}
|
|
54
|
-
function
|
|
53
|
+
function f() {
|
|
55
54
|
let e = process.env.GITHUB_REF;
|
|
56
55
|
if (e) {
|
|
57
56
|
let t = /^refs\/pull\/(\d+)\/merge$/.exec(e);
|
|
@@ -63,9 +62,9 @@ function D() {
|
|
|
63
62
|
if (e?.pull_request?.number) return String(e.pull_request.number);
|
|
64
63
|
} catch {}
|
|
65
64
|
}
|
|
66
|
-
function
|
|
67
|
-
if (!
|
|
68
|
-
let n =
|
|
65
|
+
function p(t) {
|
|
66
|
+
if (!d()) return !1;
|
|
67
|
+
let n = f();
|
|
69
68
|
if (!n) return !1;
|
|
70
69
|
let i = process.env.GITHUB_REPOSITORY;
|
|
71
70
|
if (!i) return !1;
|
|
@@ -81,26 +80,26 @@ function O(t) {
|
|
|
81
80
|
encoding: "utf-8"
|
|
82
81
|
}), o = /* @__PURE__ */ new Set();
|
|
83
82
|
for (let e of a.split("\n")) e && o.add(r(t, e));
|
|
84
|
-
return
|
|
83
|
+
return u = o, l = !0, !0;
|
|
85
84
|
} catch {
|
|
86
85
|
return !1;
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
|
-
function
|
|
90
|
-
if (
|
|
88
|
+
function m() {
|
|
89
|
+
if (c !== void 0) return;
|
|
91
90
|
try {
|
|
92
|
-
|
|
91
|
+
s = e("git", ["rev-parse", "--show-toplevel"], {
|
|
93
92
|
stdio: "pipe",
|
|
94
93
|
encoding: "utf-8"
|
|
95
|
-
}).trim(),
|
|
94
|
+
}).trim(), c = !0;
|
|
96
95
|
} catch {
|
|
97
|
-
|
|
96
|
+
c = !1;
|
|
98
97
|
return;
|
|
99
98
|
}
|
|
100
|
-
if (
|
|
99
|
+
if (p(s)) return;
|
|
101
100
|
let t = /* @__PURE__ */ new Map();
|
|
102
|
-
|
|
103
|
-
let n =
|
|
101
|
+
a = t;
|
|
102
|
+
let n = s;
|
|
104
103
|
try {
|
|
105
104
|
let i = e("git", [
|
|
106
105
|
"log",
|
|
@@ -111,23 +110,20 @@ function k() {
|
|
|
111
110
|
], {
|
|
112
111
|
stdio: "pipe",
|
|
113
112
|
encoding: "utf-8",
|
|
114
|
-
maxBuffer:
|
|
113
|
+
maxBuffer: 52428800
|
|
115
114
|
}), a;
|
|
116
115
|
for (let e of i.split("\n")) if (e) {
|
|
117
|
-
if (e.startsWith("COMMIT:"))
|
|
118
|
-
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
if (a !== void 0) {
|
|
116
|
+
if (e.startsWith("COMMIT:")) a = Number(e.slice(7));
|
|
117
|
+
else if (a !== void 0) {
|
|
122
118
|
let i = r(n, e);
|
|
123
119
|
t.has(i) || t.set(i, a);
|
|
124
120
|
}
|
|
125
121
|
}
|
|
126
122
|
} catch {
|
|
127
|
-
|
|
123
|
+
c = !1;
|
|
128
124
|
}
|
|
129
125
|
let i = /* @__PURE__ */ new Set();
|
|
130
|
-
|
|
126
|
+
o = i;
|
|
131
127
|
try {
|
|
132
128
|
let t = e("git", ["status", "--porcelain"], {
|
|
133
129
|
stdio: "pipe",
|
|
@@ -140,7 +136,7 @@ function k() {
|
|
|
140
136
|
}
|
|
141
137
|
} catch {}
|
|
142
138
|
}
|
|
143
|
-
var
|
|
139
|
+
var h = [
|
|
144
140
|
"Copyright (C) {year} Red Hat, Inc.",
|
|
145
141
|
"",
|
|
146
142
|
"Licensed under the Apache License, Version 2.0 (the \"License\");",
|
|
@@ -156,38 +152,37 @@ var A = [
|
|
|
156
152
|
"limitations under the License.",
|
|
157
153
|
"",
|
|
158
154
|
"SPDX-License-Identifier: Apache-2.0"
|
|
159
|
-
],
|
|
160
|
-
function
|
|
161
|
-
if (
|
|
155
|
+
], g = /Copyright \(C\) (\d{4})(?:[-,\s]+(\d{4}))* (.+)/;
|
|
156
|
+
function _(e) {
|
|
157
|
+
if (m(), l) return (/* @__PURE__ */ new Date()).getFullYear();
|
|
162
158
|
let n = r(e);
|
|
163
|
-
if (
|
|
164
|
-
let i =
|
|
159
|
+
if (o?.has(n)) return (/* @__PURE__ */ new Date()).getFullYear();
|
|
160
|
+
let i = a?.get(n);
|
|
165
161
|
if (i !== void 0) return i;
|
|
166
|
-
let
|
|
167
|
-
return
|
|
162
|
+
let s = t(e, { throwIfNoEntry: !1 });
|
|
163
|
+
return s ? s.mtime.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear();
|
|
168
164
|
}
|
|
169
|
-
function
|
|
165
|
+
function v(e) {
|
|
170
166
|
return /\.ya?ml$/i.test(e);
|
|
171
167
|
}
|
|
172
|
-
var
|
|
173
|
-
function
|
|
174
|
-
return
|
|
168
|
+
var y = /\.(svelte|md)$/i;
|
|
169
|
+
function b(e) {
|
|
170
|
+
return y.test(e);
|
|
175
171
|
}
|
|
176
|
-
function
|
|
177
|
-
let n =
|
|
178
|
-
if (
|
|
172
|
+
function x(e, t) {
|
|
173
|
+
let n = h.map((t) => t.replace("{year}", e));
|
|
174
|
+
if (v(t)) {
|
|
179
175
|
let e = "#" + "*".repeat(79);
|
|
180
176
|
return `${e}\n${n.map((e) => e === "" ? "#" : `# ${e}`).join("\n")}\n${e}\n\n`;
|
|
181
177
|
}
|
|
182
178
|
let r = "*".repeat(79);
|
|
183
179
|
return `/${r}\n${n.map((e) => e === "" ? " *" : ` * ${e}`).join("\n")}\n ${r}/\n\n`;
|
|
184
180
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
var L = {
|
|
181
|
+
// src/index.ts
|
|
182
|
+
var S = {
|
|
188
183
|
meta: {
|
|
189
184
|
name: "@podman-desktop/eslint-plugin",
|
|
190
|
-
version:
|
|
185
|
+
version: i.version
|
|
191
186
|
},
|
|
192
187
|
rules: { copyright: {
|
|
193
188
|
meta: {
|
|
@@ -202,19 +197,19 @@ var L = {
|
|
|
202
197
|
},
|
|
203
198
|
create(e) {
|
|
204
199
|
let t = e.filename;
|
|
205
|
-
if (
|
|
200
|
+
if (b(t) || (m(), l && !u?.has(r(s ?? "", t)))) return {};
|
|
206
201
|
let n;
|
|
207
202
|
function i() {
|
|
208
|
-
return n === void 0 && (n =
|
|
203
|
+
return n === void 0 && (n = _(t)), n;
|
|
209
204
|
}
|
|
210
205
|
return { Program(n) {
|
|
211
|
-
let r = e.sourceCode.getText(), a = r.split("\n").slice(0, 30).join("\n"), o =
|
|
206
|
+
let r = e.sourceCode.getText(), a = r.split("\n").slice(0, 30).join("\n"), o = g.exec(a);
|
|
212
207
|
if (!o) {
|
|
213
208
|
e.report({
|
|
214
209
|
node: n,
|
|
215
210
|
messageId: "missingHeader",
|
|
216
211
|
fix(e) {
|
|
217
|
-
let n =
|
|
212
|
+
let n = x(String((/* @__PURE__ */ new Date()).getFullYear()), t);
|
|
218
213
|
return e.insertTextBeforeRange([0, 0], n);
|
|
219
214
|
}
|
|
220
215
|
});
|
|
@@ -236,11 +231,10 @@ var L = {
|
|
|
236
231
|
}
|
|
237
232
|
} },
|
|
238
233
|
configs: {}
|
|
239
|
-
},
|
|
240
|
-
|
|
234
|
+
}, C = S.configs;
|
|
235
|
+
C.recommended = {
|
|
241
236
|
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
242
|
-
plugins: { "@podman-desktop/eslint-plugin":
|
|
237
|
+
plugins: { "@podman-desktop/eslint-plugin": S },
|
|
243
238
|
rules: { "@podman-desktop/eslint-plugin/copyright": "error" }
|
|
244
239
|
};
|
|
245
|
-
|
|
246
|
-
export { L as default };
|
|
240
|
+
export { S as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podman-desktop/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-next.202610260324-5cce2bd",
|
|
4
4
|
"description": "ESLint plugin with rules for Podman Desktop",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"eslint": "^10.0.0",
|
|
30
30
|
"eslint-plugin-yml": "^3.1.2",
|
|
31
31
|
"husky": "^9.1.7",
|
|
32
|
-
"lint-staged": "^
|
|
32
|
+
"lint-staged": "^17.0.8",
|
|
33
33
|
"typescript": "^5.4.0",
|
|
34
34
|
"typescript-eslint": "^8.55.0",
|
|
35
35
|
"vite": "^8.0.0",
|
|
36
|
-
"vite-plugin-dts": "^
|
|
37
|
-
"vitest": "^
|
|
36
|
+
"vite-plugin-dts": "^5.0.3",
|
|
37
|
+
"vitest": "^5.0.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"eslint": ">=9.0.0"
|