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: convert README template usage to flat #194

Merged
merged 4 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
16 changes: 8 additions & 8 deletions plugin/templates/_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ npm install eslint-plugin-<%= pluginId %> --save-dev

## Usage

Add `<%= pluginId %>` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
Add `<%= pluginId %>` to the `plugins` key of your [configuration file](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file). You can omit the `eslint-plugin-` prefix:
MikeMcC399 marked this conversation as resolved.
Show resolved Hide resolved

```json
```js
{
"plugins": [
plugins: {
"<%= pluginId %>"
MikeMcC399 marked this conversation as resolved.
Show resolved Hide resolved
]
}
}
```

<% if (hasRules) { %>
Then configure the rules you want to use under the rules section.
Then configure the rules you want to use under the `rules` key.

```json
```js
{
"rules": {
"<%= pluginId %>/rule-name": 2
rules: {
"<%= pluginId %>/rule-name": "warn"
}
}
```
Expand Down
6 changes: 3 additions & 3 deletions tests/plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ describe("ESLint Plugin Generator", () => {
assert.fileContent("README.md", "# eslint-plugin-foo-bar");
assert.fileContent("README.md", "Next, install `eslint-plugin-foo-bar`:");
assert.fileContent("README.md", "npm install eslint-plugin-foo-bar --save-dev");
assert.fileContent("README.md", "Add `foo-bar` to the plugins section");
assert.fileContent("README.md", "Add `foo-bar` to the `plugins` key");

assert.noFileContent("README.md", "Then configure the rules you want to use under the rules section.");
assert.noFileContent("README.md", "Then configure the rules you want to use under the `rules` key.");
});

it("has correct lib/index.js", () => {
Expand Down Expand Up @@ -102,7 +102,7 @@ describe("ESLint Plugin Generator", () => {
});

it("has correct README.md", () => {
assert.fileContent("README.md", "\"foo-bar/rule-name\": 2");
assert.fileContent("README.md", "\"foo-bar/rule-name\": \"warn\"");
});
});

Expand Down