Skip to content
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
21 changes: 21 additions & 0 deletions examples/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,34 @@ function App({ name }) {
}
```

## Running the Example

### Clone Repository and Install Dependencies

```sh
$ git clone https://github.com/eslint/markdown.git
$ cd markdown
$ npm install
```

### Run ESLint

```sh
# Run from the root
$ npm test -w examples/react
```

Or

```sh
# Navigate to the directory and run
$ cd examples/react
$ npm test
```

### Expected Output

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

Expand Down
1 change: 1 addition & 0 deletions examples/react/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"private": true,
"name": "example-react",
"scripts": {
"test": "eslint ."
},
Expand Down
21 changes: 21 additions & 0 deletions examples/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,34 @@ function hello(name: String) {
hello(42 as any);
```

## Running the Example

### Clone Repository and Install Dependencies

```sh
$ git clone https://github.com/eslint/markdown.git
$ cd markdown
$ npm install
```

### Run ESLint

```sh
# Run from the root
$ npm test -w examples/typescript
```

Or

```sh
# Navigate to the directory and run
$ cd examples/typescript
$ npm test
```

### Expected Output

```sh
markdown/examples/typescript/README.md
6:22 error Prefer using the primitive `string` as a type name, rather than the upper-cased `String` @typescript-eslint/no-wrapper-object-types
10:13 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
Expand Down
3 changes: 2 additions & 1 deletion examples/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"private": true,
"name": "example-typescript",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name field is necessary. If we omit this field, npm cannot hoist packages correctly, which results in missing dependencies after installation.

For example, if we omit this field, tsc is not recognized as expected.

"scripts": {
"test": "eslint ."
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"eslint": "^9.15.0",
"typescript": "^5.3.3",
"typescript": "^5.8.3",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the TypeScript version to match the version in the root.

"typescript-eslint": "^8.15.0"
}
}
33 changes: 0 additions & 33 deletions npm-prepare.cjs

This file was deleted.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"lint",
"linter"
],
"workspaces": [
"examples/*"
],
"gitHooks": {
"pre-commit": "lint-staged"
},
Expand All @@ -62,7 +65,7 @@
"build:update-rules-docs": "node tools/update-rules-docs.js",
"build": "npm run build:rules && rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:update-rules-docs",
"build:readme": "node tools/update-readme.js",
"prepare": "node ./npm-prepare.cjs && npm run build",
"prepare": "npm run build",
"test": "c8 mocha \"tests/**/*.test.js\" --timeout 30000",
"test:jsr": "npx jsr@latest publish --dry-run",
"test:types": "tsc -p tests/types/tsconfig.json"
Expand All @@ -82,7 +85,7 @@
"rollup": "^4.19.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-delete": "^3.0.1",
"typescript": "^5.5.4",
"typescript": "^5.8.3",
"yorkie": "^2.0.0"
},
"dependencies": {
Expand Down