Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support eslint-plugin-perfectionist@3 #1596

Merged
merged 7 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import markdown from "eslint-plugin-markdown";
import n from "eslint-plugin-n";
import packageJson from "eslint-plugin-package-json/configs/recommended";
import perfectionistNatural from "eslint-plugin-perfectionist/configs/recommended-natural";
import perfectionist from "eslint-plugin-perfectionist";
import * as regexp from "eslint-plugin-regexp";
import vitest from "eslint-plugin-vitest";
import yml from "eslint-plugin-yml";
Expand Down Expand Up @@ -45,7 +45,7 @@
jsdoc.configs["flat/recommended-typescript-error"],
n.configs["flat/recommended"],
packageJson,
perfectionistNatural,
perfectionist.configs["recommended-natural"],

Check failure on line 48 in eslint.config.js

View workflow job for this annotation

GitHub Actions / lint

Unsafe argument of type `any` assigned to a parameter of type `ConfigWithExtends`

Check failure on line 48 in eslint.config.js

View workflow job for this annotation

GitHub Actions / lint

Unsafe member access ["recommended-natural"] on an `error` typed value
regexp.configs["flat/recommended"],
...tseslint.config({
extends: [
Expand Down Expand Up @@ -99,7 +99,7 @@
"error",
{
order: "asc",
"partition-by-comment": true,
partitionByComment: true,
type: "natural",
},
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"eslint-plugin-markdown": "^5.0.0",
"eslint-plugin-n": "^17.3.1",
"eslint-plugin-package-json": "^0.15.0",
"eslint-plugin-perfectionist": "^2.9.0",
"eslint-plugin-perfectionist": "^3.1.2",
"eslint-plugin-regexp": "^2.5.0",
"eslint-plugin-vitest": "^0.5.3",
"eslint-plugin-yml": "^1.14.0",
Expand Down
96 changes: 11 additions & 85 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/bin/help.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chalk from "chalk";
import { MockInstance, beforeEach, describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, MockInstance, vi } from "vitest";

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

Expand Down
2 changes: 1 addition & 1 deletion src/shared/cli/outro.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chalk from "chalk";
import { MockInstance, beforeEach, describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, MockInstance, vi } from "vitest";

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

Expand Down
2 changes: 1 addition & 1 deletion src/shared/doesRepositoryExist.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Octokit } from "octokit";
import { MockInstance, describe, expect, it, vi } from "vitest";
import { describe, expect, it, MockInstance, vi } from "vitest";

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

Expand Down
2 changes: 1 addition & 1 deletion src/shared/getGitHubUserAsAllContributor.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chalk from "chalk";
import { MockInstance, beforeEach, describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, MockInstance, vi } from "vitest";

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

Expand Down
2 changes: 1 addition & 1 deletion src/shared/options/augmentOptionsWithExcludes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import chalk from "chalk";
import { filterPromptCancel } from "../prompts.js";
import { Options, OptionsBase } from "../types.js";
import {
ExclusionKey,
exclusionDescriptions,
ExclusionKey,
exclusionKeys,
getExclusions,
} from "./exclusionKeys.js";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/options/readOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { createOptionDefaults } from "./createOptionDefaults/index.js";
import { detectEmailRedundancy } from "./detectEmailRedundancy.js";
import { ensureRepositoryExists } from "./ensureRepositoryExists.js";
import { getBase } from "./getBase.js";
import { GitHub, getGitHub } from "./getGitHub.js";
import { getGitHub, GitHub } from "./getGitHub.js";
import { getPrefillOrPromptedOption } from "./getPrefillOrPromptedOption.js";
import { logInferredOptions } from "./logInferredOptions.js";
import { optionsSchema } from "./optionsSchema.js";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/prompts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as prompts from "@clack/prompts";

export function filterPromptCancel<Value>(value: Value | symbol) {
export function filterPromptCancel<Value>(value: symbol | Value) {
return prompts.isCancel(value) ? undefined : value;
}
2 changes: 1 addition & 1 deletion src/shared/readFileSafe.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from "node:fs/promises";

export async function readFileSafe(filePath: URL | string, fallback: string) {
export async function readFileSafe(filePath: string | URL, fallback: string) {
try {
return (await fs.readFile(filePath)).toString();
} catch {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/readFileSafeAsJson.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readFileSafe } from "./readFileSafe.js";

export async function readFileSafeAsJson(filePath: URL | string) {
export async function readFileSafeAsJson(filePath: string | URL) {
return JSON.parse(await readFileSafe(filePath, "null")) as unknown;
}
2 changes: 1 addition & 1 deletion src/steps/initializeBranchProtectionSettings.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Octokit } from "octokit";
import { MockInstance, describe, expect, it, vi } from "vitest";
import { describe, expect, it, MockInstance, vi } from "vitest";

import { Options } from "../shared/types.js";
import { initializeBranchProtectionSettings } from "./initializeGitHubRepository/initializeBranchProtectionSettings.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { $ } from "execa";

import {
GhLabelData,
getExistingEquivalentLabels,
GhLabelData,
} from "./getExistingEquivalentLabels.js";
import { outcomeLabels } from "./outcomeLabels.js";

Expand Down
6 changes: 3 additions & 3 deletions src/steps/writing/creation/createESLintConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe("createESLintConfig", () => {
import markdown from "eslint-plugin-markdown";
import n from "eslint-plugin-n";
import packageJson from "eslint-plugin-package-json/configs/recommended";
import perfectionistNatural from "eslint-plugin-perfectionist/configs/recommended-natural";
import perfectionist from "eslint-plugin-perfectionist";
import * as regexp from "eslint-plugin-regexp";
import vitest from "eslint-plugin-vitest";
import yml from "eslint-plugin-yml";
Expand Down Expand Up @@ -145,7 +145,7 @@ describe("createESLintConfig", () => {
jsdoc.configs["flat/recommended-typescript-error"],
n.configs["flat/recommended"],
packageJson,
perfectionistNatural,
perfectionist.configs["recommended-natural"],
regexp.configs["flat/recommended"],
...tseslint.config({
extends: [
Expand Down Expand Up @@ -185,7 +185,7 @@ describe("createESLintConfig", () => {
"error",
{
order: "asc",
"partition-by-comment": true,
partitionByComment: true,
type: "natural",
},
],
Expand Down
7 changes: 4 additions & 3 deletions src/steps/writing/creation/createESLintConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function createESLintConfig(options: Options) {
!options.excludeLintPackageJson &&
`import packageJson from "eslint-plugin-package-json/configs/recommended";`,
!options.excludeLintPerfectionist &&
`import perfectionistNatural from "eslint-plugin-perfectionist/configs/recommended-natural";`,
`import perfectionist from "eslint-plugin-perfectionist";`,
!options.excludeLintRegex &&
`import * as regexp from "eslint-plugin-regexp";`,
!options.excludeTests && `import vitest from "eslint-plugin-vitest";`,
Expand All @@ -35,7 +35,8 @@ export async function createESLintConfig(options: Options) {
` jsdoc.configs["flat/recommended-typescript-error"],`,
` n.configs["flat/recommended"],`,
!options.excludeLintPackageJson && ` packageJson,`,
!options.excludeLintPerfectionist && ` perfectionistNatural,`,
!options.excludeLintPerfectionist &&
` perfectionist.configs["recommended-natural"],`,
!options.excludeLintRegex && ` regexp.configs["flat/recommended"],`,
].filter(Boolean);

Expand Down Expand Up @@ -122,7 +123,7 @@ export default tseslint.config(
"error",
{
order: "asc",
"partition-by-comment": true,
partitionByComment: true,
type: "natural",
},
],`
Expand Down
2 changes: 1 addition & 1 deletion src/steps/writing/creation/dotGitHub/createWorkflowFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ interface WorkflowFileOptionsBase {
}

interface WorkflowFileOptionsRuns extends WorkflowFileOptionsBase {
runs: (WorkflowFileStep | string)[];
runs: (string | WorkflowFileStep)[];
}

interface WorkflowFileOptionsSteps extends WorkflowFileOptionsBase {
Expand Down
Loading
Loading