Skip to content

Commit

Permalink
style: fix after linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Oct 20, 2023
1 parent 2a81d9f commit 11193e3
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"*.ts": "npm run lint && vitest related --run"
"*.ts": ["npm run lint", "vitest related --run"]
}
10 changes: 3 additions & 7 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @namespace tree
*/
function Api() {
export default function Api() {
this.walk = walk;
this.match = match;
}
Expand All @@ -35,7 +35,7 @@ function Api() {
* }
* ```
*/
function walk(cb) {
export function walk(cb) {
return traverse(this, cb);
}

Expand Down Expand Up @@ -78,7 +78,7 @@ function walk(cb) {
* }
* ```
*/
function match(expression, cb) {
export function match(expression, cb) {
return Array.isArray(expression)
? traverse(this, (node) => {
for (let i = 0; i < expression.length; i++) {
Expand All @@ -94,10 +94,6 @@ function match(expression, cb) {
});
}

module.exports = Api;
module.exports.match = match;
module.exports.walk = walk;

/** @private */
function traverse(tree, cb) {
if (Array.isArray(tree)) {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class PostHTML {
* const ph = posthtml([ plugin() ])
* ```
*/
module.exports = (plugins) => new PostHTML(plugins);
export default (plugins) => new PostHTML(plugins);

/**
* Extension of options tree
Expand Down
4 changes: 2 additions & 2 deletions test/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import path from "path";

import { describe, expect, it } from "vitest";

const { parser } = require("posthtml-parser");
const { render } = require("posthtml-render");
import { parser } from "posthtml-parser";
import { render } from "posthtml-render";

const html = readFileSync(path.resolve(__dirname, "templates/parser.html"), "utf8");

Expand Down
4 changes: 2 additions & 2 deletions test/plugins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("Plugins", () => {
});

it.skip("should return original for resultless plugins", async () => {
const result = await posthtml([(json) => {}]).process(tree, {
const result = await posthtml([() => {}]).process(tree, {
skipParse: true,
});
expect(result).toMatchObject({ tree });
Expand All @@ -58,7 +58,7 @@ describe("Plugins", () => {
it("options default", async () => {
const result = await posthtml()
.use((json) => json)
.use((json) => {})
.use(() => {})
.process(html, {});

expect(result).toMatchObject({ html });
Expand Down
4 changes: 2 additions & 2 deletions types/posthtml.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ declare namespace PostHTML {

export interface Options {
sync?: boolean;
parser?: Function;
render?: Function;
parser?: () => void;
render?: () => void;
skipParse?: boolean;
}

Expand Down

0 comments on commit 11193e3

Please sign in to comment.