Skip to content

Commit 93d5171

Browse files
fix: bump eslint-plugin-package-json to 0.85.0 (#2294)
## PR Checklist - [x] Addresses an existing open issue: fixes #2271 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Finishes the work in #2288 and builds off the new ESLint `files` extension structure in #2291. Alas, due to eslint-community/eslint-plugin-n#472, `n/no-unpublished-bin` has to be manually disabled. 🎁
1 parent 658c273 commit 93d5171

File tree

7 files changed

+45
-38
lines changed

7 files changed

+45
-38
lines changed

eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ export default defineConfig(
7272
"no-useless-rename": "error",
7373
"object-shorthand": "error",
7474
"operator-assignment": "error",
75+
76+
// https://github.com/eslint-community/eslint-plugin-n/issues/472
77+
"n/no-unpublished-bin": "off",
7578
},
7679
settings: { perfectionist: { partitionByComment: true, type: "natural" } },
7780
},

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"main": "lib/index.js",
1616
"bin": "bin/index.js",
1717
"files": [
18-
"bin/index.js",
1918
"lib/"
2019
],
2120
"scripts": {
@@ -94,7 +93,7 @@
9493
"eslint-plugin-jsonc": "2.21.0",
9594
"eslint-plugin-markdown": "5.1.0",
9695
"eslint-plugin-n": "17.23.1",
97-
"eslint-plugin-package-json": "0.54.0",
96+
"eslint-plugin-package-json": "0.85.0",
9897
"eslint-plugin-perfectionist": "4.15.1",
9998
"eslint-plugin-regexp": "2.10.0",
10099
"eslint-plugin-yml": "1.19.0",

pnpm-lock.yaml

Lines changed: 17 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/blocks/blockESLintNode.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ describe("blockESLintNode", () => {
2727
"files": [
2828
"**/*.{js,ts}",
2929
],
30+
"rules": [
31+
{
32+
"comment": "https://github.com/eslint-community/eslint-plugin-n/issues/472",
33+
"entries": {
34+
"n/no-unpublished-bin": "off",
35+
},
36+
},
37+
],
3038
},
3139
{
3240
"extends": [

src/blocks/blockESLintNode.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ export const blockESLintNode = base.createBlock({
1414
{
1515
extends: ['n.configs["flat/recommended"]'],
1616
files: [getScriptFileExtension(options)],
17+
rules: [
18+
{
19+
comment:
20+
"https://github.com/eslint-community/eslint-plugin-n/issues/472",
21+
entries: {
22+
"n/no-unpublished-bin": "off",
23+
},
24+
},
25+
],
1726
},
1827
{
1928
extends: ["tseslint.configs.disableTypeChecked"],

src/blocks/blockPackageJson.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe("blockPackageJson", () => {
247247
expect(creation).toMatchInlineSnapshot(`
248248
{
249249
"files": {
250-
"package.json": "{"name":"test-repository","version":"0.0.0","description":"A very very very very very very very very very very very very very very very very long HTML-ish description ending with an emoji. 🧵","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"author":{"email":"npm@email.com"},"type":"module","bin":"bin/index.js","files":["bin/index.js"],"engines":{"node":">=20.12.0"}}",
250+
"package.json": "{"name":"test-repository","version":"0.0.0","description":"A very very very very very very very very very very very very very very very very long HTML-ish description ending with an emoji. 🧵","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"author":{"email":"npm@email.com"},"type":"module","bin":"bin/index.js","engines":{"node":">=20.12.0"}}",
251251
},
252252
"scripts": [
253253
{
@@ -275,7 +275,7 @@ describe("blockPackageJson", () => {
275275
expect(creation).toMatchInlineSnapshot(`
276276
{
277277
"files": {
278-
"package.json": "{"name":"test-repository","version":"0.0.0","description":"A very very very very very very very very very very very very very very very very long HTML-ish description ending with an emoji. 🧵","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"author":{"email":"npm@email.com"},"type":"module","bin":{"absolute":"bin/absolute.js","relative":"./bin/relative.js"},"files":["bin/absolute.js","bin/relative.js"],"engines":{"node":">=20.12.0"}}",
278+
"package.json": "{"name":"test-repository","version":"0.0.0","description":"A very very very very very very very very very very very very very very very very long HTML-ish description ending with an emoji. 🧵","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"author":{"email":"npm@email.com"},"type":"module","bin":{"absolute":"bin/absolute.js","relative":"./bin/relative.js"},"engines":{"node":">=20.12.0"}}",
279279
},
280280
"scripts": [
281281
{

src/blocks/blockPackageJson.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ export const blockPackageJson = base.createBlock({
5959
...(options.pnpm && {
6060
packageManager: `pnpm@${options.pnpm}`,
6161
}),
62-
files: processFiles([
63-
...collectBinFiles(options.bin),
64-
...(addons.properties.files ?? []),
65-
]),
62+
files: processFiles(addons.properties.files),
6663
keywords: options.keywords,
6764
name: options.repository,
6865
repository: {
@@ -97,17 +94,12 @@ export const blockPackageJson = base.createBlock({
9794
},
9895
});
9996

100-
function collectBinFiles(bin: Record<string, string> | string | undefined) {
101-
if (!bin) {
102-
return [];
97+
function processFiles(files: string[] | undefined) {
98+
// If no files have been specified, we can skip the property altogether
99+
if (!files?.length) {
100+
return undefined;
103101
}
104102

105-
const files = typeof bin === "object" ? Object.values(bin) : [bin];
106-
107-
return files.map((file) => file.replace(/^\.\//, ""));
108-
}
109-
110-
function processFiles(files: string[]) {
111103
// First sort so that shorter entries are first (e.g. "lib/")...
112104
const sortedByLength = files
113105
.filter(Boolean)

0 commit comments

Comments
 (0)