Skip to content

Commit

Permalink
Fix biome
Browse files Browse the repository at this point in the history
  • Loading branch information
lxsmnsyc committed Jan 12, 2024
1 parent 7b5a95a commit e90d9f9
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 90 deletions.
2 changes: 1 addition & 1 deletion benchmark/pridepack.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"target": "es2017"
}
}
44 changes: 26 additions & 18 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
{
"$schema": "https://unpkg.com/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": [
"node_modules/**/*"
]
"ignore": ["node_modules/**/*"]
},
"vcs": {
"useIgnoreFile": true
},
"linter": {
"enabled": true,
"ignore": [
"node_modules/**/*"
],
"ignore": ["node_modules/**/*"],
"rules": {
"a11y": {
"noAccessKey": "error",
"noAriaHiddenOnFocusable": "off",
"noAriaUnsupportedElements": "error",
"noAutofocus": "error",
"noBlankTarget": "error",
Expand All @@ -41,6 +38,7 @@
"useMediaCaption": "error",
"useValidAnchor": "error",
"useValidAriaProps": "error",
"useValidAriaRole": "error",
"useValidAriaValues": "error",
"useValidLang": "error"
},
Expand All @@ -67,6 +65,7 @@
"useFlatMap": "error",
"useLiteralKeys": "error",
"useOptionalChain": "warn",
"useRegexLiterals": "error",
"useSimpleNumberKeys": "error",
"useSimplifiedLogicExpression": "error"
},
Expand Down Expand Up @@ -116,6 +115,7 @@
"style": {
"noArguments": "error",
"noCommaOperator": "off",
"noDefaultExport": "off",
"noImplicitBoolean": "error",
"noInferrableTypes": "error",
"noNamespace": "error",
Expand Down Expand Up @@ -175,6 +175,7 @@
"noFunctionAssign": "error",
"noGlobalIsFinite": "error",
"noGlobalIsNan": "error",
"noImplicitAnyLet": "off",
"noImportAssign": "error",
"noLabelVar": "error",
"noMisleadingInstantiator": "error",
Expand All @@ -194,27 +195,36 @@
"useValidTypeof": "error"
},
"nursery": {
"noAriaHiddenOnFocusable": "off",
"noDefaultExport": "off",
"noDuplicateJsonKeys": "off",
"noEmptyBlockStatements": "error",
"noImplicitAnyLet": "off",
"noEmptyTypeParameters": "error",
"noGlobalEval": "off",
"noGlobalAssign": "error",
"noInvalidUseBeforeDeclaration": "error",
"noMisleadingCharacterClass": "error",
"noNodejsModules": "off",
"noThenProperty": "warn",
"noUnusedImports": "error",
"noUnusedPrivateClassMembers": "error",
"noUselessLoneBlockStatements": "error",
"noUselessTernary": "error",
"useAwait": "error",
"useConsistentArrayType": "error",
"useExportType": "error",
"useFilenamingConvention": "off",
"useForOf": "warn",
"useGroupedTypeImport": "error",
"useImportRestrictions": "off",
"useRegexLiterals": "error",
"useValidAriaRole": "error"
"useImportType": "error",
"useNodejsImportProtocol": "warn",
"useNumberNamespace": "error",
"useShorthandFunctionType": "warn"
}
}
},
"formatter": {
"enabled": true,
"ignore": [
"node_modules/**/*"
],
"ignore": ["node_modules/**/*"],
"formatWithErrors": false,
"indentWidth": 2,
"indentStyle": "space",
Expand All @@ -223,9 +233,7 @@
},
"organizeImports": {
"enabled": true,
"ignore": [
"node_modules/**/*"
]
"ignore": ["node_modules/**/*"]
},
"javascript": {
"formatter": {
Expand Down Expand Up @@ -261,4 +269,4 @@
"allowTrailingCommas": false
}
}
}
}
10 changes: 2 additions & 8 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
{
"packages": [
"packages/*",
"benchmark"
],
"packages": ["packages/*", "benchmark"],
"command": {
"version": {
"exact": true
},
"publish": {
"allowBranch": [
"main",
"next"
],
"allowBranch": ["main", "next"],
"registry": "https://registry.npmjs.org/"
}
},
Expand Down
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"name": "root",
"private": true,
"workspaces": [
"packages/*",
"benchmark"
],
"workspaces": ["packages/*", "benchmark"],
"devDependencies": {
"@biomejs/biome": "^1.4.1",
"@biomejs/biome": "^1.5.1",
"lerna": "^7.3.0",
"typescript": "^5.3.2"
}
}
}
13 changes: 3 additions & 10 deletions packages/plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
"name": "seroval-plugins",
"type": "module",
"version": "1.0.4",
"files": [
"dist",
"web"
],
"files": ["dist", "web"],
"engines": {
"node": ">=10"
},
"license": "MIT",
"keywords": [
"pridepack"
],
"keywords": ["pridepack"],
"devDependencies": {
"@types/node": "^20.8.3",
"@vitest/ui": "^1.0.1",
Expand Down Expand Up @@ -64,9 +59,7 @@
},
"typesVersions": {
"*": {
"web": [
"./dist/types/web/index.d.ts"
]
"web": ["./dist/types/web/index.d.ts"]
}
}
}
2 changes: 1 addition & 1 deletion packages/plugins/pridepack.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"entrypoints": {
"./web": "web/index.ts"
}
}
}
9 changes: 2 additions & 7 deletions packages/seroval/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
"name": "seroval",
"type": "module",
"version": "1.0.4",
"files": [
"dist",
"src"
],
"files": ["dist", "src"],
"engines": {
"node": ">=10"
},
"license": "MIT",
"keywords": [
"pridepack"
],
"keywords": ["pridepack"],
"devDependencies": {
"@types/node": "^20.8.3",
"@vitest/ui": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/seroval/pridepack.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"target": "es2018"
}
}
8 changes: 4 additions & 4 deletions packages/seroval/src/core/Serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ export default class Serializer {
this.options.onData(
initial
? this.options.globalIdentifier +
'["' +
serializeString(key) +
'"]=' +
data
'["' +
serializeString(key) +
'"]=' +
data
: data,
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/seroval/src/core/base-primitives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export function createNumberNode(
value: number,
): SerovalConstantNode | SerovalNumberNode {
switch (value) {
case Infinity:
case Number.POSITIVE_INFINITY:
return INFINITY_NODE;
case -Infinity:
case Number.NEGATIVE_INFINITY:
return NEG_INFINITY_NODE;
}
if (value !== value) {
Expand Down
6 changes: 3 additions & 3 deletions packages/seroval/src/core/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ export const CONSTANT_VAL: Record<SerovalConstant, unknown> = {
[SerovalConstant.Undefined]: undefined,
[SerovalConstant.Null]: null,
[SerovalConstant.NegativeZero]: -0,
[SerovalConstant.Infinity]: Infinity,
[SerovalConstant.NegativeInfinity]: -Infinity,
[SerovalConstant.NaN]: NaN,
[SerovalConstant.Infinity]: Number.POSITIVE_INFINITY,
[SerovalConstant.NegativeInfinity]: Number.NEGATIVE_INFINITY,
[SerovalConstant.NaN]: Number.NaN,
};

export const enum ErrorConstructorTag {
Expand Down
7 changes: 5 additions & 2 deletions packages/seroval/src/core/errors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { serializeString } from './string';
import { SerovalNode } from './types';
import type { SerovalNode } from './types';

const { toString: objectToString } = /* @__PURE__ */ Object.prototype;

Expand All @@ -21,7 +21,10 @@ For more information, please check the "cause" property of this error.`;
}

export class SerovalError extends Error {
constructor(type: string, public cause: any) {
constructor(
type: string,
public cause: any,
) {
super(getErrorMessage(type, cause));
}
}
Expand Down
10 changes: 8 additions & 2 deletions packages/seroval/src/core/tree/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ export async function toJSONAsync<T>(
};
}

export function compileJSON(source: SerovalJSON, options: PluginAccessOptions = {}): string {
export function compileJSON(
source: SerovalJSON,
options: PluginAccessOptions = {},
): string {
const plugins = resolvePlugins(options.plugins);
const ctx = new VanillaSerializerContext({
plugins,
Expand All @@ -95,7 +98,10 @@ export function compileJSON(source: SerovalJSON, options: PluginAccessOptions =
return ctx.serializeTop(source.t);
}

export function fromJSON<T>(source: SerovalJSON, options: PluginAccessOptions = {}): T {
export function fromJSON<T>(
source: SerovalJSON,
options: PluginAccessOptions = {},
): T {
const plugins = resolvePlugins(options.plugins);
const ctx = new VanillaDeserializerContext({
plugins,
Expand Down
2 changes: 1 addition & 1 deletion packages/seroval/theory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { serialize } from './dist/esm/development/index.mjs';

const example = {};

example[NaN] = example
example[NaN] = example;

console.log(serialize(example));
Loading

0 comments on commit e90d9f9

Please sign in to comment.