Skip to content

Commit

Permalink
chore(deps-dev): bump eslint-plugin-unicorn from 55.0.0 to 56.0.1 (#1333
Browse files Browse the repository at this point in the history
)

* chore(deps-dev): bump eslint-plugin-unicorn from 55.0.0 to 56.0.1

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 55.0.0 to 56.0.1.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](sindresorhus/eslint-plugin-unicorn@v55.0.0...v56.0.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* format

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Felix <[email protected]>
  • Loading branch information
dependabot[bot] and fb55 authored Dec 22, 2024
1 parent d309c50 commit 0146539
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 72 deletions.
16 changes: 8 additions & 8 deletions bench/perf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ const saxPath = new URL('../../test/data/sax/', import.meta.url);

//HACK: https://github.com/bestiejs/benchmark.js/issues/51
/* global workingCopy, WorkingCopyParserStream, upstreamParser, hugePage, microTests, runMicro, runPages, files */
global.workingCopy = parse5;
global.WorkingCopyParserStream = parse5Stream;
global.upstreamParser = parse5Upstream;
globalThis.workingCopy = parse5;
globalThis.WorkingCopyParserStream = parse5Stream;
globalThis.upstreamParser = parse5Upstream;

// Huge page data
global.hugePage = readFileSync(hugePagePath).toString();
globalThis.hugePage = readFileSync(hugePagePath).toString();

// Micro data
global.microTests = loadTreeConstructionTestData(treeConstructionPath, treeAdapters.default)
globalThis.microTests = loadTreeConstructionTestData(treeConstructionPath, treeAdapters.default)
.filter(
(test) =>
//NOTE: this test caused a stack overflow in parse5 v1.x
Expand All @@ -34,7 +34,7 @@ global.microTests = loadTreeConstructionTestData(treeConstructionPath, treeAdapt
fragmentContext: test.fragmentContext,
}));

global.runMicro = function (parser) {
globalThis.runMicro = function (parser) {
for (const test of microTests) {
if (test.fragmentContext) {
parser.parseFragment(test.fragmentContext, test.html);
Expand All @@ -47,14 +47,14 @@ global.runMicro = function (parser) {
// Pages data
const pages = loadSAXParserTestData().map((test) => test.src);

global.runPages = function (parser) {
globalThis.runPages = function (parser) {
for (const page of pages) {
parser.parse(page);
}
};

// Stream data
global.files = readdirSync(saxPath).map((dirName) => new URL(`${dirName}/src.html`, saxPath).pathname);
globalThis.files = readdirSync(saxPath).map((dirName) => new URL(`${dirName}/src.html`, saxPath).pathname);

// Utils
function getHz(suite, testName) {
Expand Down
112 changes: 58 additions & 54 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@types/jest": "^29.5.14",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-unicorn": "^55.0.0",
"eslint-plugin-unicorn": "^56.0.1",
"globals": "^15.14.0",
"husky": "^9.1.7",
"jest": "^29.7.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/parse5/lib/parser/formatting-element-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class FormattingElementList<T extends TreeAdapterTypeMap> {
removeEntry(entry: Entry<T>): void {
const entryIndex = this.entries.indexOf(entry);

if (entryIndex >= 0) {
if (entryIndex !== -1) {
this.entries.splice(entryIndex, 1);
}
}
Expand All @@ -135,10 +135,10 @@ export class FormattingElementList<T extends TreeAdapterTypeMap> {
clearToLastMarker(): void {
const markerIdx = this.entries.indexOf(MARKER);

if (markerIdx >= 0) {
this.entries.splice(0, markerIdx + 1);
} else {
if (markerIdx === -1) {
this.entries.length = 0;
} else {
this.entries.splice(0, markerIdx + 1);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/parse5/lib/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ export class Parser<T extends TreeAdapterTypeMap> implements TokenHandler, Stack
(entry) => entry.type === EntryType.Marker || this.openElements.contains(entry.element),
);

const unopenIdx = endIndex < 0 ? listLength - 1 : endIndex - 1;
const unopenIdx = endIndex === -1 ? listLength - 1 : endIndex - 1;

for (let i = unopenIdx; i >= 0; i--) {
const entry = this.activeFormattingElements.entries[i] as ElementEntry<T>;
Expand Down Expand Up @@ -1419,7 +1419,7 @@ function aaObtainFurthestBlock<T extends TreeAdapterTypeMap>(
}

if (!furthestBlock) {
p.openElements.shortenToLength(idx < 0 ? 0 : idx);
p.openElements.shortenToLength(Math.max(idx, 0));
p.activeFormattingElements.removeEntry(formattingElementEntry);
}

Expand Down
6 changes: 3 additions & 3 deletions packages/parse5/lib/parser/open-element-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class OpenElementStack<T extends TreeAdapterTypeMap> {
targetIdx = this.tagIDs.lastIndexOf(tagName, targetIdx - 1);
} while (targetIdx > 0 && this.treeAdapter.getNamespaceURI(this.items[targetIdx]) !== NS.HTML);

this.shortenToLength(targetIdx < 0 ? 0 : targetIdx);
this.shortenToLength(Math.max(targetIdx, 0));
}

shortenToLength(idx: number): void {
Expand All @@ -156,12 +156,12 @@ export class OpenElementStack<T extends TreeAdapterTypeMap> {

popUntilElementPopped(element: T['element']): void {
const idx = this._indexOf(element);
this.shortenToLength(idx < 0 ? 0 : idx);
this.shortenToLength(Math.max(idx, 0));
}

private popUntilPopped(tagNames: Set<$>, targetNS: NS): void {
const idx = this._indexOfTagNames(tagNames, targetNS);
this.shortenToLength(idx < 0 ? 0 : idx);
this.shortenToLength(Math.max(idx, 0));
}

popUntilNumberedHeaderPopped(): void {
Expand Down

0 comments on commit 0146539

Please sign in to comment.