Skip to content

Commit acca1b7

Browse files
authored
chore: update deps (#112)
1 parent 7f169fc commit acca1b7

24 files changed

Lines changed: 2580 additions & 1597 deletions

.eslintrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
extends: ['@stoplight'],
3+
rules: {
4+
'no-param-reassign': 'warn',
5+
},
6+
};

.prettierrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
...require('@stoplight/eslint-config/prettier.config'),
3+
};

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
preset: '@stoplight/scripts',
3-
testEnvironment: 'node'
3+
testEnvironment: 'node',
44
};

package.json

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"scripts": {
2929
"build": "sl-scripts build",
3030
"commit": "git-cz",
31-
"lint": "tslint -c tslint.json 'src/**/*.ts'",
31+
"lint": "eslint --ext .js,.jsx,.ts,.tsx .",
3232
"lint.fix": "yarn lint --fix",
3333
"release": "sl-scripts release",
3434
"release.dryRun": "sl-scripts release --dry-run --debug",
@@ -45,16 +45,25 @@
4545
"safe-stable-stringify": "^1.1"
4646
},
4747
"devDependencies": {
48+
"@stoplight/eslint-config": "^3.0.0",
4849
"@stoplight/scripts": "^7.0.4",
49-
"@types/jest": "^24.0.21",
50+
"@types/jest": "^28.1.6",
5051
"@types/lodash": "^4.14.144",
5152
"@types/node": "^12.12.5",
53+
"@typescript-eslint/eslint-plugin": "^5.32.0",
54+
"@typescript-eslint/parser": "^5.32.0",
5255
"benchmark": "^2.1.4",
53-
"jest": "^24.9.0",
54-
"ts-jest": "^24.1.0",
55-
"tslint": "^5.20.0",
56-
"tslint-config-stoplight": "~1.3.0",
57-
"typescript": "3.6.4"
56+
"eslint": "^8.21.0",
57+
"eslint-plugin-import": "^2.26.0",
58+
"eslint-plugin-jest": "^26.7.0",
59+
"eslint-plugin-prettier": "^4.2.1",
60+
"eslint-plugin-react": "^7.30.1",
61+
"eslint-plugin-react-hooks": "^4.6.0",
62+
"eslint-plugin-simple-import-sort": "^7.0.0",
63+
"jest": "^28.1.3",
64+
"prettier": "^2.3.1",
65+
"ts-jest": "^28.0.7",
66+
"typescript": "^4.7.4"
5867
},
5968
"lint-staged": {
6069
"*.{ts,tsx}$": [

src/__tests__/getJsonPathForPosition.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as fs from 'fs';
22
import { join } from 'path';
3+
34
import { getJsonPathForPosition } from '../getJsonPathForPosition';
45
import { parseWithPointers } from '../parseWithPointers';
56

@@ -11,7 +12,7 @@ describe('getJsonPathForPosition', () => {
1112
describe('simple fixture', () => {
1213
const result = parseWithPointers(simple);
1314

14-
test.each`
15+
it.each`
1516
line | character | path
1617
${0} | ${0} | ${void 0}
1718
${1} | ${4} | ${['hello']}
@@ -26,7 +27,7 @@ describe('getJsonPathForPosition', () => {
2627
describe('users fixture', () => {
2728
const result = parseWithPointers(users);
2829

29-
test.each`
30+
it.each`
3031
line | character | path
3132
${0} | ${0} | ${void 0}
3233
${0} | ${231} | ${void 0}
@@ -44,7 +45,7 @@ describe('getJsonPathForPosition', () => {
4445
describe('one-liner', () => {
4546
const result = parseWithPointers(`{ "foo": true, "bar": false }`);
4647

47-
test.each`
48+
it.each`
4849
line | character | path
4950
${0} | ${3} | ${['foo']}
5051
${0} | ${12} | ${['foo']}
@@ -57,7 +58,7 @@ describe('getJsonPathForPosition', () => {
5758
describe('multiline comments', () => {
5859
const result = parseWithPointers(multilineComments);
5960

60-
test.each`
61+
it.each`
6162
line | character | path
6263
${1} | ${4} | ${['hello']}
6364
${7} | ${5} | ${['address', 'street']}

src/__tests__/getLocationForJsonPath.spec.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as fs from 'fs';
22
import { join } from 'path';
3+
34
import { getLocationForJsonPath } from '../getLocationForJsonPath';
45
import { parseWithPointers } from '../parseWithPointers';
56

@@ -13,7 +14,7 @@ describe('getLocationForJsonPath', () => {
1314
describe('pet store fixture', () => {
1415
const result = parseWithPointers(petStore);
1516

16-
test.each`
17+
it.each`
1718
start | end | path | closest
1819
${[8, 21]} | ${[8, 41]} | ${['info', 'contact', 'email']} | ${false}
1920
${[8, 21]} | ${[8, 41]} | ${['info', 'contact', 'email']} | ${true}
@@ -53,7 +54,7 @@ describe('getLocationForJsonPath', () => {
5354
describe('simple fixture', () => {
5455
const result = parseWithPointers(simple);
5556

56-
test.each`
57+
it.each`
5758
start | end | path
5859
${[2, 13]} | ${[4, 3]} | ${['address']}
5960
${[3, 14]} | ${[3, 17]} | ${['address', 'street']}
@@ -78,7 +79,7 @@ describe('getLocationForJsonPath', () => {
7879
describe('users fixture', () => {
7980
const result = parseWithPointers(users);
8081

81-
test.each`
82+
it.each`
8283
start | end | path
8384
${[3, 14]} | ${[3, 19]} | ${['users', 0, 'name']}
8485
${[3, 14]} | ${[3, 19]} | ${['users', '0', 'name']}
@@ -103,7 +104,7 @@ describe('getLocationForJsonPath', () => {
103104
describe('one-liner', () => {
104105
const result = parseWithPointers(`{ "foo": true, "bar": false }`);
105106

106-
test.each`
107+
it.each`
107108
start | end | path
108109
${[0, 9]} | ${[0, 13]} | ${['foo']}
109110
${[0, 22]} | ${[0, 27]} | ${['bar']}
@@ -126,7 +127,7 @@ describe('getLocationForJsonPath', () => {
126127
describe('multiline comments', () => {
127128
const result = parseWithPointers(multilineComments);
128129

129-
test.each`
130+
it.each`
130131
start | end | path
131132
${[1, 11]} | ${[1, 18]} | ${['hello']}
132133
${[7, 14]} | ${[7, 17]} | ${['address', 'street']}
@@ -151,7 +152,7 @@ describe('getLocationForJsonPath', () => {
151152
describe('todos', () => {
152153
const result = parseWithPointers(todos);
153154

154-
test.each`
155+
it.each`
155156
start | end | path | closest
156157
${[42, 13]} | ${[73, 7]} | ${['paths', '/todos/{todoId}', 'get']} | ${false}
157158
${[42, 13]} | ${[73, 7]} | ${['paths', '/todos/{todoId}', 'get', 'description']} | ${true}
@@ -189,7 +190,7 @@ describe('getLocationForJsonPath', () => {
189190
}
190191
}`);
191192

192-
test.each`
193+
it.each`
193194
start | end | path | closest
194195
${[2, 10]} | ${[4, 4]} | ${['foo', 'bar', 'baz', 'baz-inga']} | ${true}
195196
${[]} | ${[]} | ${['foo', 'bar', 'baz', 'baz-inga']} | ${false}

src/__tests__/hasRef.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { hasRef } from '../hasRef';
22

33
describe('hasRef', () => {
4-
test('should return true for object containing property with $ref key and string value', () => {
4+
it('should return true for object containing property with $ref key and string value', () => {
55
expect(hasRef({ $ref: '' })).toBe(true);
66
});
77

8-
test('should return false for object not containing property with $ref key and string value', () => {
8+
it('should return false for object not containing property with $ref key and string value', () => {
99
expect(hasRef({ $ref: null })).toBe(false);
1010
expect(hasRef({})).toBe(false);
1111
expect(hasRef({ x: true })).toBe(false);
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { isPlainObject } from '../isPlainObject';
22

3-
it('isPlainObject', () => {
4-
expect(isPlainObject(new class Foo {}())).toBe(false);
3+
test('isPlainObject', () => {
4+
expect(isPlainObject(new (class Foo {})())).toBe(false);
55
expect(isPlainObject([1, 2, 3])).toBe(false);
66

77
expect(isPlainObject({ x: 0, y: 0 })).toBe(true);
88
expect(isPlainObject(Object.create(null))).toBe(true);
99

10-
const a = new class {}();
10+
const a = new (class {})();
1111
a.constructor = Object;
1212
expect(isPlainObject(a)).toBe(true);
1313
});

src/__tests__/parseWithPointers.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import { DiagnosticSeverity } from '@stoplight/types';
22
import * as fs from 'fs';
33
import { join } from 'path';
4+
45
import { parseWithPointers } from '../parseWithPointers';
56

67
const simple = fs.readFileSync(join(__dirname, './fixtures/simple.json'), 'utf-8');
78

89
describe('json parser', () => {
9-
test('parse simple', () => {
10+
it('parse simple', () => {
1011
expect(parseWithPointers(simple)).toMatchSnapshot({
1112
ast: expect.any(Object),
1213
lineMap: expect.any(Array),
1314
});
1415
});
1516

16-
test('parse complex', () => {
17+
it('parse complex', () => {
1718
expect(
1819
parseWithPointers(`{
1920
"users": [
@@ -40,7 +41,7 @@ describe('json parser', () => {
4041
});
4142
});
4243

43-
test('does not allow comments by default', () => {
44+
it('does not allow comments by default', () => {
4445
expect(
4546
parseWithPointers(`{
4647
// a comment
@@ -72,7 +73,7 @@ describe('json parser', () => {
7273
]);
7374
});
7475

75-
test('does not allow trailing commas by default', () => {
76+
it('does not allow trailing commas by default', () => {
7677
expect(
7778
parseWithPointers(`{
7879
"name": "Antti",
@@ -105,7 +106,7 @@ describe('json parser', () => {
105106
});
106107

107108
describe('fixtures', () => {
108-
test.each(['petstore.oas2.json', 'user.jschema.json'])('parses %s', async filename => {
109+
it.each(['petstore.oas2.json', 'user.jschema.json'])('parses %s', async filename => {
109110
expect(
110111
parseWithPointers((await fs.promises.readFile(join(__dirname, 'fixtures', filename), 'utf-8')) as string),
111112
).toMatchSnapshot({
@@ -116,12 +117,11 @@ describe('json parser', () => {
116117
});
117118

118119
describe('invalid fixtures', () => {
119-
test.each(['schema.json', 'characters.json'])('parses %s', async filename => {
120+
it.each(['schema.json', 'characters.json'])('parses %s', async filename => {
120121
expect(
121-
parseWithPointers((await fs.promises.readFile(
122-
join(__dirname, 'fixtures/invalid', filename),
123-
'utf-8',
124-
)) as string),
122+
parseWithPointers(
123+
(await fs.promises.readFile(join(__dirname, 'fixtures/invalid', filename), 'utf-8')) as string,
124+
),
125125
).toMatchSnapshot({
126126
ast: expect.any(Object),
127127
lineMap: expect.any(Array),
@@ -130,7 +130,7 @@ describe('json parser', () => {
130130
});
131131

132132
describe('duplicate keys', () => {
133-
test('given object with no duplicate keys, does not report any errors', () => {
133+
it('given object with no duplicate keys, does not report any errors', () => {
134134
expect(
135135
parseWithPointers(
136136
`{
@@ -181,7 +181,7 @@ describe('json parser', () => {
181181
).toEqual([]);
182182
});
183183

184-
test('given object containing with duplicate keys, reports them', () => {
184+
it('given object containing with duplicate keys, reports them', () => {
185185
expect(
186186
parseWithPointers(
187187
`{
@@ -278,7 +278,7 @@ describe('json parser', () => {
278278
]);
279279
});
280280

281-
test('generates correct paths for dupes in arrays', () => {
281+
it('generates correct paths for dupes in arrays', () => {
282282
expect(
283283
parseWithPointers('{ "A": [{}, { "foo": true, "foo": false,\n "foo": 2 }] }', { ignoreDuplicateKeys: false }),
284284
).toHaveProperty('diagnostics', [
@@ -313,7 +313,7 @@ describe('json parser', () => {
313313
});
314314
});
315315

316-
test('includes properties with empty string as keys', () => {
316+
it('includes properties with empty string as keys', () => {
317317
expect(parseWithPointers('{ "": [{ "foo": true, "": false }] }')).toHaveProperty('data', {
318318
'': [{ '': false, foo: true }],
319319
});
@@ -372,7 +372,9 @@ describe('json parser', () => {
372372
});
373373

374374
it('does not touch arrays', () => {
375-
const { data } = parseWithPointers(`[0, 1, 2]`, { preserveKeyOrder: true });
375+
const { data } = parseWithPointers(`[0, 1, 2]`, {
376+
preserveKeyOrder: true,
377+
});
376378

377379
expect(Object.keys(data)).toEqual(['0', '1', '2']);
378380
expect(Object.getOwnPropertySymbols(data)).toEqual([]);

src/__tests__/reparentBundleTarget.spec.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { reparentBundleTarget } from '../reparentBundleTarget';
22

33
describe('reparentBundleTarget', () => {
4-
it.each<[string, string]>([['#', '#/components'], ['#/components', '#'], ['#/components/schemas', '#/components']])(
5-
'given %p paths, should throw',
6-
(from, to) => {
7-
expect(reparentBundleTarget.bind(null, {}, from, to)).toThrow();
8-
},
9-
);
4+
it.each<[string, string]>([
5+
['#', '#/components'],
6+
['#/components', '#'],
7+
['#/components/schemas', '#/components'],
8+
])('given %p paths, should throw', (from, to) => {
9+
expect(reparentBundleTarget.bind(null, {}, from, to)).toThrow();
10+
});
1011

1112
it('should reparent refs', () => {
1213
const document = {

0 commit comments

Comments
 (0)