Skip to content

Commit

Permalink
chore(deps): update packages, linting
Browse files Browse the repository at this point in the history
  • Loading branch information
simonseyock committed Mar 13, 2023
1 parent f9dccdb commit fe012ae
Show file tree
Hide file tree
Showing 12 changed files with 4,721 additions and 3,753 deletions.
2 changes: 1 addition & 1 deletion decs.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare module 'catharsis' {
export const parse: (input: string, options?: { jsdoc?: boolean}) => any
export const parse: (input: string, options?: { jsdoc?: boolean }) => any
}

declare module 'jsdoctypeparser' {
Expand Down
8,353 changes: 4,660 additions & 3,693 deletions package-lock.json

Large diffs are not rendered by default.

41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"preversion": "npm test",
"prepublishOnly": "npm run build",
"semantic-release": "semantic-release",
"benchmark": "npm run build && node benchmark/benchmark.js"
"benchmark": "npm run build && node benchmark/benchmark.js",
"upgrade": "npm-upgrade"
},
"author": "Simon Seyock (https://github.com/simonseyock)",
"contributors": [
Expand All @@ -30,32 +31,32 @@
"node": ">=12.0.0"
},
"devDependencies": {
"@rollup/plugin-typescript": "^8.3.0",
"@semantic-release/changelog": "^6.0.1",
"@rollup/plugin-typescript": "^11.0.0",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/git": "^10.0.1",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"@types/node": "^17.0.5",
"@types/sinon": "^10.0.6",
"@types/sinon-chai": "^3.2.7",
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.1",
"@types/sinon": "^10.0.13",
"@types/sinon-chai": "^3.2.9",
"benchmark": "^2.1.4",
"catharsis": "^0.9.0",
"chai": "^4.3.4",
"chai": "^4.3.7",
"coveralls": "^3.1.1",
"eslint-config-standard-with-typescript": "^21.0.1",
"eslint-config-standard-with-typescript": "^34.0.0",
"jsdoctypeparser": "^9.0.0",
"mocha": "^9.1.3",
"npm-upgrade": "^3.0.0",
"mocha": "^10.2.0",
"npm-upgrade": "^3.1.0",
"nyc": "^15.1.0",
"rollup": "^2.62.0",
"semantic-release": "^18.0.1",
"sinon": "^12.0.1",
"rollup": "^3.19.1",
"semantic-release": "^20.1.1",
"sinon": "^15.0.2",
"sinon-chai": "^3.7.0",
"ts-node": "^10.4.0",
"ts-standard": "^11.0.0",
"typedoc": "^0.22.10",
"typedoc-plugin-merge-modules": "^3.1.0",
"typescript": "^4.5.4"
"ts-node": "^10.9.1",
"ts-standard": "^12.0.2",
"typedoc": "^0.23.26",
"typedoc-plugin-merge-modules": "^4.0.1",
"typescript": "^4.9.5"
},
"ts-standard": {
"ignore": [
Expand Down
12 changes: 6 additions & 6 deletions src/lexer/Lexer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Token, TokenType } from './Token'
import { type Token, type TokenType } from './Token'

type PartialToken = Omit<Token, 'startOfLine'>

type Rule = (text: string) => PartialToken|null
type Rule = (text: string) => PartialToken | null

function makePunctuationRule (type: TokenType): Rule {
return text => {
Expand All @@ -14,7 +14,7 @@ function makePunctuationRule (type: TokenType): Rule {
}
}

function getQuoted (text: string): string|null {
function getQuoted (text: string): string | null {
let position = 0
let char
const mark = text[0]
Expand Down Expand Up @@ -45,7 +45,7 @@ const identifierStartRegex = /[$_\p{ID_Start}]|\\u\p{Hex_Digit}{4}|\\u\{0*(?:\p{
// A hyphen is not technically allowed, but to keep it liberal for now,
// adding it here
const identifierContinueRegex = /[$\-\p{ID_Continue}\u200C\u200D]|\\u\p{Hex_Digit}{4}|\\u\{0*(?:\p{Hex_Digit}{1,5}|10\p{Hex_Digit}{4})\}/u
function getIdentifier (text: string): string|null {
function getIdentifier (text: string): string | null {
let char = text[0]
if (!identifierStartRegex.test(char)) {
return null
Expand All @@ -63,7 +63,7 @@ function getIdentifier (text: string): string|null {

// we are a bit more liberal than TypeScript here and allow `NaN`, `Infinity` and `-Infinity`
const numberRegex = /^(NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity))/
function getNumber (text: string): string|null {
function getNumber (text: string): string | null {
return numberRegex.exec(text)?.[0] ?? null
}

Expand All @@ -89,7 +89,7 @@ function makeKeyWordRule (type: TokenType): Rule {
return null
}
return {
type: type,
type,
text: type
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/parslets/KeyValueParslet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { composeParslet, ParsletFunction } from './Parslet'
import { composeParslet, type ParsletFunction } from './Parslet'
import { Precedence } from '../Precedence'
import { assertRootResult } from '../assertTypes'
import { UnexpectedTypeError } from '../errors'
Expand Down Expand Up @@ -73,7 +73,7 @@ export function createKeyValueParslet ({ allowKeyTypes, allowReadonly, allowOpti
return {
type: 'JsdocTypeKeyValue',
left: assertRootResult(left),
right: right,
right,
meta: {
hasLeftSideExpression: true
}
Expand Down
10 changes: 5 additions & 5 deletions src/parslets/NamePathParslet.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ParsletFunction } from './Parslet'
import { type ParsletFunction } from './Parslet'
import { Precedence } from '../Precedence'
import { assertRootResult } from '../assertTypes'
import { Parser } from '../Parser'
import { NamePathResult, SpecialNamePath } from '../result/RootResult'
import { type NamePathResult, type SpecialNamePath } from '../result/RootResult'
import { UnexpectedTypeError } from '../errors'
import { PropertyResult } from '../result/NonRootResult'
import { Grammar } from '../grammars/Grammar'
import { type PropertyResult } from '../result/NonRootResult'
import { type Grammar } from '../grammars/Grammar'

export function createNamePathParslet ({ allowJsdocNamePaths, pathGrammar }: {
allowJsdocNamePaths: boolean
Expand Down Expand Up @@ -98,7 +98,7 @@ export function createNamePathParslet ({ allowJsdocNamePaths, pathGrammar }: {
type: 'JsdocTypeNamePath',
left: assertRootResult(left),
right,
pathType: pathType
pathType
}
}
}
8 changes: 4 additions & 4 deletions src/parslets/ObjectParslet.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { composeParslet, ParsletFunction } from './Parslet'
import { composeParslet, type ParsletFunction } from './Parslet'
import { Parser } from '../Parser'
import { Precedence } from '../Precedence'
import { UnexpectedTypeError } from '../errors'
import { ObjectResult } from '../result/RootResult'
import { Grammar } from '../grammars/Grammar'
import { type ObjectResult } from '../result/RootResult'
import { type Grammar } from '../grammars/Grammar'

export function createObjectParslet ({ objectFieldGrammar, allowKeyTypes }: {
objectFieldGrammar: Grammar
Expand Down Expand Up @@ -52,7 +52,7 @@ export function createObjectParslet ({ objectFieldGrammar, allowKeyTypes }: {
type: 'JsdocTypeKeyValue',
key: field.value.toString(),
right: undefined,
optional: optional,
optional,
readonly: false,
variadic: false,
meta: {
Expand Down
8 changes: 4 additions & 4 deletions src/parslets/ParameterListParslet.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { composeParslet, ParsletFunction } from './Parslet'
import { composeParslet, type ParsletFunction } from './Parslet'
import { Precedence } from '../Precedence'
import { assertPlainKeyValueOrRootResult } from '../assertTypes'
import { NoParsletFoundError } from '../errors'
import { KeyValueResult } from '..'
import { RootResult } from '../result/RootResult'
import { type KeyValueResult } from '..'
import { type RootResult } from '../result/RootResult'

export function createParameterListParslet ({ allowTrailingComma }: {
allowTrailingComma: boolean
Expand All @@ -13,7 +13,7 @@ export function createParameterListParslet ({ allowTrailingComma }: {
accept: type => type === ',',
precedence: Precedence.PARAMETER_LIST,
parseInfix: (parser, left) => {
const elements: Array<RootResult|KeyValueResult> = [
const elements: Array<RootResult | KeyValueResult> = [
assertPlainKeyValueOrRootResult(left)
]
parser.consume(',')
Expand Down
4 changes: 2 additions & 2 deletions src/result/RootResult.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JsdocObjectKeyValueResult, KeyValueResult, PropertyResult } from './NonRootResult'
import { type JsdocObjectKeyValueResult, type KeyValueResult, type PropertyResult } from './NonRootResult'

/**
* A parse result that corresponds to a valid type expression.
Expand Down Expand Up @@ -241,7 +241,7 @@ export interface ImportResult {
*/
export interface TupleResult {
type: 'JsdocTypeTuple'
elements: RootResult[]|KeyValueResult[]
elements: RootResult[] | KeyValueResult[]
}

/**
Expand Down
24 changes: 12 additions & 12 deletions src/transforms/identityTransformRules.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { TransformRules } from './transform'
import { type TransformRules } from './transform'
import {
JsdocObjectKeyValueResult,
KeyValueResult,
NonRootResult
type JsdocObjectKeyValueResult,
type KeyValueResult,
type NonRootResult
} from '../result/NonRootResult'
import {
FunctionResult,
NameResult,
StringValueResult,
SymbolResult,
RootResult,
VariadicResult,
NumberResult
type FunctionResult,
type NameResult,
type StringValueResult,
type SymbolResult,
type RootResult,
type VariadicResult,
type NumberResult
} from '../result/RootResult'
import { isPlainKeyValue } from '../assertTypes'

Expand Down Expand Up @@ -139,7 +139,7 @@ export function identityTransformRules (): TransformRules<NonRootResult> {

JsdocTypeTuple: (result, transform) => ({
type: 'JsdocTypeTuple',
elements: (result.elements as NonRootResult[]).map(transform) as RootResult[]|KeyValueResult[]
elements: (result.elements as NonRootResult[]).map(transform) as RootResult[] | KeyValueResult[]
}),

JsdocTypeName: result => result,
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/Fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { parse as catharsisParse } from 'catharsis'
import { parse as jtpParse } from 'jsdoctypeparser'
import { jtpTransform } from '../../src/transforms/jtpTransform'
import { simplify } from '../../src/transforms/simplify'
import { catharsisTransform, parse, RootResult, ParseMode, stringify } from '../../src'
import { catharsisTransform, parse, type RootResult, type ParseMode, stringify } from '../../src'

export type JtpMode = 'jsdoc' | 'closure' | 'typescript' | 'permissive'

Expand Down Expand Up @@ -124,7 +124,7 @@ function compareJtp (mode: JtpMode, compareMode: CompareMode, results: Results,
if (compareMode !== 'fail') {
it(`compares to jsdoctypeparser in '${mode}' mode`, () => {
const jtpResult = jtpParse(fixture.input, {
mode: mode
mode
})

expect(jtpResult).not.to.be.equal(undefined)
Expand All @@ -138,7 +138,7 @@ function compareJtp (mode: JtpMode, compareMode: CompareMode, results: Results,
it(`does not get parsed by jsdoctypeparser in '${mode}' mode`, () => {
expect(() => {
jtpParse(fixture.input, {
mode: mode
mode
})
}).to.throw()
})
Expand Down
2 changes: 1 addition & 1 deletion test/fuzzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ while (results.length < parseInt(process.argv[2], 10)) {
const valid = results.filter(r => r.parsed !== undefined).length

results.push({
valid: valid,
valid,
invalid: results.length - valid
})

Expand Down

0 comments on commit fe012ae

Please sign in to comment.