jsx-ast-utils
Advanced tools
Comparing version 3.3.4 to 3.3.5
@@ -95,3 +95,25 @@ /* eslint-env mocha */ | ||
}); | ||
it('works with nested fragments', () => { | ||
const code = ` | ||
<Hello | ||
role="checkbox" | ||
frag={ | ||
<> | ||
<div>Hello</div> | ||
<> | ||
<div>There</div> | ||
</> | ||
</> | ||
} | ||
/> | ||
`; | ||
const node = getOpeningElement(code); | ||
const expected = 'Hello'; | ||
const actual = elementType(node); | ||
assert.equal(actual, expected); | ||
}); | ||
}); | ||
}); |
@@ -550,3 +550,3 @@ /* eslint-env mocha */ | ||
it('should work with a this.props value', () => { | ||
const prop = extractProp('<a href={this.props.href!}>Download</a>'); | ||
const prop = extractProp('<a href={this.props.href!}>Download</a>', 'href'); | ||
const expected = null; | ||
@@ -553,0 +553,0 @@ const actual = getLiteralPropValue(prop); |
@@ -153,2 +153,24 @@ /* eslint-env mocha */ | ||
}); | ||
it('supports a prop value containing nested fragments', () => { | ||
const propCode = ` | ||
<> | ||
<div>Hello</div> | ||
<> | ||
<div>There</div> | ||
</> | ||
</> | ||
`; | ||
const code = ` | ||
<Hello | ||
role="checkbox" | ||
frag={${propCode}} | ||
/> | ||
`; | ||
const prop = extractProp(code, 'frag'); | ||
const actual = getPropValue(prop); | ||
assert.deepEqual(actual, propCode.trim()); | ||
}); | ||
}); | ||
@@ -155,0 +177,0 @@ |
@@ -8,2 +8,13 @@ # Changelog | ||
## [v3.3.5](https://github.com/jsx-eslint/jsx-ast-utils/compare/v3.3.4...v3.3.5) - 2023-07-28 | ||
### Fixed | ||
- [Fix] `extractProp`: support `JSXFragment` [`#132`](https://github.com/jsx-eslint/jsx-ast-utils/issues/132) | ||
### Commits | ||
- [Dev Deps] update `@babel/core`, `@babel/eslint-parser`, `@babel/parser`, `eslint` [`e5555d1`](https://github.com/jsx-eslint/jsx-ast-utils/commit/e5555d152dbe1e85324139756f637e65fe047976) | ||
- [Tests] fix a test [`bde3ba9`](https://github.com/jsx-eslint/jsx-ast-utils/commit/bde3ba9c9dc294d5472eefa0b3f31ab0e1aed739) | ||
## [v3.3.4](https://github.com/jsx-eslint/jsx-ast-utils/compare/v3.3.3...v3.3.4) - 2023-06-28 | ||
@@ -10,0 +21,0 @@ |
@@ -24,2 +24,6 @@ 'use strict'; | ||
var _JSXFragment = require('./JSXFragment'); | ||
var _JSXFragment2 = _interopRequireDefault(_JSXFragment); | ||
var _expressions = require('./expressions'); | ||
@@ -36,3 +40,4 @@ | ||
JSXExpressionContainer: _expressions2.default, | ||
JSXText: _JSXText2.default | ||
JSXText: _JSXText2.default, | ||
JSXFragment: _JSXFragment2.default | ||
}; | ||
@@ -58,2 +63,3 @@ | ||
function getValue(value) { | ||
if (!TYPES[value.type]) console.log(value.type); | ||
return TYPES[value.type](value); | ||
@@ -60,0 +66,0 @@ } |
{ | ||
"name": "jsx-ast-utils", | ||
"version": "3.3.4", | ||
"version": "3.3.5", | ||
"description": "AST utility module for statically analyzing JSX", | ||
@@ -23,5 +23,5 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.22.5", | ||
"@babel/eslint-parser": "^7.22.5", | ||
"@babel/parser": "^7.22.5", | ||
"@babel/core": "^7.22.9", | ||
"@babel/eslint-parser": "^7.22.9", | ||
"@babel/parser": "^7.22.7", | ||
"aud": "^2.0.3", | ||
@@ -37,3 +37,3 @@ "auto-changelog": "^2.4.0", | ||
"babylon": "^6.18.0", | ||
"eslint": "^8.43.0", | ||
"eslint": "^8.45.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
@@ -40,0 +40,0 @@ "eslint-plugin-import": "^2.27.5", |
import Literal from './Literal'; | ||
import JSXElement from './JSXElement'; | ||
import JSXText from './JSXText'; | ||
import JSXFragment from './JSXFragment'; | ||
import JSXExpressionContainer, { extractLiteral } from './expressions'; | ||
@@ -12,2 +13,3 @@ | ||
JSXText, | ||
JSXFragment, | ||
}; | ||
@@ -32,2 +34,3 @@ | ||
export default function getValue(value) { | ||
if (!TYPES[value.type]) console.log(value.type); | ||
return TYPES[value.type](value); | ||
@@ -34,0 +37,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
235572
5684