Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
cache: 'yarn'
- name: Install
run: yarn install --immutable
- name: Prettier
run: yarn prettier:check
- name: Lint
run: yarn lint
- name: Build
run: yarn build
- name: Test
Expand Down
9 changes: 9 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"trailingComma": "all",
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"sortPackageJson": false,
"ignorePatterns": ["*.md", "*.yml", "*.yaml"]
}
6 changes: 6 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["eslint", "typescript", "unicorn", "oxc", "import"],
"categories": { "correctness": "warn" },
"options": { "typeAware": true }
}
7 changes: 0 additions & 7 deletions .prettierrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"@semantic-release/npm",
"@semantic-release/github"
],
"branches": [ "main" ]
"branches": ["main"]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"**/dist": true
},
"typescript.tsdk": "node_modules/typescript/lib"
}
}
18 changes: 13 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"scripts": {
"build": "tsc",
"prepublishOnly": "yarn build",
"prettier:check": "prettier --list-different \"src/**/*.{ts,tsx}\"",
"prettier:write": "prettier --write \"src/**/*.{ts,tsx}\"",
"lint": "oxfmt --check . && oxlint",
"lint:fix": "oxfmt --write . && oxlint --fix",
"test": "tsc --noEmit -p tests && vitest run",
"prepare": "husky"
},
Expand All @@ -37,8 +37,10 @@
"@vitest/coverage-v8": "3.0.5",
"husky": "^9.1.6",
"lint-staged": "^16.2.7",
"prettier": "^3.3.3",
"typescript": "^5.8.3",
"oxfmt": "^0.44.0",
"oxlint": "^1.59.0",
"oxlint-tsgolint": "^0.20.0",
"typescript": "^6.0.2",
"vitest": "^4.0.18"
},
"dependencies": {
Expand All @@ -51,7 +53,13 @@
"pretty-ms": "^9.1.0"
},
"lint-staged": {
"*.ts": "prettier --write"
"*.{js,ts}": [
"oxfmt --write",
"oxlint --fix"
],
"*.json": [
"oxfmt --write"
]
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const {
},
});

let safePackageMode = packageMode as 'single' | 'multi' | string;
let safePackageMode = packageMode as string;

if (safePackageMode !== 'single' && safePackageMode !== 'multi') {
console.error(chalk.red('packageMode must be one of "single" and "multi"'));
Expand Down Expand Up @@ -79,7 +79,7 @@ runner.text = chalk.cyan(`Generating API in directory: ${chalk.yellow(`"${resolv

const start = Date.now();

fs.promises.mkdir(resolvedOutDir, { recursive: true }).then(() =>
void fs.promises.mkdir(resolvedOutDir, { recursive: true }).then(() =>
parseDocs({
useReadme: useReadme ? true : false,
baseDirectory: resolvedDir,
Expand Down
2 changes: 1 addition & 1 deletion src/block-parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type GuessedParam = {

export const guessParametersFromSignature = (signature: string) => {
expect(signature).to.match(
/^\(([a-zA-Z,\[\] ]+|(\.\.\.[^\.])|([a-zA-Z][0-9]))+\)$/g,
/^\(([a-zA-Z,[\] ]+|(\.\.\.[^.])|([a-zA-Z][0-9]))+\)$/g,
'signature should be a bracket wrapped group of parameters',
);
const justParams = signature.slice(1, signature.length - 1);
Expand Down
6 changes: 3 additions & 3 deletions src/markdown-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export const getTopLevelGenericType = (typeString: string) => {
)
return null;
const start = typeString.indexOf('<');
const end = typeString.length - [...typeString].reverse().indexOf('>') - 1;
const end = typeString.length - Array.from(typeString).reverse().indexOf('>') - 1;
if (start === -1) return null;
return {
outerType: typeString.slice(0, start),
Expand Down Expand Up @@ -645,7 +645,7 @@ export const extractReturnType = (
}

const returnsWithNewLineMatch = description.match(
new RegExp(`${prefix} \`([^\`]+?)\`:?(\. |\.\n|\n|$)`),
new RegExp(`${prefix} \`([^\`]+?)\`:?(. |.\n|\n|$)`),
);
const returnsWithHyphenMatch = description.match(new RegExp(`${prefix} \`([^\`]+?)\` - `));
const returnsWithContinousSentence = description.match(new RegExp(`${prefix} \`([^\`]+?)\` `));
Expand Down Expand Up @@ -1004,7 +1004,7 @@ export const findProcess = (tokens: Token[]): ProcessBlock => {

export const slugifyHeading = (heading: string): string => {
return heading
.replace(/[^A-Za-z0-9 \-]/g, '')
.replace(/[^A-Za-z0-9 -]/g, '')
.replace(/ /g, '-')
.toLowerCase();
};
6 changes: 0 additions & 6 deletions tests/DocsParser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import { afterEach, assert, beforeEach, describe, expect, it } from 'vitest';
import fs from 'node:fs';
import path from 'node:path';
import { DocsParser } from '../src/DocsParser.js';
import type {
ModuleDocumentationContainer,
ClassDocumentationContainer,
ElementDocumentationContainer,
StructureDocumentationContainer,
} from '../src/ParsedDocumentation.js';

describe('DocsParser', () => {
let tempDir: string;
Expand Down
Loading