/
docusaurusConfig.ts
218 lines (209 loc) · 5.86 KB
/
docusaurusConfig.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
import type { MDXPlugin } from '@docusaurus/mdx-loader';
import type { Options as PluginContentDocsOptions } from '@docusaurus/plugin-content-docs';
import type { Options as PresetClassicOptions } from '@docusaurus/preset-classic';
import type { UserThemeConfig as ThemeCommonConfig } from '@docusaurus/theme-common';
import type { UserThemeConfig as AlgoliaThemeConfig } from '@docusaurus/theme-search-algolia';
import type { Config } from '@docusaurus/types';
import { rulesMeta } from './rulesMeta';
import npm2yarnPlugin from '@docusaurus/remark-plugin-npm2yarn';
import tabsPlugin from 'remark-docusaurus-tabs';
import { generatedRuleDocs } from './plugins/generated-rule-docs';
const remarkPlugins: MDXPlugin[] = [[npm2yarnPlugin, { sync: true }]];
const beforeDefaultRemarkPlugins: MDXPlugin[] = [[tabsPlugin, {}]];
const githubUrl = 'https://github.com/typescript-eslint/typescript-eslint';
const presetClassicOptions: PresetClassicOptions = {
docs: {
id: 'rules-docs',
path: '../eslint-plugin/docs/rules',
sidebarPath: require.resolve('./sidebars/sidebar.rules.js'),
routeBasePath: 'rules',
editUrl: `${githubUrl}/edit/main/packages/website/`,
beforeDefaultRemarkPlugins: [
...beforeDefaultRemarkPlugins,
[generatedRuleDocs, {}],
],
remarkPlugins: remarkPlugins,
exclude: ['TEMPLATE.md'],
breadcrumbs: false,
},
// TODO enable this
blog: false,
pages: {
beforeDefaultRemarkPlugins,
remarkPlugins,
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
};
const pluginContentDocsOptions: PluginContentDocsOptions = {
id: 'base-docs',
path: '../../docs',
routeBasePath: 'docs',
sidebarPath: require.resolve('./sidebars/sidebar.base.js'),
editUrl: `${githubUrl}/edit/main/packages/website/`,
beforeDefaultRemarkPlugins,
remarkPlugins,
breadcrumbs: false,
};
const themeConfig: ThemeCommonConfig & AlgoliaThemeConfig = {
algolia: {
appId: 'N1HUB2TU6A',
apiKey: '74d42ed10d0f7b327d74d774570035c7',
indexName: 'typescript-eslint',
},
metadata: [
{ name: 'msapplication-TileColor', content: '#443fd4' },
{ name: 'theme-color', content: '#443fd4' },
{ name: 'twitter:image:alt', content: 'Typescript-eslint logo' },
],
image: 'img/logo-twitter-card.png',
navbar: {
title: 'TypeScript ESLint',
// hideOnScroll: true,
logo: {
alt: 'TypeScript ESLint logo',
height: '32px',
src: 'img/logo.svg',
width: '32px',
},
// style: 'primary',
items: [
{
to: 'docs/',
activeBasePath: 'docs',
label: 'Getting started',
position: 'left',
},
{
to: 'rules/',
activeBasePath: 'rules',
label: 'Rules',
position: 'left',
},
{
to: 'play',
activeBasePath: 'play',
position: 'right',
label: 'Playground',
},
{
href: githubUrl,
position: 'right',
className: 'header-github-link',
'aria-label': 'GitHub repository',
},
],
},
footer: {
logo: {
alt: 'Deploys by Netlify',
src: 'https://www.netlify.com/img/global/badges/netlify-dark.svg',
href: 'https://www.netlify.com',
},
links: [
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/typescript-eslint',
},
{
label: 'Twitter',
href: 'https://twitter.com/tseslint',
},
],
},
{
title: 'More',
items: [
{
label: 'GitHub',
href: 'https://github.com/typescript-eslint/typescript-eslint',
},
{
label: 'Report issue',
href: 'https://github.com/typescript-eslint/typescript-eslint/issues/new/choose',
},
],
},
],
// style: 'primary',
copyright: `Copyright © ${new Date().getFullYear()} TypeScript ESLint, Inc. Built with Docusaurus.`,
},
prism: {
theme: {
plain: {},
styles: [],
},
additionalLanguages: ['ignore'],
magicComments: [
{
className: 'theme-code-block-highlighted-line',
line: 'highlight-next-line',
block: { start: 'highlight-start', end: 'highlight-end' },
},
{
className: 'code-block-removed-line',
line: 'Remove this line',
block: { start: 'Removed lines start', end: 'Removed lines end' },
},
{
className: 'code-block-added-line',
line: 'Add this line',
block: { start: 'Added lines start', end: 'Added lines end' },
},
],
},
tableOfContents: {
maxHeadingLevel: 4,
minHeadingLevel: 2,
},
};
const config: Config = {
title: 'TypeScript ESLint',
tagline: 'Tooling which enables ESLint to support TypeScript',
url: 'https://typescript-eslint.io',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
favicon: 'img/favicon.ico',
organizationName: 'typescript-eslint',
projectName: 'typescript-eslint',
clientModules: [require.resolve('./src/clientModules.js')],
presets: [['classic', presetClassicOptions]],
customFields: {
rules: rulesMeta,
},
plugins: [
require.resolve('./webpack.plugin'),
['@docusaurus/plugin-content-docs', pluginContentDocsOptions],
],
themeConfig,
// Misleading API name, but these are just <link> tags
stylesheets: [
{
rel: 'apple-touch-icon',
sizes: '180x180',
href: '/img/favicon/apple-touch-icon.png',
},
{
rel: 'icon',
type: 'image/png',
sizes: '32x32',
href: '/img/favicon/favicon-32x32.png',
},
{
rel: 'icon',
type: 'image/png',
sizes: '16x16',
href: '/img/favicon/favicon-16x16.png',
},
{
rel: 'manifest',
href: '/img/favicon/site.webmanifest',
},
],
};
export = config;