Skip to content

Commit 0add950

Browse files
authored
chore: replace npm-prepare script with npm workspace feature (#417)
* chore: replace `npm-prepare` script with npm workspace feature * wip * wip: update docs
1 parent 8c24fad commit 0add950

File tree

6 files changed

+50
-36
lines changed

6 files changed

+50
-36
lines changed

examples/react/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,34 @@ function App({ name }) {
1010
}
1111
```
1212

13+
## Running the Example
14+
15+
### Clone Repository and Install Dependencies
16+
1317
```sh
1418
$ git clone https://github.com/eslint/markdown.git
1519
$ cd markdown
1620
$ npm install
21+
```
22+
23+
### Run ESLint
24+
25+
```sh
26+
# Run from the root
27+
$ npm test -w examples/react
28+
```
29+
30+
Or
31+
32+
```sh
33+
# Navigate to the directory and run
1734
$ cd examples/react
1835
$ npm test
36+
```
37+
38+
### Expected Output
1939

40+
```sh
2041
markdown/examples/react/README.md
2142
4:16 error 'name' is missing in props validation react/prop-types
2243

examples/react/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"private": true,
3+
"name": "example-react",
34
"scripts": {
45
"test": "eslint ."
56
},

examples/typescript/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,34 @@ function hello(name: String) {
1010
hello(42 as any);
1111
```
1212

13+
## Running the Example
14+
15+
### Clone Repository and Install Dependencies
16+
1317
```sh
1418
$ git clone https://github.com/eslint/markdown.git
1519
$ cd markdown
1620
$ npm install
21+
```
22+
23+
### Run ESLint
24+
25+
```sh
26+
# Run from the root
27+
$ npm test -w examples/typescript
28+
```
29+
30+
Or
31+
32+
```sh
33+
# Navigate to the directory and run
1734
$ cd examples/typescript
1835
$ npm test
36+
```
37+
38+
### Expected Output
1939

40+
```sh
2041
markdown/examples/typescript/README.md
2142
6:22 error Prefer using the primitive `string` as a type name, rather than the upper-cased `String` @typescript-eslint/no-wrapper-object-types
2243
10:13 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

examples/typescript/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"private": true,
3+
"name": "example-typescript",
34
"scripts": {
45
"test": "eslint ."
56
},
67
"devDependencies": {
78
"@eslint/js": "^9.7.0",
89
"eslint": "^9.15.0",
9-
"typescript": "^5.3.3",
10+
"typescript": "^5.8.3",
1011
"typescript-eslint": "^8.15.0"
1112
}
1213
}

npm-prepare.cjs

Lines changed: 0 additions & 33 deletions
This file was deleted.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
"lint",
3838
"linter"
3939
],
40+
"workspaces": [
41+
"examples/*"
42+
],
4043
"gitHooks": {
4144
"pre-commit": "lint-staged"
4245
},
@@ -65,7 +68,7 @@
6568
"build:update-rules-docs": "node tools/update-rules-docs.js",
6669
"build": "npm run build:rules && rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:update-rules-docs",
6770
"build:readme": "node tools/update-readme.js",
68-
"prepare": "node ./npm-prepare.cjs && npm run build",
71+
"prepare": "npm run build",
6972
"test": "c8 mocha \"tests/**/*.test.js\" --timeout 30000",
7073
"test:jsr": "npx jsr@latest publish --dry-run",
7174
"test:types": "tsc -p tests/types/tsconfig.json"
@@ -85,7 +88,7 @@
8588
"rollup": "^4.19.0",
8689
"rollup-plugin-copy": "^3.5.0",
8790
"rollup-plugin-delete": "^3.0.1",
88-
"typescript": "^5.5.4",
91+
"typescript": "^5.8.3",
8992
"yorkie": "^2.0.0"
9093
},
9194
"dependencies": {

0 commit comments

Comments
 (0)