diff --git a/.eslintignore b/.eslintignore index 3bdd8657..ea717d99 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,8 +2,6 @@ public .next package-lock.json yarn.lock -/public/_docs.page/shiki/themes/ -/public/_docs.page/shiki/languages/ bundler/dist dist build diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml index 3046e1ab..6884e635 100644 --- a/.github/workflows/website.yaml +++ b/.github/workflows/website.yaml @@ -20,20 +20,3 @@ jobs: run: yarn run check:linting - name: Check Formatting run: yarn run check:formatting - # TODO: refactor to tsc on individual packages - # - name: Check TS Compiles - # run: yarn run check:typescript - # - name: Check Spelling & Grammar - # run: yarn run check:spelling - # TODO: tests need fixing - # test: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - uses: actions/setup-node@v2-beta - # with: - # node-version: '14' - # - name: NPM Install - # run: yarn - # - name: Jest Tests - # run: yarn run test diff --git a/.prettierignore b/.prettierignore index a927018b..710d6dd5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,7 +2,6 @@ node_modules build dist -repositories.json domains.json spelling.json _docs.page \ No newline at end of file diff --git a/.sample.env b/.sample.env deleted file mode 100644 index 9cbf109d..00000000 --- a/.sample.env +++ /dev/null @@ -1 +0,0 @@ -GITHUB_PAT=1234 \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 97bef4c5..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "typescript.tsdk": "./node_modules/typescript/lib" -} diff --git a/__tests__/config.test.ts b/__tests__/config.test.ts deleted file mode 100644 index 08476936..00000000 --- a/__tests__/config.test.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { mergeConfig, ProjectConfig } from '../src/utils/projectConfig'; - -function isValidConfigTypes(config: ProjectConfig) { - expect(typeof config.name).toBe('string'); - expect(typeof config.logo).toBe('string'); - expect(typeof config.theme).toBe('string'); - expect(Array.isArray(config.navigation)).toBe(true); - expect(Array.isArray(config.sidebar)).toBe(true); - expect(typeof config.headerDepth).toBe('number'); -} - -describe('conifg', () => { - it('should mergeConfig data with any invalid value', () => { - isValidConfigTypes(mergeConfig(null)); - }); - - it('should mergeConfig data with any valid value', () => { - const merged = mergeConfig({ - name: 'foo', - logo: 'bar', - theme: 'baz', - docsearch: { - apiKey: 'foo', - indexName: 'bar', - }, - headerDepth: 1234, - }); - - isValidConfigTypes(merged); - expect(merged.name).toBe('foo'); - expect(merged.logo).toBe('bar'); - expect(merged.theme).toBe('baz'); - expect(merged.theme).toBe('baz'); - expect(merged.docsearch?.apiKey).toBe('foo'); - expect(merged.docsearch?.indexName).toBe('bar'); - expect(merged.headerDepth).toBe(1234); - }); - - // TODO test merge navigation - // TODO test merge sidebars -}); diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts deleted file mode 100644 index 6be499b9..00000000 --- a/__tests__/index.test.ts +++ /dev/null @@ -1,5 +0,0 @@ -describe('Foo', () => { - it('should return true', () => { - expect(true).toEqual(true); - }); -}); diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts deleted file mode 100644 index f0899839..00000000 --- a/__tests__/utils.test.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { getString, getNumber, getBoolean } from '../src/utils'; - -describe('utils', () => { - describe('getString', () => { - it('returns a string value if provided', () => { - const obj = { - foo: { - bar: 'foo', - }, - bar: 'foo', - baz: [ - { - foo: 'foo', - }, - 'foo', - ], - }; - - expect(getString(obj, 'foo.bar', 'baz')).toBe('foo'); - expect(getString(obj, 'bar', 'baz')).toBe('foo'); - expect(getString(obj, 'baz[0].foo', 'baz')).toBe('foo'); - expect(getString(obj, 'baz[1]', 'baz')).toBe('foo'); - }); - - it('returns a default string value if provided value is not a string', () => { - const obj = { - foo: { - bar: 123, - }, - }; - - expect(getString(obj, 'foo.bar', 'foo')).toBe('foo'); - }); - }); - - describe('getNumber', () => { - it('returns a number value if provided', () => { - const obj = { - foo: { - bar: 1234, - }, - bar: 1234, - baz: [ - { - foo: 1234, - }, - 1234, - ], - }; - - expect(getNumber(obj, 'foo.bar', 9876)).toBe(1234); - expect(getNumber(obj, 'bar', 9876)).toBe(1234); - expect(getNumber(obj, 'baz[0].foo', 9876)).toBe(1234); - expect(getNumber(obj, 'baz[1]', 9876)).toBe(1234); - }); - - it('returns a default number value if provided value is not a number', () => { - const obj = { - foo: { - bar: '123', - }, - }; - - expect(getNumber(obj, 'foo.bar', 9876)).toBe(9876); - }); - }); - - describe('getBoolean', () => { - it.only('returns a boolean value if provided', () => { - const obj = { - foo: true, - bar: false, - }; - - expect(getBoolean(obj, 'foo', false)).toBe(true); - expect(getBoolean(obj, 'bar', true)).toBe(false); - }); - - it('returns a boolean value if returned value is string truthy', () => { - const obj = { - foo: 'true', - bar: 'false', - }; - - expect(getBoolean(obj, 'foo', false)).toBe(true); - expect(getBoolean(obj, 'bar', true)).toBe(false); - }); - - it('returns a default number value if provided value is not a boolean', () => { - const obj = { - bar: 'foo', - baz: 1, - }; - - expect(getBoolean(obj, 'foo', true)).toBe(true); - expect(getBoolean(obj, 'baz', false)).toBe(false); - }); - }); -}); diff --git a/api/src/bundler/plugins/rehype-code-blocks.ts b/api/src/bundler/plugins/rehype-code-blocks.ts index 855ab9c8..18ba940a 100644 --- a/api/src/bundler/plugins/rehype-code-blocks.ts +++ b/api/src/bundler/plugins/rehype-code-blocks.ts @@ -20,6 +20,7 @@ const languages = shiki.BUNDLED_LANGUAGES.reduce( * @returns */ export default function rehypeCodeBlocks(): (ast: Node) => void { + // eslint-disable-next-line @typescript-eslint/no-explicit-any function visitor(node: any, _i: number, parent: any) { if (!parent || parent.tagName !== 'pre' || node.tagName !== 'code') { return; @@ -67,6 +68,7 @@ function extractTitle(meta: string): string | null { } // Get the programming language of `node`. +// eslint-disable-next-line @typescript-eslint/no-explicit-any function getLanguage(node: any): string | undefined { const className = node.properties.className || []; let index = -1; diff --git a/api/src/bundler/plugins/rehype-headings.ts b/api/src/bundler/plugins/rehype-headings.ts index 62f7a868..e02e0e08 100644 --- a/api/src/bundler/plugins/rehype-headings.ts +++ b/api/src/bundler/plugins/rehype-headings.ts @@ -1,7 +1,7 @@ import { visit } from 'unist-util-visit'; import { hasProperty } from 'hast-util-has-property'; import { headingRank } from 'hast-util-heading-rank'; -import type { Node, Content } from 'hast-util-heading-rank/lib'; +import type { Node } from 'hast-util-heading-rank/lib'; import { toString } from 'mdast-util-to-string'; import { parseSelector } from 'hast-util-parse-selector'; import { Data as UnistData, Node as UnistNode } from 'unist'; @@ -81,8 +81,7 @@ const wrapSection: (children: HastElement[], id: string) => HastElement = (child return wrap; }; -const headingTest: (node: Node) => boolean = node => - !!headingRank(node) && hasProperty(node, 'id'); +const headingTest: (node: Node) => boolean = node => !!headingRank(node) && hasProperty(node, 'id'); // partition an array based on a test function, e.g [a,b,b,b,a,b,b,a,b] should become [[a,b,b,b],[a,b,b],[a,b]] function partition(array: T[], test: (input: T) => boolean): T[][] { diff --git a/api/tsconfig.json b/api/tsconfig.json index 19968dce..f8000d1a 100644 --- a/api/tsconfig.json +++ b/api/tsconfig.json @@ -10,6 +10,6 @@ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, "skipLibCheck": true /* Skip type checking of declaration files. */, "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */, - "typeRoots": ["node_modules/@types"], + "typeRoots": ["node_modules/@types"] } } diff --git a/dictionary.js b/dictionary.js deleted file mode 100644 index c011b23f..00000000 --- a/dictionary.js +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = [ - // e.g. FooBar - /^[A-Z].*/, - // e.g. fooBar or .fooBar - /^\.?[a-z0-9].*[A-Z0-9].*/, - // e.g foo_bar or foo-bar-baz - /^[a-z]*[-_][a-z]+.*/, - // e.g. package:melos or dark:bg-blue, - /^[A-Za-z]+:.*/, - - 'config', - 'dev', - 'docsearch', - 'docsify', - 'favicon', - 'frontmatter', - 'invertase', - 'ios', - 'json', - 'linkable', - 'indexable', - 'md', - 'melos', - 'noindex', - 'npm', - 'parsable', - 'revalidate', - 'src', - 'theming', - 'txt', - 'zoomable', - 'subdirectory', -]; diff --git a/docs/components/callouts.mdx b/docs/components/callouts.mdx index 54a5f505..bcc34454 100644 --- a/docs/components/callouts.mdx +++ b/docs/components/callouts.mdx @@ -45,4 +45,4 @@ Displays a green box with a check icon, useful for showing the user they did som ```jsx This draws attention to a successful action the user has taken. -``` \ No newline at end of file +``` diff --git a/docs/components/code-blocks.mdx b/docs/components/code-blocks.mdx index 5c1caaa6..563888fc 100644 --- a/docs/components/code-blocks.mdx +++ b/docs/components/code-blocks.mdx @@ -42,11 +42,11 @@ export async function apiRequest(options) { The above code block was created with the following snippet: -```text +````text ```javascript export async function apiRequest(options) { // ... -``` +```` Syntax highlighting is generated using [Shiki](https://github.com/shikijs/shiki). You can find a list of [supported languages here](https://github.com/shikijs/shiki/blob/main/docs/languages.md#all-languages). @@ -65,15 +65,15 @@ export async function apiRequest(options) { The above code block was created with the following snippet: -```text +````text ```javascript title="Sending a request" export async function apiRequest(options) { // ... -``` +```` ## Code Groups -You can group multiple code blocks together by using the `` component. This is useful for showing +You can group multiple code blocks together by using the `` component. This is useful for showing variations of the "same" code in a different language @@ -81,15 +81,16 @@ variations of the "same" code in a different language console.log("Hello World"); ``` - ```python - print('Hello World!') - ``` +```python +print('Hello World!') +``` + +```dart +void main() { + print('Hello World!'); +} +``` - ```dart - void main() { - print('Hello World!'); - } - ``` Specify each of the code blocks and their language as children of the component. diff --git a/docs/components/tabs.mdx b/docs/components/tabs.mdx index ebfb9283..8fcaff3b 100644 --- a/docs/components/tabs.mdx +++ b/docs/components/tabs.mdx @@ -96,6 +96,7 @@ First, import the package: ```js import axios from 'axios'; ```` + Add the `dio` package: @@ -109,6 +110,7 @@ First, import the package: ```dart import 'package:dio/dio.dart'; ``` + @@ -122,16 +124,10 @@ Next, perform a network request to 'https://example.com': ]} > - ```js - const response = await axios.get('https://example.com'); - console.log(response.data); - ```` + ```js const response = await axios.get('https://example.com'); console.log(response.data); ```` - ```dart - var dio = Dio(); - final response = await dio.get('https://example.com'); - print(response.data); - ```` + ```dart var dio = Dio(); final response = await dio.get('https://example.com'); + print(response.data); ```` - \ No newline at end of file + diff --git a/docs/components/video.mdx b/docs/components/video.mdx index 55cebeca..b1c3e441 100644 --- a/docs/components/video.mdx +++ b/docs/components/video.mdx @@ -12,4 +12,3 @@ A general purpose video component, extends the HTML `