Skip to content

Commit

Permalink
fix: make small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tefkah committed Mar 9, 2023
1 parent 11b416b commit 3c87afc
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 22 deletions.
4 changes: 3 additions & 1 deletion libs/jast/jast/src/lib/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,6 @@ export const names = [
'year',
]

function ignore() {}
function ignore() {
//
}
2 changes: 1 addition & 1 deletion libs/jast/jast/src/lib/rejour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface Element extends UnistNode {
}

export function isElement(node: UnistNode): node is Element {
return node.hasOwnProperty('name') && node.hasOwnProperty('attributes')
return 'name' in node && 'attributes' in node
}

export function isParagraphContent(node: UnistNode): node is P['children'][number] {
Expand Down
6 changes: 3 additions & 3 deletions libs/rejour/rejour-parse/src/lib/rejour-parse.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { unified } from 'unified'
import rejourParse from './rejour-parse'
import rejourParse from './rejour-parse.js'
import { removePosition } from 'unist-util-remove-position'

describe('parser', () => {
Expand All @@ -26,7 +26,7 @@ describe('parser', () => {
</article>`),
true
true,
)
console.dir(tree, { depth: null })
expect(tree).toEqual({
Expand All @@ -48,7 +48,7 @@ describe('parser', () => {
</article>`),
true
true,
)
console.dir(tree, { depth: null })
expect(tree).toEqual({
Expand Down
2 changes: 1 addition & 1 deletion libs/texast/texast-util-to-latex/src/lib/configure.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Options, Context } from './types'
import { Options, Context } from './types.js'

export function configure(base: Context, extension: Options): Context {
let index = -1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { AlignmentTab } from 'texast'
import { BasicHandle, Options } from '../types'
import { BasicHandle, Options } from '../types.js'

export const alignmentTab: BasicHandle = (
node: AlignmentTab,
options: Options = {}
) => {
export const alignmentTab: BasicHandle = (node: AlignmentTab, options: Options = {}) => {
return ' & '
}
12 changes: 3 additions & 9 deletions libs/texast/texast-util-to-latex/src/lib/texast-util-to-latex.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { handle } from './handle'
import { zwitch } from 'zwitch'
import { configure } from './configure'
import { Options, Context, Node, Handle, Join, Unsafe } from './types'
import { handle } from './handle/index.js'
import { Options, Node } from './types.js'
import { isKnownNode } from 'texast'

const invalid = (value: unknown) => {
Expand All @@ -11,11 +9,7 @@ const unknown = (node: Node) => {
throw new Error(`Unknown type ${node.type}, skipping...`)
}

const handleNodeProperly = (
type: string,
node: Node,
options: Options = {}
) => {
const handleNodeProperly = (type: string, node: Node, options: Options = {}) => {
// @ts-expect-error No it's fine we can throw everything into it
const handleFunction = handle?.[type]

Expand Down
4 changes: 2 additions & 2 deletions libs/texast/texast-util-to-latex/src/lib/util/safe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Context, SafeOptions } from '../types'
import { Context, SafeOptions } from '../types.js'

/**
* @param {Context} context
Expand All @@ -9,7 +9,7 @@ import { Context, SafeOptions } from '../types'
export function safe(
context: Context,
input: string | null | undefined,
config: SafeOptions & { encode?: Array<string> }
config: SafeOptions & { encode?: Array<string> },
): string {
return input || ''
}

0 comments on commit 3c87afc

Please sign in to comment.