Commit graph

78 commits

Author SHA1 Message Date
Sébastien Lorber
90a8ca387e
chore: prevent importing theme components with relative paths (#7674) 2022-06-24 17:22:44 +02:00
Sébastien Lorber
9473508c33
refactor(theme-common): split package into public/internal API entrypoints (#7660)
* add theme-common/internal export

* Split @docusaurus/theme-common into public/internal apis

* fixes

* public <-> private

* public <-> private

* public <-> private

* fix

* add "removeThemeInternalReexport" CI script

* :s windows CI check not working: not that useful

* remove bad import

* refactors

* reorder

* make useBackToTopButton internal

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
2022-06-24 11:21:27 +02:00
Joshua Chen
b4d93b9bd0
chore: upgrade to TS 4.7, compile with NodeNext (#7586)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
2022-06-15 19:15:11 +02:00
Joshua Chen
7869e74fd7
refactor(pwa): simplify registerSW code, fix ESLint errors (#7579) 2022-06-07 21:42:17 +08:00
Joshua Chen
9023b7740c
refactor: remove sub-eslintrc, fix more lint errors (#7530) 2022-05-30 14:49:51 +08:00
Joshua Chen
624735bd92
refactor: fix more type-aware linting errors (#7479) 2022-05-24 19:19:24 +08:00
Joshua Chen
0838884f67
chore: enable import/order rule (#7418) 2022-05-14 23:39:50 +08:00
Joshua Chen
afc72480ab
refactor(eslint-plugin): migrate to TS-ESLint infrastructure (#7276)
* refactor(eslint-plugin): migrate to TS-ESLint infrastructure

* fix lock
2022-04-30 17:57:57 +08:00
Elias Papavasileiou
3b1170eb44
feat: Docusaurus ESLint plugin to enforce best Docusaurus practices (#7206)
* feat: add eslint plugin

* refactor

* add tests

* fixups!

* fix(no-dynamic-i18n-messages): make translate() recognize template literals

* refactor: rename rule no-dynamic-i18n-messages --> string-literal-i18n-messages

* feat: add ignoreStrings option and refactor

* docs: migrate docs to /docs/api/plugins

* docs: fix anchor links in README.md

* fix: add some ignored strings

* docs: update eslint-plugin docs

* fix: update README link

* docs: various updates

- Reorder sidebar entries
- Fix title size
- Use Markdown file paths
- Simplify relative links

* address reviews

* wording polish

* add npmignore

* fix all internal warnings

* doc improvements

* fix test

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
2022-04-30 00:04:25 +08:00
Joshua Chen
242f2e780e
chore: upgrade dependencies (#7232) 2022-04-23 11:55:01 +08:00
Joshua Chen
87592bca03
refactor: ensure all types are using index signature instead of Record (#6995)
* refactor: ensure all types are using index signature instead of Record

* kick CI
2022-03-25 18:06:30 +08:00
Felipe Santos
4b3f568b78
fix(content-docs): suppress git error on multiple occurrences (#6973) 2022-03-23 16:35:26 +01:00
Felipe Santos
e19a4e23e7
fix(content-docs): warn when files are not tracked (#6937)
* fix(docs): warn when files are not tracked

* chore(devcontainer): use non-root user

* test: fix jest in vscode

* test(docs): improve existing test

* chore(devcontainer): fix jest error on startup

* chore: fix comments

* chore: remove "probably" from error message
2022-03-21 08:42:36 +08:00
Joshua Chen
cc0bceab9c
chore: tighten ESLint config (#6931)
* chore: tighten ESLint config

* more refactor

* refactor push

* fix
2022-03-17 17:59:41 +08:00
Joshua Chen
3a4b9b4c30
refactor: install eslint-plugin-regexp (#6906)
* refactor: install eslint-plugin-regexp

* simplify

* simplify

* fix
2022-03-13 18:32:17 +08:00
Joshua Chen
f6baaa6b75
test(theme-common): improve test coverage (#6902)
* test(theme-common): improve test coverage

* revert
2022-03-12 13:17:21 +08:00
Joshua Chen
aa5a2d4c04
test: enable a few jest eslint rules (#6900)
* test: enable a few jest eslint rules

* more
2022-03-12 08:43:09 +08:00
Joshua Chen
c9ee6e467c
refactor: import jest as global; unify import style of some modules (#6898)
* refactor: import jest as global

* fix react
2022-03-11 19:04:27 +08:00
Joshua Chen
6cbc58943e
feat: allow blog authors email (#6783) 2022-03-02 16:28:17 +01:00
Joshua Chen
39b66d82ef
feat(core): rework swizzle CLI (#6243)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
2022-02-25 14:13:15 +01:00
Joshua Chen
0d14470d54
refactor: unify export directive style (#6751) 2022-02-24 17:25:17 +08:00
Joshua Chen
c6d0d812eb
refactor: convert all fs methods to async (#6725)
* refactor: convert all fs methods to async

* fix snap
2022-02-20 10:21:33 +08:00
Joshua Chen
ea6ceaa371
refactor: ensure lodash is default-imported (#6716) 2022-02-19 18:15:02 +08:00
Joshua Chen
45f6f8b869
chore: fix ESLint warnings, restrict export all syntax (#6605)
* chore: fix ESLint warnings, forbid export all syntax

* fix...

* reorder
2022-02-04 21:57:10 +08:00
Joshua Chen
759952cefd
misc: enable jsx-key eslint rule (#6584) 2022-02-02 19:22:26 +08:00
Joshua Chen
1cefb643dd
refactor: enforce named capture groups; clean up regexes (#6524)
* refactor: enforce named capture groups; clean up regexes

* fixes

* fix
2022-02-01 17:43:15 +08:00
Joshua Chen
aa446b7a9c
chore: clean up ESLint config, enable a few rules (#6514)
* chore: clean up ESLint config, enable a few rules

* enable max-len for comments

* fix build
2022-01-31 10:31:24 +08:00
Nick Schonning
16141fcd80
chore: enable a few fixable ESLint rules (#6380)
* chore: enable react/jsx-one-expression-per-line

* chore: enable import/first

* chore: enable lines-between-class-members

* revert class spacing

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
2022-01-17 14:25:50 +08:00
Joshua Chen
52db7320a6
chore: enable eslint-plugin-jest (#6375) 2022-01-16 15:53:23 +08:00
Nick Schonning
6e75d035bb
chore: enable react/jsx-closing-bracket-location (#6373)
This no longer appears to conflict with prettier
2022-01-16 12:41:17 +08:00
Joshua Chen
4fad1ce0cd
misc: convert all internal scripts to ESM (#6286)
* misc: convert all internal scripts to ESM

* fixes

* fix

* fixes

* fix!

* complete eslint

* more move

* fix!

* This looks better?

* Final ones
2022-01-08 12:59:28 +08:00
Sébastien Lorber
3bc63b2b09
refactor(theme-classic): apply import/no-named-export eslint rule (#6283) 2022-01-07 14:44:55 +01:00
Joshua Chen
cb1aa30286
refactor: enforce type import specifiers (#6230)
* refactor: enforce type import specifiers

* fix

* Upgrade esbuild

* Fix (haha)
2021-12-31 21:17:09 +08:00
Joshua Chen
770418f8d2
refactor: unify log format with new logger utility (#5994)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
2021-12-20 17:24:59 +01:00
Joshua Chen
bfd7fd9d8a
refactor: minor ESLint improvements (#5981)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
2021-12-03 17:38:29 +01:00
Sébastien Lorber
cfae5d0933
feat(content-docs): sidebar category linking to document or auto-generated index page (#5830)
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
Co-authored-by: Armano <armano2@users.noreply.github.com>
Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
2021-12-03 14:44:59 +01:00
Joshua Chen
0374426ce3
chore: upgrade TypeScript & other ESLint related deps (#5963)
* chore: upgrade ESLint related deps

* Upgrade TS

* Fix lock

* Bump Babel

* Update config
2021-11-18 21:15:37 +08:00
Joshua Chen
e0127c66be
chore(website): enable eslint in website (#5889)
* chore: enable eslint in website

* Fixes

* prettier users
2021-11-06 19:04:45 +08:00
Joshua Chen
1363a25819
refactor: use js-yaml to parse both JSON and YAML (#5806) 2021-11-03 17:55:14 +01:00
Joshua Chen
7a6607cfa1
refactor: remove a few Lodash usages & ESLint enforcement (#5807)
* refactor: remove some lodash usage

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Enforce ESLint

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* More forbids

* Fixup

* Fix

* Fix website
2021-10-28 12:48:58 +08:00
Sébastien Lorber
098f210890
chore: Enable ESLint rules of hooks + fix new lint errors (#5714) 2021-10-20 16:09:52 +02:00
Sébastien Lorber
f6ec757aa0
feat: npm init docusaurus, yarn create docusaurus (#5635)
* initial create-docusaurus impl

* cleanup

* @docusaurus/init renamed to create-docusaurus

* 0.0.6

* update lockfile

* fix lint

* remove npm2yarn for "npm init" because npm2yarn doesn't convert it and yarn result fails to execute

* prettier

* add correct version

* prettier

* prettier

* prettier

* prettier

* fix annoying --config .prettierrc issue
2021-10-07 16:06:42 +02:00
Joshua Chen
7f7b858cd4
refactor: make all Props defined as interface + readonly (#5636)
* Initial work

* Fix
2021-10-05 19:04:24 +02:00
Sébastien Lorber
42e70e6d42
feat: new docs options: versions.{badge,className} (#5454)
* docs: add versions.{badge,className} options

* remove badge option test
2021-08-31 15:40:37 +02:00
Joshua Chen
3fc47938a5
chore(mdx-loader): migrate package to TypeScript (#5347)
* Polish code style

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Partly done migration

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Complete typing

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix tests

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* A-ha

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Cleanup

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix error

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Cleanup

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
2021-08-12 14:55:14 +02:00
Sébastien Lorber
a2ab4d33c8
feat: Markdown page-specific head metadatas (#5330)
* Markdown page-specific head metadatas

* ensure mdxType attribute is not added to the final markup

* polish doc

* Update packages/docusaurus-theme-classic/src/theme/MDXComponents/index.tsx

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>

* fix eslint annoying rule error

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
2021-08-11 11:39:01 +02:00
Joshua Chen
28e25992ab
feat: new init template classic-typescript (#5233)
* Add typescript template

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Update template

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Complete CLI

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Remove d.ts file

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Refactor

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Revert lock file changes

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Regenerate lock

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Add stylelint ignore

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix tsconfig

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Attempt to use symlink

* More symlinks

* Link all markdown

* Link source files

* Change to relative links

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix blogs

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix link

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Link config

* Documentation

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Add option to index

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Add option

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix copying

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Provide suffix

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Always have colored output

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Remove return signature

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Update generate examples

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Update lock

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix tsconfig

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Use latest docusaurus

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Update lock

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Add type def

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* init: make classic first in list + mark as recommended + minor refactors

* remove types.d.ts

* add "yarn typecheck" script

* Minor tweaks

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Generate example for TS

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Add comment

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* No emit when running tsc

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* FIx generate examples

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Remove compiler options

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* This looks better

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Use new tsconfig

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-08-06 19:11:36 +02:00
Joshua Chen
462b1cf2bc
style(v2): reduce number of ESLint warnings (#4993)
* Initial work

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* More fixes

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Update packages/docusaurus-theme-classic/src/theme/ThemedImage/index.tsx

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>

* Update packages/docusaurus-theme-bootstrap/src/theme/ThemedImage/index.tsx

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>

* Fix

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Replace versionPathPart with function

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Prefer non-null assertions

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Substitute for-of with forEach

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fill `catch` block with placeholder comment

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Ignore local require

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Revert global require change

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Tighten eslint disable range

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Make eslint ignore examples and more tolerating to templates

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Use reduce to handle doc items sequentially

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Revert "Use reduce to handle doc items sequentially"

This reverts commit c7525d463b.

* Address change requests

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
2021-06-24 18:12:48 +02:00
Armano
15107ee099
refactor(v2): correct client types and type aliases (#4451) 2021-03-19 11:32:38 +01:00
Sam Zhou
83d043ecb3
chore(v2): Fix more linter warnings (#4450) 2021-03-18 18:05:09 +01:00