Skip to content

Commit 9c4b5aa

Browse files
committed
Generate relative links in docs script, remove unnecessary npm link
1 parent efcf27f commit 9c4b5aa

File tree

4 files changed

+45
-59
lines changed

4 files changed

+45
-59
lines changed

README.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ Recommended ESLint presets by [Code PushUp](https://github.com/code-pushup/cli/t
99

1010
## ⚙️ Configs
1111

12-
| Stack | Config | Description |
13-
| :----------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------- | :------------------------------------------------------------------ |
14-
| ![javascript](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/javascript.png) | [javascript](https://github.com/code-pushup/eslint-config/blob/main/docs/javascript.md) | Default config, suitable for any **JavaScript/TypeScript** project. |
15-
| ![typescript](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/typescript.png) | [typescript](https://github.com/code-pushup/eslint-config/blob/main/docs/typescript.md) | Config for strict **TypeScript** projects. |
16-
| ![nodejs](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/nodejs.png) | [node](https://github.com/code-pushup/eslint-config/blob/main/docs/node.md) | Config for **Node.js** projects. |
17-
| ![angular](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/angular.png) | [angular](https://github.com/code-pushup/eslint-config/blob/main/docs/angular.md) | Config for **Angular** projects. |
18-
| ![ngrx](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/other/ngrx.png) | [ngrx](https://github.com/code-pushup/eslint-config/blob/main/docs/ngrx.md) | Config for **Angular** projects using **NgRx** library. |
19-
| ![graphql](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/graphql.png) | [graphql](https://github.com/code-pushup/eslint-config/blob/main/docs/graphql.md) | Config for **GraphQL servers** implemented in Node.js. |
20-
| ![jest](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/jest.png) | [jest](https://github.com/code-pushup/eslint-config/blob/main/docs/jest.md) | Config for projects using **Jest** for testing. |
21-
| ![vitest](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/vitest.png) | [vitest](https://github.com/code-pushup/eslint-config/blob/main/docs/vitest.md) | Config for projects using **Vitest** for testing. |
22-
| ![cypress](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/cypress.png) | [cypress](https://github.com/code-pushup/eslint-config/blob/main/docs/cypress.md) | Config for projects using **Cypress** for testing. |
23-
| ![storybook](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/storybook.png) | [storybook](https://github.com/code-pushup/eslint-config/blob/main/docs/storybook.md) | Config for projects using **Storybook** for UI components. |
12+
| Stack | Config | Description |
13+
| :-------------------------------------------------: | :--------------------------------- | :------------------------------------------------------------------ |
14+
| ![javascript](./docs/icons/material/javascript.png) | [javascript](./docs/javascript.md) | Default config, suitable for any **JavaScript/TypeScript** project. |
15+
| ![typescript](./docs/icons/material/typescript.png) | [typescript](./docs/typescript.md) | Config for strict **TypeScript** projects. |
16+
| ![nodejs](./docs/icons/material/nodejs.png) | [node](./docs/node.md) | Config for **Node.js** projects. |
17+
| ![angular](./docs/icons/material/angular.png) | [angular](./docs/angular.md) | Config for **Angular** projects. |
18+
| ![ngrx](./docs/icons/other/ngrx.png) | [ngrx](./docs/ngrx.md) | Config for **Angular** projects using **NgRx** library. |
19+
| ![graphql](./docs/icons/material/graphql.png) | [graphql](./docs/graphql.md) | Config for **GraphQL servers** implemented in Node.js. |
20+
| ![jest](./docs/icons/material/jest.png) | [jest](./docs/jest.md) | Config for projects using **Jest** for testing. |
21+
| ![vitest](./docs/icons/material/vitest.png) | [vitest](./docs/vitest.md) | Config for projects using **Vitest** for testing. |
22+
| ![cypress](./docs/icons/material/cypress.png) | [cypress](./docs/cypress.md) | Config for projects using **Cypress** for testing. |
23+
| ![storybook](./docs/icons/material/storybook.png) | [storybook](./docs/storybook.md) | Config for projects using **Storybook** for UI components. |
2424

2525
Some configs extend other configs, as illustrated below. So, for example, extending `angular` config implicitly extends `typescript` and `javascript` configs as well.
2626

@@ -70,28 +70,28 @@ Depending on your tech stack, you may wish to extend other configs as well ([lis
7070

7171
All peer dependencies used by `@code-pushup/eslint-config` are listed below, along with their supported versions. Only the default config's dependencies are required, others are optional.
7272

73-
| | NPM package | Version | Required |
74-
| :----------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------- | :--------: | :------: |
75-
| ![eslint](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/eslint.png) | [eslint](https://www.npmjs.com/package/eslint) | `^9.0.0` ||
76-
| ![eslint](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/eslint.png) | [@eslint/js](https://www.npmjs.com/package/@eslint/js) | `^9.0.0` ||
77-
| ![lambda](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/icons8/lambda.png) | [eslint-plugin-functional](https://www.npmjs.com/package/eslint-plugin-functional) | `^7.0.0` ||
78-
| ![import](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/icons8/import.png) | [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import) | `^2.31.0` ||
79-
| ![import](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/icons8/import.png) | [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript) | `^3.0.0` | |
80-
| ![promise](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/icons8/promise.png) | [eslint-plugin-promise](https://www.npmjs.com/package/eslint-plugin-promise) | `>=6.4.0` ||
81-
| ![sonar](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/other/sonar.png) | [eslint-plugin-sonarjs](https://www.npmjs.com/package/eslint-plugin-sonarjs) | `>=1.0.4` ||
82-
| ![unicorn](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/icons8/unicorn.png) | [eslint-plugin-unicorn](https://www.npmjs.com/package/eslint-plugin-unicorn) | `>=50.0.0` ||
83-
| ![global](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/icons8/global.png) | [globals](https://www.npmjs.com/package/globals) | `>=14.0.0` ||
84-
| ![typescript](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/typescript.png) | [typescript-eslint](https://www.npmjs.com/package/typescript-eslint) | `^8.0.0` ||
85-
| ![graphql](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/graphql.png) | [@graphql-eslint/eslint-plugin](https://www.npmjs.com/package/@graphql-eslint/eslint-plugin) | `^3.0.0` | |
86-
| ![ngrx](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/other/ngrx.png) | [@ngrx/eslint-plugin](https://www.npmjs.com/package/@ngrx/eslint-plugin) | `^18.0.0` | |
87-
| ![angular](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/angular.png) | [angular-eslint](https://www.npmjs.com/package/angular-eslint) | `^18.0.0` | |
88-
| ![cypress](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/cypress.png) | [eslint-plugin-cypress](https://www.npmjs.com/package/eslint-plugin-cypress) | `>=3.3.0` | |
89-
| ![jest](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/jest.png) | [eslint-plugin-jest](https://www.npmjs.com/package/eslint-plugin-jest) | `^28.8.0` | |
90-
| ![test](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/icons8/test.png) | [eslint-plugin-jest-formatting](https://www.npmjs.com/package/eslint-plugin-jest-formatting) | `^3.0.0` | |
91-
| ![nodejs](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/nodejs.png) | [eslint-plugin-n](https://www.npmjs.com/package/eslint-plugin-n) | `>=17.0.0` | |
92-
| ![rxjs](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/other/rxjs.png) | [eslint-plugin-rxjs-x](https://www.npmjs.com/package/eslint-plugin-rxjs-x) | `>=0.2.4` | |
93-
| ![storybook](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/storybook.png) | [eslint-plugin-storybook](https://www.npmjs.com/package/eslint-plugin-storybook) | `>=0.10.0` | |
94-
| ![vitest](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/vitest.png) | [eslint-plugin-vitest](https://www.npmjs.com/package/eslint-plugin-vitest) | `>=0.5.0` | |
73+
| | NPM package | Version | Required |
74+
| :-------------------------------------------------: | :--------------------------------------------------------------------------------------------------- | :--------: | :------: |
75+
| ![eslint](./docs/icons/material/eslint.png) | [eslint](https://www.npmjs.com/package/eslint) | `^9.0.0` ||
76+
| ![eslint](./docs/icons/material/eslint.png) | [@eslint/js](https://www.npmjs.com/package/@eslint/js) | `^9.0.0` ||
77+
| ![lambda](./docs/icons/icons8/lambda.png) | [eslint-plugin-functional](https://www.npmjs.com/package/eslint-plugin-functional) | `^7.0.0` ||
78+
| ![import](./docs/icons/icons8/import.png) | [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import) | `^2.31.0` ||
79+
| ![import](./docs/icons/icons8/import.png) | [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript) | `^3.0.0` | |
80+
| ![promise](./docs/icons/icons8/promise.png) | [eslint-plugin-promise](https://www.npmjs.com/package/eslint-plugin-promise) | `>=6.4.0` ||
81+
| ![sonar](./docs/icons/other/sonar.png) | [eslint-plugin-sonarjs](https://www.npmjs.com/package/eslint-plugin-sonarjs) | `>=1.0.4` ||
82+
| ![unicorn](./docs/icons/icons8/unicorn.png) | [eslint-plugin-unicorn](https://www.npmjs.com/package/eslint-plugin-unicorn) | `>=50.0.0` ||
83+
| ![global](./docs/icons/icons8/global.png) | [globals](https://www.npmjs.com/package/globals) | `>=14.0.0` ||
84+
| ![typescript](./docs/icons/material/typescript.png) | [typescript-eslint](https://www.npmjs.com/package/typescript-eslint) | `^8.0.0` ||
85+
| ![graphql](./docs/icons/material/graphql.png) | [@graphql-eslint/eslint-plugin](https://www.npmjs.com/package/@graphql-eslint/eslint-plugin) | `^3.0.0` | |
86+
| ![ngrx](./docs/icons/other/ngrx.png) | [@ngrx/eslint-plugin](https://www.npmjs.com/package/@ngrx/eslint-plugin) | `^18.0.0` | |
87+
| ![angular](./docs/icons/material/angular.png) | [angular-eslint](https://www.npmjs.com/package/angular-eslint) | `^18.0.0` | |
88+
| ![cypress](./docs/icons/material/cypress.png) | [eslint-plugin-cypress](https://www.npmjs.com/package/eslint-plugin-cypress) | `>=3.3.0` | |
89+
| ![jest](./docs/icons/material/jest.png) | [eslint-plugin-jest](https://www.npmjs.com/package/eslint-plugin-jest) | `^28.8.0` | |
90+
| ![test](./docs/icons/icons8/test.png) | [eslint-plugin-jest-formatting](https://www.npmjs.com/package/eslint-plugin-jest-formatting) | `^3.0.0` | |
91+
| ![nodejs](./docs/icons/material/nodejs.png) | [eslint-plugin-n](https://www.npmjs.com/package/eslint-plugin-n) | `>=17.0.0` | |
92+
| ![rxjs](./docs/icons/other/rxjs.png) | [eslint-plugin-rxjs-x](https://www.npmjs.com/package/eslint-plugin-rxjs-x) | `>=0.2.4` | |
93+
| ![storybook](./docs/icons/material/storybook.png) | [eslint-plugin-storybook](https://www.npmjs.com/package/eslint-plugin-storybook) | `>=0.10.0` | |
94+
| ![vitest](./docs/icons/material/vitest.png) | [eslint-plugin-vitest](https://www.npmjs.com/package/eslint-plugin-vitest) | `>=0.5.0` | |
9595

9696
### 🧪 Test overrides
9797

scripts/docs.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// @ts-check
22

33
import { ESLint } from 'eslint';
4-
import { execSync } from 'node:child_process';
54
import fs from 'node:fs/promises';
65
import path, { dirname } from 'node:path';
76
import { fileURLToPath } from 'node:url';
@@ -27,23 +26,16 @@ const docsDir = path.join(currentDir, '..', 'docs');
2726
await generateDocs();
2827

2928
async function generateDocs() {
30-
execSync('npm link');
31-
execSync('npm link @code-pushup/eslint-config');
29+
const configs = await loadConfigs(configNames);
30+
const peerDeps = await loadPeerDependencies(configs);
3231

33-
try {
34-
const configs = await loadConfigs(configNames);
35-
const peerDeps = await loadPeerDependencies(configs);
32+
await fs.mkdir(docsDir, { recursive: true });
3633

37-
await fs.mkdir(docsDir, { recursive: true });
38-
39-
for (const config of configs) {
40-
await generateConfigDocs(config, configs, peerDeps);
41-
}
42-
43-
await generateReadmeDocs(configs, peerDeps);
44-
} finally {
45-
execSync('npm unlink @code-pushup/eslint-config');
34+
for (const config of configs) {
35+
await generateConfigDocs(config, configs, peerDeps);
4636
}
37+
38+
await generateReadmeDocs(configs, peerDeps);
4739
}
4840

4941
/**

scripts/helpers/format-readme.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ export function configsToMarkdown(configs, peerDeps, extended) {
2727
],
2828
configs.map(config => [
2929
iconToImage(configIcon(config)),
30-
md.link(
31-
`https://github.com/code-pushup/eslint-config/blob/main/docs/${config}.md`,
32-
config,
33-
),
30+
md.link(`./docs/${config}.md`, config),
3431
configDescription(config),
3532
]),
3633
)
@@ -117,10 +114,7 @@ export function configsToMarkdown(configs, peerDeps, extended) {
117114

118115
/** @param {import('./types').Icon} icon */
119116
function iconToImage(icon) {
120-
return md.image(
121-
`https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/${icon}.png`,
122-
icon.replace(/^\w+\//, ''),
123-
);
117+
return md.image(`./docs/icons/${icon}.png`, icon.replace(/^\w+\//, ''));
124118
}
125119

126120
/**

tests/helpers/lint-utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// @ts-check
22

33
import { ESLint } from 'eslint';
4-
const fs = require('node:fs/promises');
5-
const path = require('node:path');
4+
import fs from 'node:fs/promises';
5+
import path from 'node:path';
66

77
/**
88
* Sets up utilities for loading configuration and rules using ESLint

0 commit comments

Comments
 (0)