Skip to content

Commit 6aaeebc

Browse files
authored
docs: add eslint (#4805)
* docs: add eslint * chore: remove @eslint/css * feat(docs): add custom eslint rule for css variables * ci: check lint on css changes in docs * ci: update lefthook configuration
1 parent 84d7abb commit 6aaeebc

File tree

11 files changed

+113
-81
lines changed

11 files changed

+113
-81
lines changed

bun.lock

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@docusaurus/faster": "^3.8.1",
3535
"@docusaurus/preset-classic": "^3.8.1",
3636
"@mdx-js/react": "^3.0.0",
37-
"@widlarzgroup/docusaurus-ui": "^0.0.2",
37+
"@widlarzgroup/docusaurus-ui": "^0.0.3",
3838
"clsx": "^2.0.0",
3939
"docusaurus-lunr-search": "^3.6.0",
4040
"prism-react-renderer": "^2.3.0",
@@ -45,8 +45,10 @@
4545
"@docusaurus/module-type-aliases": "^3.8.1",
4646
"@docusaurus/tsconfig": "^3.8.1",
4747
"@docusaurus/types": "^3.8.1",
48+
"@widlarzgroup/eslint-plugin-docusaurus": "^0.0.1",
4849
"docusaurus-plugin-llms": "^0.1.5",
4950
"docusaurus-plugin-typedoc": "^1.4.0",
51+
"eslint": "^8.51.0",
5052
"typescript": "^5.2.2",
5153
},
5254
},
@@ -1183,7 +1185,9 @@
11831185

11841186
"@webassemblyjs/wast-printer": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@xtuc/long": "4.2.2" } }, "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw=="],
11851187

