Skip to content

Commit

Permalink
chore(deps-dev): bump prettier from 2.8.8 to 3.1.1 (#1080)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix <188768+fb55@users.noreply.github.com>
  • Loading branch information
dependabot[bot] and fb55 authored Dec 23, 2023
1 parent 02b51de commit d9a18a4
Show file tree
Hide file tree
Showing 32 changed files with 116 additions and 103 deletions.
2 changes: 1 addition & 1 deletion bench/perf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ global.microTests = loadTreeConstructionTestData(treeConstructionPath, treeAdapt
.filter(
(test) =>
//NOTE: this test caused a stack overflow in parse5 v1.x
test.input !== '<button><p><button>'
test.input !== '<button><p><button>',
)
.map((test) => ({
html: test.input,
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"jest": "^29.7.0",
"lint-staged": "^15.2.0",
"outdent": "^0.8.0",
"prettier": "^2.8.8",
"prettier": "^3.1.1",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typedoc": "^0.25.4",
Expand All @@ -28,7 +28,7 @@
"build": "npm run build:esm && npm run build:cjs --workspaces --if-present",
"build:esm": "tsc --build packages/* test",
"build:docs": "typedoc",
"prettier": "prettier '**/*.{js,ts,md,json,yml}' --loglevel warn",
"prettier": "prettier '**/*.{js,ts,md,json,yml}' --log-level warn",
"format": "npm run format:es && npm run format:prettier",
"format:es": "npm run lint:es -- --fix",
"format:prettier": "npm run prettier -- --write",
Expand Down
2 changes: 1 addition & 1 deletion packages/parse5-html-rewriting-stream/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class RewritingStream extends SAXParser {
!this.parserFeedbackSimulator.inForeignContent &&
html.hasUnescapedText(this.tokenizer.lastStartTagName, true)
? text
: escapeText(text)
: escapeText(text),
);
}

Expand Down
26 changes: 13 additions & 13 deletions packages/parse5-html-rewriting-stream/test/rewriting-stream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('RewritingStream', () => {
createRewriterTest({
src: data.src,
expected: data.src,
})
}),
);
}

Expand Down Expand Up @@ -92,7 +92,7 @@ describe('RewritingStream', () => {
rewriter.emitStartTag(token);
});
},
})
}),
);

it(
Expand All @@ -118,7 +118,7 @@ describe('RewritingStream', () => {
rewriter.emitEndTag(token);
});
},
})
}),
);

it(
Expand Down Expand Up @@ -146,7 +146,7 @@ describe('RewritingStream', () => {
rewriter.emitText(token);
});
},
})
}),
);

it(
Expand All @@ -172,7 +172,7 @@ describe('RewritingStream', () => {
rewriter.emitComment(token);
});
},
})
}),
);

it(
Expand All @@ -199,7 +199,7 @@ describe('RewritingStream', () => {
rewriter.emitDoctype(token);
});
},
})
}),
);

it(
Expand All @@ -226,7 +226,7 @@ describe('RewritingStream', () => {
rewriter.emitDoctype(token);
});
},
})
}),
);

it(
Expand Down Expand Up @@ -257,7 +257,7 @@ describe('RewritingStream', () => {
rewriter.emitRaw('</wrap>');
});
},
})
}),
);

it(
Expand Down Expand Up @@ -287,7 +287,7 @@ describe('RewritingStream', () => {
.on('endTag', rewriteRaw)
.on('comment', rewriteRaw);
},
})
}),
);

it(
Expand Down Expand Up @@ -317,7 +317,7 @@ describe('RewritingStream', () => {
rewriter.on('startTag', (token) => rewriter.emitStartTag(token));
rewriter.on('text', (token) => rewriter.emitText(token));
},
})
}),
);

it('Last text chunk must be flushed (GH-271)', async () => {
Expand Down Expand Up @@ -349,15 +349,15 @@ describe('RewritingStream', () => {
createRewriterTest({
src: LONG_TEXT,
expected: LONG_TEXT,
})
}),
);

it(
'Should emit comment after text correctly',
createRewriterTest({
src: LONG_TEXT_WITH_COMMENT,
expected: LONG_TEXT_WITH_COMMENT,
})
}),
);

