Skip to content

Commit c4df25f

Browse files
committed
build(deps-dev): replace standard with neostandard
1 parent 9ad7089 commit c4df25f

File tree

5 files changed

+102
-108
lines changed

5 files changed

+102
-108
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![CI](https://github.com/fastify/fast-json-stringify/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fastify/fast-json-stringify/actions/workflows/ci.yml)
44
[![NPM version](https://img.shields.io/npm/v/fast-json-stringify.svg?style=flat)](https://www.npmjs.com/package/fast-json-stringify)
5-
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
5+
[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)
66
[![NPM downloads](https://img.shields.io/npm/dm/fast-json-stringify.svg?style=flat)](https://www.npmjs.com/package/fast-json-stringify)
77

88

Diff for: benchmark/bench-cmp-lib.js

-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ const getRandomString = (length) => {
134134
return result[0].toUpperCase() + result.slice(1)
135135
}
136136

137-
// eslint-disable-next-line
138137
for (let i = 0; i < STR_LEN; i++) {
139138
largeArray[i] = {
140139
firstName: getRandomString(8),

Diff for: package.json

+3-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"bench:cmp": "node ./benchmark/bench-cmp-branch.js",
1111
"bench:cmp:ci": "node ./benchmark/bench-cmp-branch.js --ci",
1212
"benchmark": "node ./benchmark/bench-cmp-lib.js",
13-
"lint": "standard",
14-
"lint:fix": "standard --fix",
13+
"lint": "eslint",
14+
"lint:fix": "eslint --fix",
1515
"test:typescript": "tsd",
1616
"test:unit": "c8 node --test",
1717
"test": "npm run test:unit && npm run test:typescript"
@@ -45,8 +45,8 @@
4545
"compile-json-stringify": "^0.1.2",
4646
"fast-json-stringify": ".",
4747
"is-my-json-valid": "^2.20.6",
48+
"neostandard": "^0.11.9",
4849
"simple-git": "^3.23.0",
49-
"standard": "^17.1.0",
5050
"tsd": "^0.31.0",
5151
"webpack": "^5.90.3"
5252
},
@@ -58,10 +58,5 @@
5858
"json-schema-ref-resolver": "^2.0.0",
5959
"rfdc": "^1.2.0"
6060
},
61-
"standard": {
62-
"ignore": [
63-
"schema-validator.js"
64-
]
65-
},
6661
"runkitExampleFilename": "./examples/example.js"
6762
}

Diff for: types/index.d.ts

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Ajv, { Options as AjvOptions } from "ajv"
1+
import Ajv, { Options as AjvOptions } from 'ajv'
22

33
type Build = typeof build
44

@@ -70,36 +70,36 @@ declare namespace build {
7070
}
7171

7272
export interface StringSchema extends BaseSchema {
73-
type: "string";
73+
type: 'string';
7474
format?: string;
7575
}
7676

7777
export interface IntegerSchema extends BaseSchema {
78-
type: "integer";
78+
type: 'integer';
7979
}
8080

8181
export interface NumberSchema extends BaseSchema {
82-
type: "number";
82+
type: 'number';
8383
}
8484

8585
export interface NullSchema extends BaseSchema {
86-
type: "null";
86+
type: 'null';
8787
}
8888

8989
export interface BooleanSchema extends BaseSchema {
90-
type: "boolean";
90+
type: 'boolean';
9191
}
9292

9393
export interface ArraySchema extends BaseSchema {
94-
type: "array";
94+
type: 'array';
9595
/**
9696
* The schema for the items in the array
9797
*/
9898
items: Schema | {}
9999
}
100100

101101
export interface TupleSchema extends BaseSchema {
102-
type: "array";
102+
type: 'array';
103103
/**
104104
* The schemas for the items in the tuple
105105
*/
@@ -115,7 +115,7 @@ declare namespace build {
115115
}
116116

117117
export interface ObjectSchema extends BaseSchema {
118-
type: "object";
118+
type: 'object';
119119
/**
120120
* Describe the properties of the object
121121
*/
@@ -145,7 +145,7 @@ declare namespace build {
145145
| BooleanSchema
146146
| ArraySchema
147147
| TupleSchema
148-
| ObjectSchema;
148+
| ObjectSchema
149149

150150
export interface Options {
151151
/**
@@ -208,24 +208,24 @@ interface StandaloneOption extends build.Options {
208208
mode: 'standalone'
209209
}
210210

211-
type StringCoercible = string | Date | RegExp;
212-
type IntegerCoercible = number | BigInt;
211+
type StringCoercible = string | Date | RegExp
212+
type IntegerCoercible = number | BigInt
213213

214214
/**
215215
* Build a stringify function using a schema of the documents that should be stringified
216216
* @param schema The schema used to stringify values
217217
* @param options The options to use (optional)
218218
*/
219-
declare function build(schema: build.AnySchema, options: DebugOption): { code: string, ajv: Ajv };
220-
declare function build(schema: build.AnySchema, options: DeprecateDebugOption): { code: string, ajv: Ajv };
221-
declare function build(schema: build.AnySchema, options: StandaloneOption): string;
222-
declare function build(schema: build.AnySchema, options?: build.Options): <TDoc = any>(doc: TDoc) => any;
223-
declare function build(schema: build.StringSchema, options?: build.Options): <TDoc extends StringCoercible = StringCoercible>(doc: TDoc) => string;
224-
declare function build(schema: build.IntegerSchema | build.NumberSchema, options?: build.Options): <TDoc extends IntegerCoercible = IntegerCoercible>(doc: TDoc) => string;
225-
declare function build(schema: build.NullSchema, options?: build.Options): <TDoc extends null = null>(doc: TDoc) => "null";
226-
declare function build(schema: build.BooleanSchema, options?: build.Options): <TDoc extends boolean = boolean>(doc: TDoc) => string;
227-
declare function build(schema: build.ArraySchema | build.TupleSchema, options?: build.Options): <TDoc extends any[]= any[]>(doc: TDoc) => string;
228-
declare function build(schema: build.ObjectSchema, options?: build.Options): <TDoc extends object = object>(doc: TDoc) => string;
229-
declare function build(schema: build.Schema, options?: build.Options): <TDoc = object | any[] | string | number | boolean | null> (doc: TDoc) => string;
230-
231-
export = build;
219+
declare function build (schema: build.AnySchema, options: DebugOption): { code: string, ajv: Ajv }
220+
declare function build (schema: build.AnySchema, options: DeprecateDebugOption): { code: string, ajv: Ajv }
221+
declare function build (schema: build.AnySchema, options: StandaloneOption): string
222+
declare function build (schema: build.AnySchema, options?: build.Options): <TDoc = any>(doc: TDoc) => any
223+
declare function build (schema: build.StringSchema, options?: build.Options): <TDoc extends StringCoercible = StringCoercible>(doc: TDoc) => string
224+
declare function build (schema: build.IntegerSchema | build.NumberSchema, options?: build.Options): <TDoc extends IntegerCoercible = IntegerCoercible>(doc: TDoc) => string
225+
declare function build (schema: build.NullSchema, options?: build.Options): <TDoc extends null = null>(doc: TDoc) => 'null'
226+
declare function build (schema: build.BooleanSchema, options?: build.Options): <TDoc extends boolean = boolean>(doc: TDoc) => string
227+
declare function build (schema: build.ArraySchema | build.TupleSchema, options?: build.Options): <TDoc extends any[]= any[]>(doc: TDoc) => string
228+
declare function build (schema: build.ObjectSchema, options?: build.Options): <TDoc extends object = object>(doc: TDoc) => string
229+
declare function build (schema: build.Schema, options?: build.Options): <TDoc = object | any[] | string | number | boolean | null> (doc: TDoc) => string
230+
231+
export = build

Diff for: types/index.test-d.ts

+73-73
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ import { expectError, expectType } from 'tsd'
44

55
// Number schemas
66
build({
7-
type: 'number'
7+
type: 'number'
88
})(25)
99
build({
10-
type: 'integer'
10+
type: 'integer'
1111
})(-5)
1212
build({
13-
type: 'integer'
13+
type: 'integer'
1414
})(5n)
1515

1616
build({
17-
type: 'number'
17+
type: 'number'
1818
}, { rounding: 'ceil' })
1919
build({
20-
type: 'number'
20+
type: 'number'
2121
}, { rounding: 'floor' })
2222
build({
23-
type: 'number'
23+
type: 'number'
2424
}, { rounding: 'round' })
2525
build({
26-
type: 'number'
26+
type: 'number'
2727
}, { rounding: 'trunc' })
2828
expectError(build({
29-
type: 'number'
29+
type: 'number'
3030
}, { rounding: 'invalid' }))
3131

3232
// String schema
@@ -36,55 +36,55 @@ build({
3636

3737
// Boolean schema
3838
build({
39-
type: 'boolean'
39+
type: 'boolean'
4040
})(true)
4141

4242
// Null schema
4343
build({
44-
type: 'null'
44+
type: 'null'
4545
})(null)
4646

4747
// Array schemas
4848
build({
49-
type: 'array',
50-
items: { type: 'number' }
49+
type: 'array',
50+
items: { type: 'number' }
5151
})([25])
5252
build({
53-
type: 'array',
54-
items: [{ type: 'string'}, {type: 'integer'}]
53+
type: 'array',
54+
items: [{ type: 'string' }, { type: 'integer' }]
5555
})(['hello', 42])
5656

5757
// Object schemas
5858
build({
59-
type: 'object'
59+
type: 'object'
6060
})({})
6161
build({
62-
type: 'object',
63-
properties: {
64-
foo: { type: 'string' },
65-
bar: { type: 'integer' }
66-
},
67-
required: ['foo'],
68-
patternProperties: {
69-
'baz*': { type: 'null' }
70-
},
71-
additionalProperties: {
72-
type: 'boolean'
73-
}
62+
type: 'object',
63+
properties: {
64+
foo: { type: 'string' },
65+
bar: { type: 'integer' }
66+
},
67+
required: ['foo'],
68+
patternProperties: {
69+
'baz*': { type: 'null' }
70+
},
71+
additionalProperties: {
72+
type: 'boolean'
73+
}
7474
})({ foo: 'bar' })
7575
build({
76-
type: 'object',
77-
properties: {
78-
foo: { type: 'string' },
79-
bar: { type: 'integer' }
80-
},
81-
required: ['foo'],
82-
patternProperties: {
83-
'baz*': { type: 'null' }
84-
},
85-
additionalProperties: {
86-
type: 'boolean'
87-
}
76+
type: 'object',
77+
properties: {
78+
foo: { type: 'string' },
79+
bar: { type: 'integer' }
80+
},
81+
required: ['foo'],
82+
patternProperties: {
83+
'baz*': { type: 'null' }
84+
},
85+
additionalProperties: {
86+
type: 'boolean'
87+
}
8888
}, { rounding: 'floor' })({ foo: 'bar' })
8989

9090
// Reference schemas
@@ -113,7 +113,7 @@ build({
113113
}
114114
},
115115
patternProperties: {
116-
'num': {
116+
num: {
117117
$ref: '#/definitions/num'
118118
}
119119
},
@@ -207,52 +207,52 @@ interface InferenceSchema {
207207
}
208208

209209
const stringify3 = build({
210-
type: "object",
211-
properties: { a: { type: "string" } },
212-
});
213-
stringify3<InferenceSchema>({ id: "123" });
214-
stringify3<InferenceSchema>({ a: 123, id: "123" });
215-
expectError(stringify3<InferenceSchema>({ anotherOne: "bar" }));
216-
expectError(stringify3<Schema>({ a: "bar" }));
210+
type: 'object',
211+
properties: { a: { type: 'string' } },
212+
})
213+
stringify3<InferenceSchema>({ id: '123' })
214+
stringify3<InferenceSchema>({ a: 123, id: '123' })
215+
expectError(stringify3<InferenceSchema>({ anotherOne: 'bar' }))
216+
expectError(stringify3<Schema>({ a: 'bar' }))
217217

218218
// Without inference
219219
const stringify4 = build({
220-
type: "object",
221-
properties: { a: { type: "string" } },
222-
});
223-
stringify4({ id: "123" });
224-
stringify4({ a: 123, id: "123" });
225-
stringify4({ anotherOne: "bar" });
226-
stringify4({ a: "bar" });
220+
type: 'object',
221+
properties: { a: { type: 'string' } },
222+
})
223+
stringify4({ id: '123' })
224+
stringify4({ a: 123, id: '123' })
225+
stringify4({ anotherOne: 'bar' })
226+
stringify4({ a: 'bar' })
227227

228228
// Without inference - string type
229229
const stringify5 = build({
230-
type: "string",
231-
});
232-
stringify5("foo");
233-
expectError(stringify5({ id: "123" }));
230+
type: 'string',
231+
})
232+
stringify5('foo')
233+
expectError(stringify5({ id: '123' }))
234234

235235
// Without inference - null type
236236
const stringify6 = build({
237-
type: "null",
238-
});
239-
stringify6(null);
240-
expectError(stringify6("a string"));
237+
type: 'null',
238+
})
239+
stringify6(null)
240+
expectError(stringify6('a string'))
241241

242242
// Without inference - boolean type
243243
const stringify7 = build({
244-
type: "boolean",
245-
});
246-
stringify7(true);
247-
expectError(stringify7("a string"));
244+
type: 'boolean',
245+
})
246+
stringify7(true)
247+
expectError(stringify7('a string'))
248248

249249
// largeArrayMechanism
250250

251-
build({}, { largeArrayMechanism: 'json-stringify'} )
252-
build({}, { largeArrayMechanism: 'default'} )
253-
expectError(build({} as Schema, { largeArrayMechanism: 'invalid'} ))
251+
build({}, { largeArrayMechanism: 'json-stringify' })
252+
build({}, { largeArrayMechanism: 'default' })
253+
expectError(build({} as Schema, { largeArrayMechanism: 'invalid' }))
254254

255-
build({}, { largeArraySize: 2000 } )
256-
build({}, { largeArraySize: '2e4' } )
257-
build({}, { largeArraySize: 2n } )
258-
expectError(build({} as Schema, { largeArraySize: ['asdf']} ))
255+
build({}, { largeArraySize: 2000 })
256+
build({}, { largeArraySize: '2e4' })
257+
build({}, { largeArraySize: 2n })
258+
expectError(build({} as Schema, { largeArraySize: ['asdf'] }))

0 commit comments

Comments
 (0)