Skip to content

fix: corrected setup for blockESLintPlugin #2196

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

Merged
merged 1 commit into from
Apr 9, 2025
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
2 changes: 1 addition & 1 deletion src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export const base = createBase({
);

const getReadmeUsage = lazyValue(
async () => await readReadmeUsage(getEmoji, getReadme, getRepository),
async () => await readReadmeUsage(getReadme),
);

const getRepository = lazyValue(
Expand Down
188 changes: 184 additions & 4 deletions src/blocks/blockESLintPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,41 @@ describe("blockESLintPlugin", () => {
},
"block": [Function],
},
{
"addons": {
"defaultUsage": [
"Add this plugin to the list of plugins in your [ESLint configuration file](https://eslint.org/docs/latest/use/configure/configuration-files):

\`\`\`shell
npm i test-repository -D
\`\`\`

\`\`\`ts
import testRepository from "test-repository";

export default [
// (other plugins)
testRepository.configs.recommended, // 👈
];
\`\`\`

### Rules

These are all set to \`"error"\` in the recommended config:

<!-- begin auto-generated rules list --><!-- end auto-generated rules list -->",
],
},
"block": [Function],
},
{
"addons": {
"properties": {
"dependencies": {
"@typescript-eslint/utils": "^8.29.0",
},
"devDependencies": {
"@typescript-eslint/rule-tester": "8.29.1",
"eslint-doc-generator": "2.1.0",
"eslint-plugin-eslint-plugin": "6.4.0",
},
Expand Down Expand Up @@ -131,6 +162,20 @@ describe("blockESLintPlugin", () => {
export default config;
",
},
"scripts": [
{
"commands": [
"pnpm build",
],
"phase": 2,
},
{
"commands": [
"pnpm eslint-doc-generator --init-rule-docs",
],
"phase": 3,
},
],
}
`);
});
Expand Down Expand Up @@ -221,10 +266,41 @@ describe("blockESLintPlugin", () => {
},
"block": [Function],
},
{
"addons": {
"defaultUsage": [
"Add this plugin to the list of plugins in your [ESLint configuration file](https://eslint.org/docs/latest/use/configure/configuration-files):

\`\`\`shell
npm i test-repository -D
\`\`\`

\`\`\`ts
import testRepository from "test-repository";

export default [
// (other plugins)
testRepository.configs.recommended, // 👈
];
\`\`\`

### Rules

These are all set to \`"error"\` in the recommended config:

<!-- begin auto-generated rules list --><!-- end auto-generated rules list -->",
],
},
"block": [Function],
},
{
"addons": {
"properties": {
"dependencies": {
"@typescript-eslint/utils": "^8.29.0",
},
"devDependencies": {
"@typescript-eslint/rule-tester": "8.29.1",
"eslint-doc-generator": "2.1.0",
"eslint-plugin-eslint-plugin": "6.4.0",
},
Expand Down Expand Up @@ -264,6 +340,20 @@ describe("blockESLintPlugin", () => {
export default config;
",
},
"scripts": [
{
"commands": [
"pnpm build",
],
"phase": 2,
},
{
"commands": [
"pnpm eslint-doc-generator --init-rule-docs",
],
"phase": 3,
},
],
}
`);
});
Expand Down Expand Up @@ -352,10 +442,41 @@ describe("blockESLintPlugin", () => {
},
"block": [Function],
},
{
"addons": {
"defaultUsage": [
"Add this plugin to the list of plugins in your [ESLint configuration file](https://eslint.org/docs/latest/use/configure/configuration-files):

\`\`\`shell
npm i test-repository -D
\`\`\`

\`\`\`ts
import testRepository from "test-repository";

export default [
// (other plugins)
testRepository.configs.recommended, // 👈
];
\`\`\`

### Rules

These are all set to \`"error"\` in the recommended config:

<!-- begin auto-generated rules list --><!-- end auto-generated rules list -->",
],
},
"block": [Function],
},
{
"addons": {
"properties": {
"dependencies": {
"@typescript-eslint/utils": "^8.29.0",
},
"devDependencies": {
"@typescript-eslint/rule-tester": "8.29.1",
"eslint-doc-generator": "2.1.0",
"eslint-plugin-eslint-plugin": "6.4.0",
},
Expand Down Expand Up @@ -429,7 +550,7 @@ describe("blockESLintPlugin", () => {
export default plugin;
",
"rules": {
"example.test.ts": "import { rule } from "./enums.js";
"enums.test.ts": "import { rule } from "./enums.js";
import { ruleTester } from "./ruleTester.js";

ruleTester.run("enums", rule, {
Expand All @@ -450,7 +571,7 @@ describe("blockESLintPlugin", () => {
valid: [\`const Values = {};\`, \`const Values = {} as const;\`],
});
",
"example.ts": "import { createRule } from "../utils.js";
"enums.ts": "import { createRule } from "../utils.js";

export const rule = createRule({
create(context) {
Expand All @@ -477,10 +598,10 @@ describe("blockESLintPlugin", () => {
name: "enums",
});
",
"index.ts": "import { rule as example } from "./example.js";
"index.ts": "import { rule as enums } from "./enums.js";

export const rules = {
example,
enums,
};
",
"ruleTester.ts": "import { RuleTester } from "@typescript-eslint/rule-tester";
Expand All @@ -503,6 +624,20 @@ describe("blockESLintPlugin", () => {
",
},
},
"scripts": [
{
"commands": [
"pnpm build",
],
"phase": 2,
},
{
"commands": [
"pnpm eslint-doc-generator --init-rule-docs",
],
"phase": 3,
},
],
}
`);
});
Expand Down Expand Up @@ -596,10 +731,41 @@ describe("blockESLintPlugin", () => {
},
"block": [Function],
},
{
"addons": {
"defaultUsage": [
"Add this plugin to the list of plugins in your [ESLint configuration file](https://eslint.org/docs/latest/use/configure/configuration-files):

\`\`\`shell
npm i test-repository -D
\`\`\`

\`\`\`ts
import testRepository from "test-repository";

export default [
// (other plugins)
testRepository.configs.recommended, // 👈
];
\`\`\`

### Rules

These are all set to \`"error"\` in the recommended config:

<!-- begin auto-generated rules list --><!-- end auto-generated rules list -->",
],
},
"block": [Function],
},
{
"addons": {
"properties": {
"dependencies": {
"@typescript-eslint/utils": "^8.29.0",
},
"devDependencies": {
"@typescript-eslint/rule-tester": "8.29.1",
"eslint-doc-generator": "2.1.0",
"eslint-plugin-eslint-plugin": "6.4.0",
},
Expand Down Expand Up @@ -640,6 +806,20 @@ describe("blockESLintPlugin", () => {
export default config;
",
},
"scripts": [
{
"commands": [
"pnpm build",
],
"phase": 2,
},
{
"commands": [
"pnpm eslint-doc-generator --init-rule-docs",
],
"phase": 3,
},
],
}
`);
});
Expand Down
Loading
Loading