Skip to content

Commit c757259

Browse files
renovate[bot]renovate-botJakeLane
authoredJan 4, 2022
chore(deps): update definitelytyped (#976)
* chore(deps): update definitelytyped * Fix j.Comment usage and make tagged template expression type check more specific Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Jake Lane <jlane2@atlassian.com>
1 parent 6bd8fdd commit c757259

File tree

12 files changed

+212
-206
lines changed

12 files changed

+212
-206
lines changed
 

‎.changeset/eighty-seals-yell.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@compiled/babel-plugin': patch
3+
'@compiled/babel-plugin-strip-runtime': patch
4+
'@compiled/codemods': patch
5+
'@compiled/css': patch
6+
'@compiled/parcel-transformer': patch
7+
'@compiled/react': patch
8+
---
9+
10+
Update type definition dependencies

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878
"@storybook/react": "^6.3.12",
7979
"@types/jest": "^27.4.0",
8080
"@types/node": "^17.0.0",
81-
"@types/react": "^17.0.3",
82-
"@types/react-dom": "^17.0.3",
81+
"@types/react": "^17.0.37",
82+
"@types/react-dom": "^17.0.11",
8383
"@typescript-eslint/eslint-plugin": "^4.33.0",
8484
"@typescript-eslint/parser": "^4.33.0",
8585
"babel-loader": "^8.2.3",

‎packages/babel-plugin-strip-runtime/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"devDependencies": {
2828
"@compiled/babel-plugin": "*",
29-
"@types/babel__core": "^7.1.16",
29+
"@types/babel__core": "^7.1.17",
3030
"prettier": "^2.5.1"
3131
}
3232
}

‎packages/babel-plugin/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"resolve": "^1.20.0"
3434
},
3535
"devDependencies": {
36-
"@types/babel__core": "^7.1.16",
36+
"@types/babel__core": "^7.1.17",
3737
"@types/benchmark": "^2.1.1",
3838
"@types/resolve": "^1.20.1",
3939
"benchmark": "^2.1.4",

‎packages/babel-plugin/src/utils/resolve-binding.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type { PartialBindingWithMeta } from './types';
1515

1616
/**
1717
* Will recursively checks if identifier name is coming from destructuring. If yes,
18-
* then will return the resolved identifer. We can look for identifier name
18+
* then will return the resolved identifier. We can look for identifier name
1919
* either in destructuring key or its value.
2020
*
2121
* @param name Identifier name to resolve
@@ -221,7 +221,7 @@ export const resolveBinding = (
221221
};
222222
}
223223

224-
if (binding.path.parentPath.isImportDeclaration()) {
224+
if (binding.path.parentPath?.isImportDeclaration()) {
225225
// NOTE: We're skipping traversal when file name is not resolved. Imported identifier
226226
// will end up as a dynamic variable instead.
227227
if (!meta.state.filename) {

‎packages/codemods/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
"jscodeshift": "^0.13.0"
3131
},
3232
"devDependencies": {
33-
"@types/jscodeshift": "^0.11.2"
33+
"@types/jscodeshift": "^0.11.3"
3434
}
3535
}

‎packages/codemods/src/transforms/emotion-to-compiled/emotion-to-compiled.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type {
22
API,
3-
ASTPath,
43
Collection,
54
CommentBlock,
5+
CommentLine,
66
FileInfo,
77
ObjectPattern,
88
Options,
@@ -42,11 +42,15 @@ const imports = {
4242
};
4343

4444
const removeEmotionJSXPragma = (j: core.JSCodeshift, collection: Collection) => {
45-
const commentCollection = collection.find(j.Comment);
45+
// ast-types are incorrect and can't handle both line and block types
46+
// Cast to the correct type so we get safety
47+
const commentCollection: Collection<CommentLine | CommentBlock> = collection.find(
48+
j.Comment as any
49+
);
4650

4751
commentCollection.forEach((commentPath) => {
48-
const commentBlockCollection = j(commentPath as unknown as ASTPath<CommentBlock>).filter(
49-
(commentBlockPath) => commentBlockPath.value.value.includes(imports.emotionJSXPragma)
52+
const commentBlockCollection = j(commentPath).filter((commentBlockPath) =>
53+
commentBlockPath.value.value.includes(imports.emotionJSXPragma)
5054
);
5155

5256
commentBlockCollection.forEach((commentBlockPath) => {

‎packages/codemods/src/transforms/styled-components-to-compiled/styled-components-to-compiled.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ const transformer = (fileInfo: FileInfo, api: API, options: Options): string =>
5656
const taggedTemplateExpressions = collection.find(
5757
j.TaggedTemplateExpression,
5858
({ tag: expression }) =>
59+
expression.type === 'CallExpression' &&
60+
expression.callee.type === 'MemberExpression' &&
61+
expression.callee.object.type === 'MemberExpression' &&
62+
expression.callee.object.object.type === 'Identifier' &&
5963
expression.callee.object.object.name === 'styled' &&
64+
expression.callee.property.type === 'Identifier' &&
6065
expression.callee.property.name === 'attrs'
6166
);
6267

‎packages/css/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"postcss-values-parser": "^6.0.1"
3636
},
3737
"devDependencies": {
38-
"@types/autoprefixer": "^9.7.2",
38+
"@types/autoprefixer": "^10.2.0",
3939
"@types/cssnano": "^5.0.0"
4040
}
4141
}

‎packages/parcel-transformer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@parcel/plugin": "^2.0.0-nightly.657"
2929
},
3030
"devDependencies": {
31-
"@types/babel__core": "^7.1.16"
31+
"@types/babel__core": "^7.1.17"
3232
},
3333
"engines": {
3434
"parcel": "^2.0.0 || ^2.0.0-beta.1"

‎packages/react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
},
7777
"devDependencies": {
7878
"@testing-library/react": "^11.2.7",
79-
"@types/react-dom": "^17.0.10",
79+
"@types/react-dom": "^17.0.11",
8080
"react": "^17.0.2",
8181
"react-dom": "^17.0.2"
8282
},

‎yarn.lock

+179-192
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.