Skip to content

Commit d0648a4

Browse files
authored
Upgrade dev dependencies (#245)
* Upgrade dev dependencies * Reformat code * Bump node version to 12
1 parent 81a5f94 commit d0648a4

File tree

10 files changed

+1632
-1813
lines changed

10 files changed

+1632
-1813
lines changed

.circleci/config.yml

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

33
defaults: &defaults
44
docker:
5-
- image: circleci/node:10
5+
- image: cimg/node:12.22.12
66

77
_steps:
88
save_npm_cache: &save_npm_cache

.eslintrc.js

+4-12
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,14 @@ module.exports = {
66
'plugin:jest/recommended',
77
'plugin:@typescript-eslint/recommended',
88
'prettier',
9-
'prettier/@typescript-eslint',
109
],
1110
env: {
1211
node: true,
1312
es6: true,
1413
},
1514
root: true,
1615
rules: {
17-
'prettier/prettier': [
18-
'error',
19-
{
20-
trailingComma: 'es5',
21-
singleQuote: true,
22-
printWidth: 90,
23-
semi: false,
24-
tabWidth: 2,
25-
},
26-
],
16+
'prettier/prettier': 'error',
2717
'@typescript-eslint/no-unused-vars': [
2818
'error',
2919
{
@@ -43,14 +33,16 @@ module.exports = {
4333
],
4434
'prefer-const': 'error',
4535
'prefer-template': 'error',
46-
'simple-import-sort/sort': 'error',
36+
'simple-import-sort/imports': 'error',
37+
'simple-import-sort/exports': 'error',
4738

4839
'no-underscore-dangle': 'off',
4940
'no-param-reassign': 'off',
5041
'no-console': 'off',
5142
'no-warning-comments': ['warn', { terms: ['fixme'], location: 'start' }],
5243
'no-unused-vars': 'off', // replaced by @typescript-eslint/no-unused-vars
5344
'@typescript-eslint/no-empty-function': 'off',
45+
'jest/valid-title': 'off',
5446

5547
// FIXME: enable
5648
'@typescript-eslint/explicit-function-return-type': 'off',

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn lint-staged

.prettierrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
trailingComma: 'es5',
3+
singleQuote: true,
4+
printWidth: 90,
5+
semi: false,
6+
tabWidth: 2,
7+
}

package.json

+20-24
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"bin": "bin/jest-codemods.js",
1313
"engines": {
14-
"node": ">=10"
14+
"node": ">=12"
1515
},
1616
"files": [
1717
"bin",
@@ -28,12 +28,8 @@
2828
"test": "jest --runInBand",
2929
"verify": "yarn lint && yarn build && yarn test:cov",
3030
"verify:bail": "yarn lint:bail && yarn verify",
31-
"ci": "yarn verify:bail && codecov"
32-
},
33-
"husky": {
34-
"hooks": {
35-
"pre-commit": "lint-staged"
36-
}
31+
"ci": "yarn verify:bail && codecov",
32+
"prepare": "husky install"
3733
},
3834
"lint-staged": {
3935
"*.js": [
@@ -69,23 +65,23 @@
6965
"update-notifier": "^4.1.0"
7066
},
7167
"devDependencies": {
72-
"@types/jest": "^25.2.3",
73-
"@types/jscodeshift": "^0.7.1",
74-
"@types/update-notifier": "^4.1.0",
75-
"@typescript-eslint/eslint-plugin": "^3.1.0",
76-
"@typescript-eslint/parser": "^3.1.0",
77-
"codecov": "^3.7.0",
78-
"eslint": "^7.1.0",
79-
"eslint-config-prettier": "^6.11.0",
80-
"eslint-plugin-jest": "^23.13.2",
81-
"eslint-plugin-prettier": "^3.1.3",
82-
"eslint-plugin-simple-import-sort": "^5.0.3",
83-
"husky": "^4.2.5",
84-
"jest": "^26.0.1",
85-
"lint-staged": "^10.2.7",
86-
"prettier": "^2.0.5",
87-
"ts-jest": "^26.1.0",
88-
"typescript": "^3.9.3"
68+
"@types/jest": "^27.4.1",
69+
"@types/jscodeshift": "^0.11.4",
70+
"@types/update-notifier": "^5.1.0",
71+
"@typescript-eslint/eslint-plugin": "^5.20.0",
72+
"@typescript-eslint/parser": "^5.20.0",
73+
"codecov": "^3.8.3",
74+
"eslint": "^8.13.0",
75+
"eslint-config-prettier": "^8.5.0",
76+
"eslint-plugin-jest": "^26.1.4",
77+
"eslint-plugin-prettier": "^4.0.0",
78+
"eslint-plugin-simple-import-sort": "^7.0.0",
79+
"husky": "^7.0.4",
80+
"jest": "^27.5.1",
81+
"lint-staged": "^12.4.0",
82+
"prettier": "^2.6.2",
83+
"ts-jest": "^27.1.4",
84+
"typescript": "^4.6.3"
8985
},
9086
"jest": {
9187
"preset": "ts-jest",

src/transformers/jasmine-this.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Codemod for transforming Jasmine `this` context into Jest v20+ compatible syntax.
33
*/
4-
import { NodePath } from 'ast-types'
4+
import type { NodePath } from 'ast-types/lib/node-path'
55
import * as jscodeshift from 'jscodeshift'
66
import { Collection } from 'jscodeshift/src/Collection'
77

src/transformers/tape.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ test(function() {
228228
)
229229
})
230230

231-
test('test options: removes', () => {
231+
test('options: removes', () => {
232232
expectTransformation(
233233
`
234234
import test from 'tape';
@@ -244,7 +244,7 @@ test('mytest', () => {
244244
)
245245
})
246246

247-
test('test options: skip', () => {
247+
test('options: skip', () => {
248248
expectTransformation(
249249
`
250250
import test from 'tape';

src/utils/chai-chain-utils.ts

+13-17
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
import { JEST_MATCHER_TO_MAX_ARGS } from './consts'
22

3-
export const createCallUtil = (j) => (
4-
fnName: string,
5-
args: any,
6-
rest: any,
7-
containsNot?: boolean
8-
) => {
9-
const expression = containsNot ? j.memberExpression(rest, j.identifier('not')) : rest
10-
11-
const numberOfArgs = JEST_MATCHER_TO_MAX_ARGS[fnName]
12-
if (typeof numberOfArgs === 'undefined') {
13-
throw new Error(`Unknown matcher "${fnName}" (JEST_MATCHER_TO_MAX_ARGS)`)
14-
}
3+
export const createCallUtil =
4+
(j) => (fnName: string, args: any, rest: any, containsNot?: boolean) => {
5+
const expression = containsNot ? j.memberExpression(rest, j.identifier('not')) : rest
156

16-
return j.memberExpression(
17-
expression,
18-
j.callExpression(j.identifier(fnName), args.slice(0, numberOfArgs))
19-
)
20-
}
7+
const numberOfArgs = JEST_MATCHER_TO_MAX_ARGS[fnName]
8+
if (typeof numberOfArgs === 'undefined') {
9+
throw new Error(`Unknown matcher "${fnName}" (JEST_MATCHER_TO_MAX_ARGS)`)
10+
}
11+
12+
return j.memberExpression(
13+
expression,
14+
j.callExpression(j.identifier(fnName), args.slice(0, numberOfArgs))
15+
)
16+
}
2117

2218
export const chainContainsUtil = (j) => (fnName, node, end) => {
2319
let curr = node

0 commit comments

Comments
 (0)