1186-
"@widlarzgroup/docusaurus-ui": ["@widlarzgroup/[email protected]", "", { "peerDependencies": { "@docusaurus/core": "^3.9.2", "@docusaurus/theme-classic": "^3.9.2", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" } }, "sha512-ncO/RddO1/WwpRk+xs9GuQWbEWM2sy6Kj7byjwIyMfvcAqeyHJjXIASxLPCGqty+FPoEVqnBu1ASBez12tYABg=="],
1188+
"@widlarzgroup/docusaurus-ui": ["@widlarzgroup/[email protected]", "", { "peerDependencies": { "@docusaurus/core": "^3.9.2", "@docusaurus/theme-classic": "^3.9.2", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" } }, "sha512-Yf6RAG9phlapVlDQDRp6NvTr67GrSDNC4VpFEtBYGhfC5gR7UKX79+iBkJQlBFCSKQC4KR8kmNpDqxz4UQAnBQ=="],
1189+
1190+
"@widlarzgroup/eslint-plugin-docusaurus": ["@widlarzgroup/[email protected]", "", { "peerDependencies": { "@widlarzgroup/docusaurus-ui": "*", "eslint": ">=8.0.0" } }, "sha512-LKvLrUS5mqenAM3vgMPhcUR1dL2oc20xGJY3/zQX3NJuxWwnQf+qZQb04yE3QHoT1o/yup0M59Xfb0/pm/AnWQ=="],
11871191

11881192
"@xmldom/xmldom": ["@xmldom/[email protected]", "", {}, "sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw=="],
11891193

docs/.eslintrc.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
root: true,
3+
extends: ["../config/.eslintrc.js"],
4+
parserOptions: {
5+
tsconfigRootDir: __dirname,
6+
project: true,
7+
},
8+
plugins: ['@widlarzgroup/docusaurus'],
9+
settings: {
10+
'@widlarzgroup/docusaurus': {
11+
extend: ['src/css/custom.css'],
12+
},
13+
},
14+
overrides: [
15+
{
16+
files: ['**/*.css'],
17+
processor: '@widlarzgroup/docusaurus/.css',
18+
},
19+
],
20+
};

docs/docusaurus.config.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const config: Config = {
2020

2121
future: {
2222
experimental_faster: true,
23-
v4: true
23+
v4: true,
2424
},
2525

2626
i18n: {
@@ -37,7 +37,7 @@ const config: Config = {
3737
lastVersion: '6.x',
3838
includeCurrentVersion: true,
3939
versions: {
40-
current: {
40+
'current': {
4141
label: 'v7 Beta',
4242
path: 'v7',
4343
banner: 'none',
@@ -105,8 +105,8 @@ const config: Config = {
105105
{
106106
type: 'docsVersionDropdown',
107107
versions: {
108-
current: {label: 'v7 Beta'},
109-
'6.x': {label: 'v6'},
108+
'current': { label: 'v7 Beta' },
109+
'6.x': { label: 'v6' },
110110
},
111111
position: 'right',
112112
},
@@ -154,20 +154,20 @@ const config: Config = {
154154
{
155155
name: 'API Reference',
156156
entryPoints: ['../packages/react-native-video/src'],
157-
exclude: "../packages/react-native-video/src/index.ts",
157+
exclude: '../packages/react-native-video/src/index.ts',
158158
tsconfig: '../packages/react-native-video/tsconfig.json',
159159
out: './docs/api-reference',
160160
watch: process.env.TYPEDOC_WATCH,
161161
excludePrivate: true,
162162
excludeProtected: true,
163163
excludeExternals: true,
164164
excludeInternal: true,
165-
readme: "none",
165+
readme: 'none',
166166
sidebar: {
167167
autoConfiguration: false,
168168
},
169-
parametersFormat: "table",
170-
enumMembersFormat: "table",
169+
parametersFormat: 'table',
170+
enumMembersFormat: 'table',
171171
useCodeBlocks: true,
172172
},
173173
],
@@ -178,10 +178,10 @@ const config: Config = {
178178
id: 'llms-v6',
179179
generateLLMsTxt: false,
180180
generateLLMsFullTxt: false,
181-
docsDir: "versioned_docs/version-6.x",
181+
docsDir: 'versioned_docs/version-6.x',
182182
pathTransformation: {
183183
ignorePaths: ['docs'],
184-
addPaths: ['react-native-video/docs/v6']
184+
addPaths: ['react-native-video/docs/v6'],
185185
},
186186
version: '6.x.x',
187187
customLLMFiles: [
@@ -199,8 +199,8 @@ const config: Config = {
199199
includePatterns: ['**/*.md', '**/*.mdx'],
200200
fullContent: true,
201201
},
202-
]
203-
}
202+
],
203+
},
204204
],
205205
// LLMs txt generation for v7
206206
[
@@ -209,10 +209,10 @@ const config: Config = {
209209
id: 'llms-v7',
210210
generateLLMsTxt: false,
211211
generateLLMsFullTxt: false,
212-
docsDir: "docs",
212+
docsDir: 'docs',
213213
pathTransformation: {
214214
ignorePaths: ['docs'],
215-
addPaths: ['react-native-video/docs/v7']
215+
addPaths: ['react-native-video/docs/v7'],
216216
},
217217
version: '7.x.x',
218218
customLLMFiles: [
@@ -229,10 +229,10 @@ const config: Config = {
229229
description: 'Complete documentation for React Native Video v7',
230230
includePatterns: ['docs/**/*.md'],
231231
fullContent: true,
232-
}
233-
]
234-
}
235-
]
232+
},
233+
],
234+
},
235+
],
236236
],
237237
};
238238

docs/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
"serve": "docusaurus serve",
1313
"write-translations": "docusaurus write-translations",
1414
"write-heading-ids": "docusaurus write-heading-ids",
15-
"typecheck": "tsc"
15+
"typecheck": "tsc",
16+
"lint": "eslint ."
1617
},
1718
"dependencies": {
1819
"@docusaurus/core": "^3.8.1",
1920
"@docusaurus/faster": "^3.8.1",
2021
"@docusaurus/preset-classic": "^3.8.1",
2122
"@mdx-js/react": "^3.0.0",
22-
"@widlarzgroup/docusaurus-ui": "^0.0.2",
23+
"@widlarzgroup/docusaurus-ui": "^0.0.3",
2324
"clsx": "^2.0.0",
2425
"docusaurus-lunr-search": "^3.6.0",
2526
"prism-react-renderer": "^2.3.0",
@@ -30,9 +31,11 @@
3031
"@docusaurus/module-type-aliases": "^3.8.1",
3132
"@docusaurus/tsconfig": "^3.8.1",
3233
"@docusaurus/types": "^3.8.1",
33-
"typescript": "^5.2.2",
34+
"@widlarzgroup/eslint-plugin-docusaurus": "^0.0.1",
35+
"docusaurus-plugin-llms": "^0.1.5",
3436
"docusaurus-plugin-typedoc": "^1.4.0",
35-
"docusaurus-plugin-llms": "^0.1.5"
37+
"eslint": "^8.51.0",
38+
"typescript": "^5.2.2"
3639
},
3740
"browserslist": {
3841
"production": [

docs/sidebars.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
import type { SidebarsConfig } from "@docusaurus/plugin-content-docs";
1+
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
22

33
const sidebars: SidebarsConfig = {
44
docsSidebar: [
55
{
6-
type: "autogenerated",
7-
dirName: ".",
6+
type: 'autogenerated',
7+
dirName: '.',
88
},
99
{
10-
type: "html",
10+
type: 'html',
1111
value:
1212
'<hr style="margin: 1rem 0; border: none; border-top: 1px solid var(--ifm-color-emphasis-300);" />',
1313
},
1414
{
15-
type: "link",
16-
label: "Example Apps",
17-
href: "https://github.com/TheWidlarzGroup/react-native-video/tree/master/example",
15+
type: 'link',
16+
label: 'Example Apps',
17+
href: 'https://github.com/TheWidlarzGroup/react-native-video/tree/master/example',
1818
},
1919
{
20-
type: "doc",
21-
label: "Useful Projects",
22-
id: "projects",
20+
type: 'doc',
21+
label: 'Useful Projects',
22+
id: 'projects',
2323
},
2424
{
25-
type: "html",
25+
type: 'html',
2626
value:
2727
'<hr style="margin: 1rem 0; border: none; border-top: 1px solid var(--ifm-color-emphasis-300);" />',
2828
},
2929
{
30-
type: "link",
31-
label: "Offline Video SDK",
32-
href: "https://www.thewidlarzgroup.com/offline-video-sdk/?utm_source=rnv&utm_medium=docs&utm_campaign=sidebar&utm_id=offline-video-sdk-button",
30+
type: 'link',
31+
label: 'Offline Video SDK',
32+
href: 'https://www.thewidlarzgroup.com/offline-video-sdk/?utm_source=rnv&utm_medium=docs&utm_campaign=sidebar&utm_id=offline-video-sdk-button',
3333
},
3434
{
35-
type: "link",
36-
label: "Enterprise Support",
37-
href: "https://www.thewidlarzgroup.com/?utm_source=rnv&utm_medium=docs&utm_campaign=navbar&utm_id=enterprise#Contact",
35+
type: 'link',
36+
label: 'Enterprise Support',
37+
href: 'https://www.thewidlarzgroup.com/?utm_source=rnv&utm_medium=docs&utm_campaign=navbar&utm_id=enterprise#Contact',
3838
},
3939
{
40-
type: "link",
41-
label: "Boost Your Issue",
42-
href: "https://www.thewidlarzgroup.com/issue-boost/?utm_source=rnv&utm_medium=docs&utm_campaign=sidebar&utm_id=issue-boost-button",
40+
type: 'link',
41+
label: 'Boost Your Issue',
42+
href: 'https://www.thewidlarzgroup.com/issue-boost/?utm_source=rnv&utm_medium=docs&utm_campaign=sidebar&utm_id=issue-boost-button',
4343
},
4444
{
45-
type: "html",
45+
type: 'html',
4646
value:
4747
'<hr style="margin: 1rem 0; border: none; border-top: 1px solid var(--ifm-color-emphasis-300);" />',
4848
},
4949
{
50-
type: "doc",
51-
label: "Updating",
52-
id: "updating",
50+
type: 'doc',
51+
label: 'Updating',
52+
id: 'updating',
5353
},
5454
{
55-
type: "link",
56-
label: "Releases",
57-
href: "https://github.com/TheWidlarzGroup/react-native-video/releases",
55+
type: 'link',
56+
label: 'Releases',
57+
href: 'https://github.com/TheWidlarzGroup/react-native-video/releases',
5858
},
5959
],
6060
};

docs/src/components/HomepageFeatures/index.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,24 @@ const FeatureList: FeatureItem[] = [
1414
title: 'React Native First',
1515
Svg: require('@site/static/img/reactjs-icon.svg').default,
1616
description: (
17-
<>
18-
React Native Video is a video player created for React Native.
19-
</>
17+
<>React Native Video is a video player created for React Native.</>
2018
),
2119
},
2220
{
2321
title: 'Multi Subtitles & Audio Tracks',
2422
Svg: require('@site/static/img/download-icon.svg').default,
2523
description: (
26-
<>
27-
React Native Video supports multiple subtitles and audio tracks.
28-
</>
24+
<>React Native Video supports multiple subtitles and audio tracks.</>
2925
),
3026
},
3127
{
3228
title: 'DRM Protected Content',
3329
Svg: require('@site/static/img/drm-content-icon.svg').default,
34-
description: (
35-
<>
36-
React Native Video supports DRM protected content.
37-
</>
38-
),
30+
description: <>React Native Video supports DRM protected content.</>,
3931
},
4032
];
4133

42-
function Feature({title, Svg, description}: FeatureItem) {
34+
function Feature({ title, Svg, description }: FeatureItem) {
4335
return (
4436
<div className={clsx('col col--4')}>
4537
<div className="text--center">

docs/src/components/PlatformsList/PlatformsList.module.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
}
44

55
.spanStyle {
6-
/* font-family: var(--font-orbitron);
7-
font-weight: 800; */
8-
96
font-family: "Orbitron", sans-serif;
107
font-optical-sizing: auto;
118
font-weight: 800;

docs/src/components/PlatformsList/PlatformsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface Platforms {
1414
types: Platform[];
1515
}
1616

17-
function PlatformsList({types}: Platforms) {
17+
function PlatformsList({ types }: Platforms) {
1818
return (
1919
<p className={styles.paragraphStyle}>
2020
{types.length === 1 && !types.includes('All')

docs/src/css/custom.css

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
/**
2+
* Custom CSS for this project.
3+
*
4+
* We import base styles from @widlarzgroup/docusaurus-ui which:
5+
* - Overrides default Infima variables with our custom design system
6+
* - Provides new CSS variables for colors (--color-accent-*, --color-secondary-*, etc.)
7+
* - Adds custom component styles and utilities
8+
*
9+
* You can further customize any CSS variables here - they will take
10+
* precedence over both Infima defaults and the imported package styles.
11+
*/
112
@import '@widlarzgroup/docusaurus-ui/css/custom.css';
213

3-
/**
4-
* Any CSS included here will be global. The classic template
5-
* bundles Infima by default. Infima is a CSS framework designed to
6-
* work well for content-centric websites.
7-
*/
14+
/* Add your custom overrides below */

0 commit comments

Comments
 (0)