it(
Expand All @@ -374,6 +374,6 @@ describe('RewritingStream', () => {
}
});
},
})
}),
);
});
2 changes: 1 addition & 1 deletion packages/parse5-htmlparser2-tree-adapter/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const adapter: TreeAdapter<Htmlparser2TreeAdapterMap> = {
setDocumentType(document: Document, name: string, publicId: string, systemId: string): void {
const data = serializeDoctypeContent(name, publicId, systemId);
let doctypeNode = document.children.find(
(node): node is ProcessingInstruction => isDirective(node) && node.name === '!doctype'
(node): node is ProcessingInstruction => isDirective(node) && node.name === '!doctype',
);

if (doctypeNode) {
Expand Down
9 changes: 6 additions & 3 deletions packages/parse5-parser-stream/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { Parser, type ParserOptions, type TreeAdapterTypeMap, type DefaultTreeAd
export class ParserStream<T extends TreeAdapterTypeMap = DefaultTreeAdapterMap> extends Writable {
static getFragmentStream<T extends TreeAdapterTypeMap>(
fragmentContext?: T['parentNode'] | null,
options?: ParserOptions<T>
options?: ParserOptions<T>,
): ParserStream<T> {
const parser = Parser.getFragmentParser(fragmentContext, options);
const stream = new ParserStream(options, parser);
Expand All @@ -52,7 +52,10 @@ export class ParserStream<T extends TreeAdapterTypeMap = DefaultTreeAdapterMap>
/**
* @param options Parsing options.
*/
constructor(options?: ParserOptions<T>, public parser: Parser<T> = new Parser(options)) {
constructor(
options?: ParserOptions<T>,
public parser: Parser<T> = new Parser(options),
) {
super({ decodeStrings: false });

const resume = (): void => {
Expand Down Expand Up @@ -135,7 +138,7 @@ export interface ParserStream<T extends TreeAdapterTypeMap = DefaultTreeAdapterM
*/
on(
event: 'script',
handler: (scriptElement: T['element'], documentWrite: (html: string) => void, resume: () => void) => void
handler: (scriptElement: T['element'], documentWrite: (html: string) => void, resume: () => void) => void,
): void;
/**
* Base event handler.
Expand Down
2 changes: 1 addition & 1 deletion packages/parse5-parser-stream/test/location-info.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { parseChunked } from './utils/parse-chunked.js';

generateLocationInfoParserTests('location-info', (input, opts) =>
// NOTE: because of performance use bigger chunks here
parseChunked({ input }, opts, 100, 400)
parseChunked({ input }, opts, 100, 400),
);

generateTestsForEachTreeAdapter('location-info', (treeAdapter) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/parse5-parser-stream/test/parser-stream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ generateParsingTests(
'48.foreign-fragment',
],
},
(test, opts) => parseChunked(test, opts)
(test, opts) => parseChunked(test, opts),
);

describe('ParserStream', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/parse5-parser-stream/test/scripting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ generateParsingTests(
node: test.fragmentContext ? parser.getFragment() : parser.document,
chunks,
};
}
},
);

generateTestsForEachTreeAdapter('ParserStream', (treeAdapter) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/parse5-parser-stream/test/utils/parse-chunked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function parseChunked<T extends TreeAdapterTypeMap>(
test: { input: string; fragmentContext?: T['parentNode'] },
opts: ParserOptions<T>,
minChunkSize?: number,
maxChunkSize?: number
maxChunkSize?: number,
): { node: TreeAdapterTypeMap['document']; chunks: string[] } {
const parserStream = test.fragmentContext
? ParserStream.getFragmentStream(test.fragmentContext, opts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ generateTestsForEachTreeAdapter('plain-test-conversion-stream', (treeAdapter) =>

assert.strictEqual(
result,
'<html><head></head><body><pre>\nHey\nyo\uFFFD&lt;html&gt;&lt;head&gt;&lt;body&gt;</pre></body></html>'
'<html><head></head><body><pre>\nHey\nyo\uFFFD&lt;html&gt;&lt;head&gt;&lt;body&gt;</pre></body></html>',
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/parse5-sax-parser/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class SAXParser extends Transform implements TokenHandler {
override _transform(
chunk: string,
_encoding: string,
callback: (error?: Error | null, data?: string) => void
callback: (error?: Error | null, data?: string) => void,
): void {
if (typeof chunk !== 'string') {
throw new TypeError('Parser can work only with string streams.');
Expand Down
5 changes: 4 additions & 1 deletion packages/parse5-sax-parser/lib/parser-feedback-simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export class ParserFeedbackSimulator implements TokenHandler {
public skipNextNewLine = false;
public tokenizer: Tokenizer;

constructor(options: TokenizerOptions, private handler: TokenHandler) {
constructor(
options: TokenizerOptions,
private handler: TokenHandler,
) {
this.tokenizer = new Tokenizer(options, this);
this._enterNamespace(html.NS.HTML);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ const feedbackPath = new URL('../../../test/data/parser-feedback', import.meta.u
generateTokenizationTests(
'ParserFeedbackSimulator',
feedbackPath.pathname,
(handler) => new ParserFeedbackSimulator({}, handler).tokenizer
(handler) => new ParserFeedbackSimulator({}, handler).tokenizer,
);
4 changes: 2 additions & 2 deletions packages/parse5/lib/common/foreign-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const SVG_ATTRS_ADJUSTMENT_MAP = new Map(
'xChannelSelector',
'yChannelSelector',
'zoomAndPan',
].map((attr) => [attr.toLowerCase(), attr])
].map((attr) => [attr.toLowerCase(), attr]),
);

const XML_ATTRS_ADJUSTMENT_MAP = new Map([
Expand Down Expand Up @@ -126,7 +126,7 @@ export const SVG_TAG_NAMES_ADJUSTMENT_MAP = new Map(
'linearGradient',
'radialGradient',
'textPath',
].map((tn) => [tn.toLowerCase(), tn])
].map((tn) => [tn.toLowerCase(), tn]),
);

//Tags that causes exit from foreign content
Expand Down
8 changes: 4 additions & 4 deletions packages/parse5/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export { Tokenizer, type TokenizerOptions, TokenizerMode, type TokenHandler } fr
*/
export function parse<T extends TreeAdapterTypeMap = DefaultTreeAdapterMap>(
html: string,
options?: ParserOptions<T>
options?: ParserOptions<T>,
): T['document'] {
return Parser.parse(html, options);
}
Expand Down Expand Up @@ -69,16 +69,16 @@ export function parse<T extends TreeAdapterTypeMap = DefaultTreeAdapterMap>(
export function parseFragment<T extends TreeAdapterTypeMap = DefaultTreeAdapterMap>(
fragmentContext: T['parentNode'] | null,
html: string,
options: ParserOptions<T>
options: ParserOptions<T>,
): T['documentFragment'];
export function parseFragment<T extends TreeAdapterTypeMap = DefaultTreeAdapterMap>(
html: string,
options?: ParserOptions<T>
options?: ParserOptions<T>,
): T['documentFragment'];
export function parseFragment<T extends TreeAdapterTypeMap = DefaultTreeAdapterMap>(
fragmentContext: T['parentNode'] | null | string,
html?: string | ParserOptions<T>,
options?: ParserOptions<T>
options?: ParserOptions<T>,
): T['documentFragment'] {
if (typeof fragmentContext === 'string') {
options = html as ParserOptions<T>;
Expand Down
6 changes: 3 additions & 3 deletions packages/parse5/lib/parser/formatting-element-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class FormattingElementList<T extends TreeAdapterTypeMap> {
//lightweight heuristics without thorough attributes check.
private _getNoahArkConditionCandidates(
newElement: T['element'],
neAttrs: Attribute[]
neAttrs: Attribute[],
): { idx: number; attrs: Attribute[] }[] {
const candidates = [];

Expand Down Expand Up @@ -145,15 +145,15 @@ export class FormattingElementList<T extends TreeAdapterTypeMap> {
//Search
getElementEntryInScopeWithTagName(tagName: string): ElementEntry<T> | null {
const entry = this.entries.find(
(entry) => entry.type === EntryType.Marker || this.treeAdapter.getTagName(entry.element) === tagName
(entry) => entry.type === EntryType.Marker || this.treeAdapter.getTagName(entry.element) === tagName,
);

return entry && entry.type === EntryType.Element ? entry : null;
}

getElementEntry(element: T['element']): ElementEntry<T> | undefined {
return this.entries.find(
(entry): entry is ElementEntry<T> => entry.type === EntryType.Element && entry.element === element
(entry): entry is ElementEntry<T> => entry.type === EntryType.Element && entry.element === element,
);
}
}
4 changes: 2 additions & 2 deletions packages/parse5/lib/parser/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ generateParsingTests(
},
(test, opts) => ({
node: test.fragmentContext ? parseFragment(test.fragmentContext, test.input, opts) : parse(test.input, opts),
})
}),
);

generateParsingTests(
Expand All @@ -33,7 +33,7 @@ generateParsingTests(
},
(test, opts) => ({
node: test.fragmentContext ? parseFragment(test.fragmentContext, test.input, opts) : parse(test.input, opts),
})
}),
);

describe('parser', () => {
Expand Down
Loading

0 comments on commit d9a18a4

Please sign in to comment.