Skip to content

Commit bf22d50

Browse files
fix: support eslint-plugin-perfectionist@3 (#1596)
## PR Checklist - [x] Addresses an existing open issue: fixes #1588 - [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 Bumps to `eslint-plugin-perfection@3` and runs `pnpm lint --fix` for all its behavior differences. 💖
1 parent 9472b85 commit bf22d50

21 files changed

+38
-111
lines changed

eslint.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import jsonc from "eslint-plugin-jsonc";
1515
import markdown from "eslint-plugin-markdown";
1616
import n from "eslint-plugin-n";
1717
import packageJson from "eslint-plugin-package-json/configs/recommended";
18-
import perfectionistNatural from "eslint-plugin-perfectionist/configs/recommended-natural";
18+
import perfectionist from "eslint-plugin-perfectionist";
1919
import * as regexp from "eslint-plugin-regexp";
2020
import vitest from "eslint-plugin-vitest";
2121
import yml from "eslint-plugin-yml";
@@ -45,7 +45,7 @@ export default tseslint.config(
4545
jsdoc.configs["flat/recommended-typescript-error"],
4646
n.configs["flat/recommended"],
4747
packageJson,
48-
perfectionistNatural,
48+
perfectionist.configs["recommended-natural"],
4949
regexp.configs["flat/recommended"],
5050
...tseslint.config({
5151
extends: [
@@ -99,7 +99,7 @@ export default tseslint.config(
9999
"error",
100100
{
101101
order: "asc",
102-
"partition-by-comment": true,
102+
partitionByComment: true,
103103
type: "natural",
104104
},
105105
],

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"eslint-plugin-markdown": "^5.0.0",
8282
"eslint-plugin-n": "^17.3.1",
8383
"eslint-plugin-package-json": "^0.15.0",
84-
"eslint-plugin-perfectionist": "^2.9.0",
84+
"eslint-plugin-perfectionist": "^3.1.2",
8585
"eslint-plugin-regexp": "^2.5.0",
8686
"eslint-plugin-vitest": "^0.5.3",
8787
"eslint-plugin-yml": "^1.14.0",

pnpm-lock.yaml

+11-85
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bin/help.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import chalk from "chalk";
2-
import { MockInstance, beforeEach, describe, expect, it, vi } from "vitest";
2+
import { beforeEach, describe, expect, it, MockInstance, vi } from "vitest";
33

44
import { logHelpText } from "./help.js";
55

src/shared/cli/outro.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import chalk from "chalk";
2-
import { MockInstance, beforeEach, describe, expect, it, vi } from "vitest";
2+
import { beforeEach, describe, expect, it, MockInstance, vi } from "vitest";
33

44
import { outro } from "./outro.js";
55

src/shared/doesRepositoryExist.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Octokit } from "octokit";
2-
import { MockInstance, describe, expect, it, vi } from "vitest";
2+
import { describe, expect, it, MockInstance, vi } from "vitest";
33

44
import { doesRepositoryExist } from "./doesRepositoryExist.js";
55

src/shared/getGitHubUserAsAllContributor.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import chalk from "chalk";
2-
import { MockInstance, beforeEach, describe, expect, it, vi } from "vitest";
2+
import { beforeEach, describe, expect, it, MockInstance, vi } from "vitest";
33

44
import { getGitHubUserAsAllContributor } from "./getGitHubUserAsAllContributor.js";
55

src/shared/options/augmentOptionsWithExcludes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import chalk from "chalk";
44
import { filterPromptCancel } from "../prompts.js";
55
import { Options, OptionsBase } from "../types.js";
66
import {
7-
ExclusionKey,
87
exclusionDescriptions,
8+
ExclusionKey,
99
exclusionKeys,
1010
getExclusions,
1111
} from "./exclusionKeys.js";

src/shared/options/readOptions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { createOptionDefaults } from "./createOptionDefaults/index.js";
1111
import { detectEmailRedundancy } from "./detectEmailRedundancy.js";
1212
import { ensureRepositoryExists } from "./ensureRepositoryExists.js";
1313
import { getBase } from "./getBase.js";
14-
import { GitHub, getGitHub } from "./getGitHub.js";
14+
import { getGitHub, GitHub } from "./getGitHub.js";
1515
import { getPrefillOrPromptedOption } from "./getPrefillOrPromptedOption.js";
1616
import { logInferredOptions } from "./logInferredOptions.js";
1717
import { optionsSchema } from "./optionsSchema.js";

src/shared/prompts.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as prompts from "@clack/prompts";
22

3-
export function filterPromptCancel<Value>(value: Value | symbol) {
3+
export function filterPromptCancel<Value>(value: symbol | Value) {
44
return prompts.isCancel(value) ? undefined : value;
55
}

src/shared/readFileSafe.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from "node:fs/promises";
22

3-
export async function readFileSafe(filePath: URL | string, fallback: string) {
3+
export async function readFileSafe(filePath: string | URL, fallback: string) {
44
try {
55
return (await fs.readFile(filePath)).toString();
66
} catch {

src/shared/readFileSafeAsJson.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { readFileSafe } from "./readFileSafe.js";
22

3-
export async function readFileSafeAsJson(filePath: URL | string) {
3+
export async function readFileSafeAsJson(filePath: string | URL) {
44
return JSON.parse(await readFileSafe(filePath, "null")) as unknown;
55
}

src/steps/initializeBranchProtectionSettings.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Octokit } from "octokit";
2-
import { MockInstance, describe, expect, it, vi } from "vitest";
2+
import { describe, expect, it, MockInstance, vi } from "vitest";
33

44
import { Options } from "../shared/types.js";
55
import { initializeBranchProtectionSettings } from "./initializeGitHubRepository/initializeBranchProtectionSettings.js";

src/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { $ } from "execa";
22

33
import {
4-
GhLabelData,
54
getExistingEquivalentLabels,
5+
GhLabelData,
66
} from "./getExistingEquivalentLabels.js";
77
import { outcomeLabels } from "./outcomeLabels.js";
88

src/steps/writing/creation/createESLintConfig.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ describe("createESLintConfig", () => {
115115
import markdown from "eslint-plugin-markdown";
116116
import n from "eslint-plugin-n";
117117
import packageJson from "eslint-plugin-package-json/configs/recommended";
118-
import perfectionistNatural from "eslint-plugin-perfectionist/configs/recommended-natural";
118+
import perfectionist from "eslint-plugin-perfectionist";
119119
import * as regexp from "eslint-plugin-regexp";
120120
import vitest from "eslint-plugin-vitest";
121121
import yml from "eslint-plugin-yml";
@@ -145,7 +145,7 @@ describe("createESLintConfig", () => {
145145
jsdoc.configs["flat/recommended-typescript-error"],
146146
n.configs["flat/recommended"],
147147
packageJson,
148-
perfectionistNatural,
148+
perfectionist.configs["recommended-natural"],
149149
regexp.configs["flat/recommended"],
150150
...tseslint.config({
151151
extends: [
@@ -185,7 +185,7 @@ describe("createESLintConfig", () => {
185185
"error",
186186
{
187187
order: "asc",
188-
"partition-by-comment": true,
188+
partitionByComment: true,
189189
type: "natural",
190190
},
191191
],

src/steps/writing/creation/createESLintConfig.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function createESLintConfig(options: Options) {
1515
!options.excludeLintPackageJson &&
1616
`import packageJson from "eslint-plugin-package-json/configs/recommended";`,
1717
!options.excludeLintPerfectionist &&
18-
`import perfectionistNatural from "eslint-plugin-perfectionist/configs/recommended-natural";`,
18+
`import perfectionist from "eslint-plugin-perfectionist";`,
1919
!options.excludeLintRegex &&
2020
`import * as regexp from "eslint-plugin-regexp";`,
2121
!options.excludeTests && `import vitest from "eslint-plugin-vitest";`,
@@ -35,7 +35,8 @@ export async function createESLintConfig(options: Options) {
3535
` jsdoc.configs["flat/recommended-typescript-error"],`,
3636
` n.configs["flat/recommended"],`,
3737
!options.excludeLintPackageJson && ` packageJson,`,
38-
!options.excludeLintPerfectionist && ` perfectionistNatural,`,
38+
!options.excludeLintPerfectionist &&
39+
` perfectionist.configs["recommended-natural"],`,
3940
!options.excludeLintRegex && ` regexp.configs["flat/recommended"],`,
4041
].filter(Boolean);
4142

@@ -122,7 +123,7 @@ export default tseslint.config(
122123
"error",
123124
{
124125
order: "asc",
125-
"partition-by-comment": true,
126+
partitionByComment: true,
126127
type: "natural",
127128
},
128129
],`

src/steps/writing/creation/dotGitHub/createWorkflowFile.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ interface WorkflowFileOptionsBase {
5656
}
5757

5858
interface WorkflowFileOptionsRuns extends WorkflowFileOptionsBase {
59-
runs: (WorkflowFileStep | string)[];
59+
runs: (string | WorkflowFileStep)[];
6060
}
6161

6262
interface WorkflowFileOptionsSteps extends WorkflowFileOptionsBase {

0 commit comments

Comments
 (0)