Skip to content

Commit f78578c

Browse files
committed
docs: improve README and package dependencies
1 parent 1b31ac0 commit f78578c

File tree

9 files changed

+293
-54
lines changed

9 files changed

+293
-54
lines changed

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ module.exports = {
1515
'@typescript-eslint/unbound-method': 0, // See https://github.com/typescript-eslint/typescript-eslint/issues/636
1616
},
1717
},
18+
{
19+
files: '*.test.ts',
20+
extends: ['plugin:jest/recommended'],
21+
},
1822
],
1923
}

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ before_deploy:
2929
- git remote set-url origin https://user:[email protected]/$TRAVIS_REPO_SLUG.git
3030
- git fetch origin $TRAVIS_BRANCH:$TRAVIS_BRANCH
3131
- git checkout $TRAVIS_BRANCH
32+
- cp -f README.md packages/eslint-mdx
33+
- cp -f README.md packages/eslint-plugin-mdx
3234
- yarn run lerna-changelog
3335

3436
deploy:

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
</p>
1212

1313
[![Travis](https://img.shields.io/travis/com/rx-ts/eslint-mdx.svg)](https://travis-ci.com/rx-ts/eslint-mdx)
14-
[![David](https://img.shields.io/david/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx)
15-
[![David Dev](https://img.shields.io/david/dev/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?type=dev)
16-
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
14+
[![Codecov](https://img.shields.io/codecov/c/gh/rx-ts/eslint-mdx)](https://codecov.io/gh/rx-ts/eslint-mdx)
15+
[![GitHub release](https://img.shields.io/github/release/rx-ts/eslint-mdx)](https://github.com/rx-ts/eslint-mdx/releases)
16+
[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
1717
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
18-
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)
18+
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org)
1919

2020
> [ESLint] Parser/Plugin for [MDX], helps you lint all ES syntaxes excluding `code` block of course.
2121
> Work perfectly with `eslint-plugin-import`, `eslint-plugin-prettier` or any other eslint plugins.
2222
2323
## Packages
2424

25-
This repository is a monorepo that we manage using Lerna. This means we actually publish several packages to npm from the same codebase, including:
25+
This repository is a monorepo managed by Lerna what means we actually publish several packages to npm from the same codebase, including:
2626

27-
| Package | Version | Description |
28-
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
29-
| [`eslint-mdx`](/packages/eslint-mdx) | [![npm](https://img.shields.io/npm/v/eslint-mdx.svg)](https://www.npmjs.com/package/eslint-mdx) | ESLint Parser for MDX |
30-
| [`@rxts/eslint-plugin-mdx`](/packages/eslint-plugin-mdx) | [![npm](https://img.shields.io/npm/v/@rxts/eslint-plugin-mdx.svg)](https://www.npmjs.com/package/@rxts/eslint-plugin-mdx) | ESLint Plugin, Configuration and Rules for MDX |
27+
| Package | Version | Dependencies Status | Description |
28+
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
29+
| [`eslint-mdx`](/packages/eslint-mdx) | [![npm](https://img.shields.io/npm/v/eslint-mdx.svg)](https://www.npmjs.com/package/eslint-mdx) | [![David Peer](https://img.shields.io/david/peer/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-mdx&type=peer) [![David](https://img.shields.io/david/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-mdx) | ESLint Parser for MDX |
30+
| [`@rxts/eslint-plugin-mdx`](/packages/eslint-plugin-mdx) | [![npm](https://img.shields.io/npm/v/@rxts/eslint-plugin-mdx.svg)](https://www.npmjs.com/package/@rxts/eslint-plugin-mdx) | [![David Peer](https://img.shields.io/david/peer/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-plugin-mdx&type=peer) [![David](https://img.shields.io/david/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-plugin-mdx) | ESLint Plugin, Configuration and Rules for MDX |
3131

3232
## Install
3333

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,9 @@
3737
"prettier": "1.18.2",
3838
"prettier-config-1stg": "^0.1.0",
3939
"react": "^16.9.0",
40-
"remark-mdx": "^1.2.2",
41-
"remark-parse": "^7.0.1",
4240
"ts-jest": "^24.0.2",
4341
"ts-node": "^8.3.0",
44-
"typescript": "^3.5.3",
45-
"unified": "^8.3.2"
42+
"typescript": "^3.5.3"
4643
},
4744
"commitlint": {
4845
"extends": [

packages/eslint-mdx/README.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
<p align="center">
2+
<a href="https://eslint.org">
3+
<img src="https://eslint.org/assets/img/logo.svg" height="50">
4+
</a>
5+
<a href="#readme">
6+
<img src="https://rx-ts.github.io/assets/heart.svg" height="50">
7+
</a>
8+
<a href="https://github.com/mdx-js/mdx">
9+
<img src="https://mdx-logo.now.sh" height="50">
10+
</a>
11+
</p>
12+
13+
[![Travis](https://img.shields.io/travis/com/rx-ts/eslint-mdx.svg)](https://travis-ci.com/rx-ts/eslint-mdx)
14+
[![Codecov](https://img.shields.io/codecov/c/gh/rx-ts/eslint-mdx)](https://codecov.io/gh/rx-ts/eslint-mdx)
15+
[![GitHub release](https://img.shields.io/github/release/rx-ts/eslint-mdx)](https://github.com/rx-ts/eslint-mdx/releases)
16+
[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
17+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
18+
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org)
19+
20+
> [ESLint] Parser/Plugin for [MDX], helps you lint all ES syntaxes excluding `code` block of course.
21+
> Work perfectly with `eslint-plugin-import`, `eslint-plugin-prettier` or any other eslint plugins.
22+
23+
## Packages
24+
25+
This repository is a monorepo managed by Lerna what means we actually publish several packages to npm from the same codebase, including:
26+
27+
| Package | Version | Dependencies Status | Description |
28+
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
29+
| [`eslint-mdx`](/packages/eslint-mdx) | [![npm](https://img.shields.io/npm/v/eslint-mdx.svg)](https://www.npmjs.com/package/eslint-mdx) | [![David Peer](https://img.shields.io/david/peer/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-mdx&type=peer) [![David](https://img.shields.io/david/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-mdx) | ESLint Parser for MDX |
30+
| [`@rxts/eslint-plugin-mdx`](/packages/eslint-plugin-mdx) | [![npm](https://img.shields.io/npm/v/@rxts/eslint-plugin-mdx.svg)](https://www.npmjs.com/package/@rxts/eslint-plugin-mdx) | [![David Peer](https://img.shields.io/david/peer/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-plugin-mdx&type=peer) [![David](https://img.shields.io/david/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-plugin-mdx) | ESLint Plugin, Configuration and Rules for MDX |
31+
32+
## Install
33+
34+
```sh
35+
# yarn
36+
yarn add -D @rxts/eslint-plugin-mdx
37+
38+
# npm
39+
npm i -D @rxts/eslint-plugin-mdx
40+
```
41+
42+
## Usage
43+
44+
1. In your ESLint config file:
45+
46+
1. If you're using `eslint >= 6.0.0`, add:
47+
48+
```json
49+
{
50+
"extends": ["plugin:@rxts/mdx/recommended"],
51+
"overrides": [
52+
{
53+
"files": ["*.mdx"],
54+
"extends": ["plugin:@rxts/mdx/overrides"]
55+
}
56+
]
57+
}
58+
```
59+
60+
2. If you're using `eslint@^5.0.0`, you need to enable this parse/plugin manually, because `eslint@5` does not support `extends` for `overrides` property in its configuration:
61+
62+
```json
63+
{
64+
"extends": ["plugin:@rxts/mdx/recommended"],
65+
"overrides": [
66+
{
67+
"files": ["*.mdx"],
68+
"globals": {
69+
"React": false
70+
},
71+
"rules": {
72+
"lines-between-class-members": 0,
73+
"react/react-in-jsx-scope": 0
74+
}
75+
}
76+
]
77+
}
78+
```
79+
80+
2. Make sure ESLint knows to run on `.mdx` files:
81+
82+
```sh
83+
eslint . --ext js,mdx
84+
```
85+
86+
## Parser Options
87+
88+
1. `parser` (`string | Function`): Custom parser for ES syntax is supported, although `@typescript-eslint/parser` or `babel-eslint` will be detected automatically what means you actually do not need do this:
89+
90+
```json
91+
{
92+
"extends": ["plugin:@rxts/mdx/recommended"],
93+
"parserOptions": {
94+
"parser": "babel-eslint"
95+
}
96+
}
97+
```
98+
99+
2. `extensions` (`string | string[]`): `eslint-mdx` will only resolve `.mdx` files by default, files with other extensions will be resolved by the `parser` option. If you want to resolve other extensions as like `.mdx`, you can use this option.
100+
101+
## Rules
102+
103+
### @rxts/mdx/no-jsx-html-comments
104+
105+
HTML style comments in jsx block is invalid, this rule will help you to fix it by transforming it to JSX style comments.
106+
107+
### @rxts/mdx/no-unescaped-entities
108+
109+
Inline JSX like `Inline <Component />` is supported by [MDX], but rule `react/no-unescaped-entities` from [eslint-plugin-react] is incompatible with it, `@rxts/mdx/no-unescaped-entities` is the replacement.
110+
111+
### @rxts/mdx/no-unused-expressions
112+
113+
[MDX] can render `jsx` block automatically without exporting them, but [ESLint] will report `no-unused-expressions` issue which could be unexpected, this rule is a replacement of it, so make sure that you've turned off the original `no-unused-expressions` rule.
114+
115+
## Limitation
116+
117+
> This parser/plugin can only handle ES syntaxes for you, markdown related syntaxes will just be ignored, you can use [markdownlint] or [remake-lint] to lint that part.
118+
119+
I have a very preliminary idea to integrate with [remake-lint].
120+
121+
## Changelog
122+
123+
Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).
124+
125+
## License
126+
127+
[MIT]
128+
129+
[eslint]: https://eslint.org
130+
[eslint-plugin-react]: https://github.com/yannickcr/eslint-plugin-react
131+
[mdx]: https://github.com/mdx-js/mdx
132+
[mit]: http://opensource.org/licenses/MIT
133+
[markdownlint]: https://github.com/markdownlint/markdownlint
134+
[remake-lint]: https://github.com/remarkjs/remark-lint

packages/eslint-mdx/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@
1919
],
2020
"peerDependencies": {
2121
"eslint": ">=5.0.0"
22+
},
23+
"dependencies": {
24+
"remark-mdx": "^1.2.2",
25+
"remark-parse": "^7.0.1"
2226
}
2327
}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
<p align="center">
2+
<a href="https://eslint.org">
3+
<img src="https://eslint.org/assets/img/logo.svg" height="50">
4+
</a>
5+
<a href="#readme">
6+
<img src="https://rx-ts.github.io/assets/heart.svg" height="50">
7+
</a>
8+
<a href="https://github.com/mdx-js/mdx">
9+
<img src="https://mdx-logo.now.sh" height="50">
10+
</a>
11+
</p>
12+
13+
[![Travis](https://img.shields.io/travis/com/rx-ts/eslint-mdx.svg)](https://travis-ci.com/rx-ts/eslint-mdx)
14+
[![Codecov](https://img.shields.io/codecov/c/gh/rx-ts/eslint-mdx)](https://codecov.io/gh/rx-ts/eslint-mdx)
15+
[![GitHub release](https://img.shields.io/github/release/rx-ts/eslint-mdx)](https://github.com/rx-ts/eslint-mdx/releases)
16+
[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
17+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
18+
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org)
19+
20+
> [ESLint] Parser/Plugin for [MDX], helps you lint all ES syntaxes excluding `code` block of course.
21+
> Work perfectly with `eslint-plugin-import`, `eslint-plugin-prettier` or any other eslint plugins.
22+
23+
## Packages
24+
25+
This repository is a monorepo managed by Lerna what means we actually publish several packages to npm from the same codebase, including:
26+
27+
| Package | Version | Dependencies Status | Description |
28+
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
29+
| [`eslint-mdx`](/packages/eslint-mdx) | [![npm](https://img.shields.io/npm/v/eslint-mdx.svg)](https://www.npmjs.com/package/eslint-mdx) | [![David Peer](https://img.shields.io/david/peer/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-mdx&type=peer) [![David](https://img.shields.io/david/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-mdx) | ESLint Parser for MDX |
30+
| [`@rxts/eslint-plugin-mdx`](/packages/eslint-plugin-mdx) | [![npm](https://img.shields.io/npm/v/@rxts/eslint-plugin-mdx.svg)](https://www.npmjs.com/package/@rxts/eslint-plugin-mdx) | [![David Peer](https://img.shields.io/david/peer/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-plugin-mdx&type=peer) [![David](https://img.shields.io/david/rx-ts/eslint-mdx.svg)](https://david-dm.org/rx-ts/eslint-mdx?path=packages/eslint-plugin-mdx) | ESLint Plugin, Configuration and Rules for MDX |
31+
32+
## Install
33+
34+
```sh
35+
# yarn
36+
yarn add -D @rxts/eslint-plugin-mdx
37+
38+
# npm
39+
npm i -D @rxts/eslint-plugin-mdx
40+
```
41+
42+
## Usage
43+
44+
1. In your ESLint config file:
45+
46+
1. If you're using `eslint >= 6.0.0`, add:
47+
48+
```json
49+
{
50+
"extends": ["plugin:@rxts/mdx/recommended"],
51+
"overrides": [
52+
{
53+
"files": ["*.mdx"],
54+
"extends": ["plugin:@rxts/mdx/overrides"]
55+
}
56+
]
57+
}
58+
```
59+
60+
2. If you're using `eslint@^5.0.0`, you need to enable this parse/plugin manually, because `eslint@5` does not support `extends` for `overrides` property in its configuration:
61+
62+
```json
63+
{
64+
"extends": ["plugin:@rxts/mdx/recommended"],
65+
"overrides": [
66+
{
67+
"files": ["*.mdx"],
68+
"globals": {
69+
"React": false
70+
},
71+
"rules": {
72+
"lines-between-class-members": 0,
73+
"react/react-in-jsx-scope": 0
74+
}
75+
}
76+
]
77+
}
78+
```
79+
80+
2. Make sure ESLint knows to run on `.mdx` files:
81+
82+
```sh
83+
eslint . --ext js,mdx
84+
```
85+
86+
## Parser Options
87+
88+
1. `parser` (`string | Function`): Custom parser for ES syntax is supported, although `@typescript-eslint/parser` or `babel-eslint` will be detected automatically what means you actually do not need do this:
89+
90+
```json
91+
{
92+
"extends": ["plugin:@rxts/mdx/recommended"],
93+
"parserOptions": {
94+
"parser": "babel-eslint"
95+
}
96+
}
97+
```
98+
99+
2. `extensions` (`string | string[]`): `eslint-mdx` will only resolve `.mdx` files by default, files with other extensions will be resolved by the `parser` option. If you want to resolve other extensions as like `.mdx`, you can use this option.
100+
101+
## Rules
102+
103+
### @rxts/mdx/no-jsx-html-comments
104+
105+
HTML style comments in jsx block is invalid, this rule will help you to fix it by transforming it to JSX style comments.
106+
107+
### @rxts/mdx/no-unescaped-entities
108+
109+
Inline JSX like `Inline <Component />` is supported by [MDX], but rule `react/no-unescaped-entities` from [eslint-plugin-react] is incompatible with it, `@rxts/mdx/no-unescaped-entities` is the replacement.
110+
111+
### @rxts/mdx/no-unused-expressions
112+
113+
[MDX] can render `jsx` block automatically without exporting them, but [ESLint] will report `no-unused-expressions` issue which could be unexpected, this rule is a replacement of it, so make sure that you've turned off the original `no-unused-expressions` rule.
114+
115+
## Limitation
116+
117+
> This parser/plugin can only handle ES syntaxes for you, markdown related syntaxes will just be ignored, you can use [markdownlint] or [remake-lint] to lint that part.
118+
119+
I have a very preliminary idea to integrate with [remake-lint].
120+
121+
## Changelog
122+
123+
Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).
124+
125+
## License
126+
127+
[MIT]
128+
129+
[eslint]: https://eslint.org
130+
[eslint-plugin-react]: https://github.com/yannickcr/eslint-plugin-react
131+
[mdx]: https://github.com/mdx-js/mdx
132+
[mit]: http://opensource.org/licenses/MIT
133+
[markdownlint]: https://github.com/markdownlint/markdownlint
134+
[remake-lint]: https://github.com/remarkjs/remark-lint

packages/eslint-plugin-mdx/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@
1818
"eslint-mdx"
1919
],
2020
"peerDependencies": {
21-
"eslint": ">=5.0.0"
21+
"eslint": ">=5.0.0",
22+
"eslint-plugin-react": ">=7.0.0"
2223
},
2324
"dependencies": {
24-
"eslint-mdx": "^0.9.9",
25-
"remark-mdx": "^1.1.5",
26-
"remark-parse": "^7.0.0",
27-
"unified": "^8.3.2"
25+
"eslint-mdx": "^0.9.9"
2826
}
2927
}

0 commit comments

Comments
 (0)