Skip to content

Commit babf769

Browse files
committed
docs: add docs for typescript with ts-blank-space-eslint-parser setup
1 parent ef5780e commit babf769

File tree

4 files changed

+82
-6
lines changed

4 files changed

+82
-6
lines changed

website/app/layout.config.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ export const baseOptions: BaseLayoutProps = {
3636
url: "/docs/presets",
3737
active: "nested-url",
3838
},
39-
{
40-
text: "Changelog",
41-
url: "https://github.com/Rel1cx/eslint-react/releases",
42-
},
4339
{
4440
text: "Roadmap",
4541
url: "/docs/roadmap",
4642
active: "nested-url",
4743
},
44+
{
45+
text: "Changelog",
46+
url: "https://github.com/Rel1cx/eslint-react/releases",
47+
},
4848
],
4949
};

website/content/docs/getting-started/javascript-with-babel.mdx renamed to website/content/docs/getting-started/javascript-with-babel-eslint-parser.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: JavaScript + Babel
2+
title: JavaScript with alternative parser
33
description: Getting started with JavaScript + Babel setup
44
---
55

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"title": "Getting Started",
3-
"pages": ["javascript", "typescript", "javascript-with-babel"],
3+
"pages": [
4+
"javascript",
5+
"javascript-with-babel-eslint-parser",
6+
"typescript",
7+
"typescript-with-ts-blank-space-eslint-parser"
8+
],
49
"defaultOpen": true
510
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: TypeScript with alternative parser
3+
description: Getting started with TypeScript + TS Blank Space ESLint Parser setup
4+
---
5+
6+
## Install
7+
8+
```sh copy title="Terminal"
9+
# npm
10+
npm install --save-dev eslint ts-blank-space-eslint-parser @eslint-react/eslint-plugin
11+
12+
# pnpm
13+
pnpm add --save-dev eslint ts-blank-space-eslint-parser @eslint-react/eslint-plugin
14+
15+
# yarn
16+
yarn add --dev eslint ts-blank-space-eslint-parser @eslint-react/eslint-plugin
17+
```
18+
19+
## Setup
20+
21+
```js title="eslint.config.js"
22+
23+
// @ts-check
24+
import eslintJs from "@eslint/js";
25+
import eslintReact from "@eslint-react/eslint-plugin";
26+
import tsBlankSpaceEslintParser from "ts-blank-space-eslint-parser";
27+
28+
export default tseslint.config({
29+
files: ["**/*.ts", "**/*.tsx"],
30+
extends: [
31+
eslintJs.configs.recommended,
32+
eslintReact.configs.recommended,
33+
],
34+
languageOptions: {
35+
parser: tsBlankSpaceEslintParser,
36+
},
37+
});
38+
```
39+
40+
## Setup with Fallback Parsers
41+
42+
```js title="eslint.config.js"
43+
44+
// @ts-check
45+
import eslintJs from "@eslint/js";
46+
import eslintReact from "@eslint-react/eslint-plugin";
47+
import tsBlankSpaceEslintParser from "ts-blank-space-eslint-parser";
48+
import tseslint from "typescript-eslint";
49+
50+
export default tseslint.config({
51+
files: ["**/*.ts", "**/*.tsx"],
52+
extends: [
53+
eslintJs.configs.recommended,
54+
eslintReact.configs.recommended,
55+
],
56+
languageOptions: {
57+
parser: tsBlankSpaceEslintParser,
58+
parserOptions: {
59+
// Fallback to `@typescript-eslint/parser` when `ts-blank-space-eslint-parser` fails
60+
fallbackParsers: [
61+
{
62+
parser: tseslint.parser,
63+
parserOptions: {
64+
projectService: true,
65+
},
66+
},
67+
],
68+
},
69+
},
70+
});
71+
```

0 commit comments

Comments
 (0)