Socket
Socket
Sign inDemoInstall

jsx-ast-utils

Package Overview
Dependencies
66
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.2.0 to 3.2.1

.github/workflows/node-4+.yml

16

__tests__/src/elementType-test.js
/* eslint-env mocha */
import assert from 'assert';
import { getOpeningElement, setParserName } from '../helper';
import { getOpeningElement, setParserName, describeIfNotBabylon } from '../helper';
import elementType from '../../src/elementType';

@@ -86,11 +86,13 @@

it('should work with fragments', () => {
const code = '<>foo</>';
const node = getOpeningElement(code);
describeIfNotBabylon('fragments', () => {
it('should work with fragments', () => {
const code = '<>foo</>';
const node = getOpeningElement(code);
const expected = '<>';
const actual = elementType(node);
const expected = '<>';
const actual = elementType(node);
assert.equal(actual, expected);
assert.equal(actual, expected);
});
});
});
Unreleased
==================
3.2.1 / 2021-09-16
==================
- [patch] include project name in error logging (#113)
- [readme] update badges, URLs
- [Deps] update `array-includes`
- [meta] don‘t lint coverage results
- [meta] add GitHub org to FUNDING.yml
- [meta] add OpenCollective to FUNDING.yml
- [meta] run `aud` in `posttest`
- [meta] add Automatic Rebase and Require Allow Edits workflows
- [actions] use `node/install` instead of `node/run`; use `codecov` action
- [Tests] unpin `caniuse-lite`, since breaking change is fixed
- [Tests] pin `caniuse-lite`, due to breaking change in patch version
- [Tests] fix linting errors
- [Tests] migrate tests to Github Actions
- [Tests] stop using coveralls
- [Tests] skip failing fragment test in node 4
- [Dev Deps] update `@babel/core`, `@babel/parser`, `aud`, `eslint`, `eslint-plugin-import`, `object.entries`, `object.fromentries`
3.2.0 / 2020-12-16

@@ -5,0 +24,0 @@ ==================

@@ -15,3 +15,3 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
return value.elements.map(function (element) {

@@ -18,0 +18,0 @@ return getValue(element);

@@ -17,4 +17,4 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
return getValue(value.left) + ' ' + value.operator + ' ' + getValue(value.right);
}

@@ -17,3 +17,3 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
var operator = value.operator,

@@ -20,0 +20,0 @@ left = value.left,

@@ -18,3 +18,3 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
var callee = getValue(value.callee);

@@ -21,0 +21,0 @@

@@ -18,3 +18,3 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
var args = Array.isArray(value.arguments) ? value.arguments.map(function (x) {

@@ -21,0 +21,0 @@ return getValue(x);

@@ -17,4 +17,4 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
return getValue(value.expression);
}

@@ -15,3 +15,3 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
var test = value.test,

@@ -18,0 +18,0 @@ alternate = value.alternate,

@@ -154,3 +154,3 @@ 'use strict';

var errorMessage = function errorMessage(expression) {
return 'The prop value with an expression type of ' + expression + ' could not be resolved. Please file issue to get this fixed immediately.';
return 'The prop value with an expression type of ' + expression + ' could not be resolved. Please file an issue to get this fixed immediately.';
};

@@ -157,0 +157,0 @@

@@ -17,3 +17,3 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
var operator = value.operator,

@@ -20,0 +20,0 @@ left = value.left,

@@ -17,4 +17,4 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
return '' + getValue(value.object) + (value.optional ? '?.' : '.') + getValue(value.property);
}

@@ -25,3 +25,3 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
return value.properties.reduce(function (obj, property) {

@@ -28,0 +28,0 @@ var object = _extends({}, obj);

@@ -17,3 +17,3 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
return getValue(value.callee) + '?.(' + value.arguments.map(function (x) {

@@ -20,0 +20,0 @@ return getValue(x);

@@ -17,4 +17,4 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
return getValue(value.object) + '?.' + getValue(value.property);
}

@@ -17,4 +17,4 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
return getValue(value.expression);
}

@@ -17,3 +17,3 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
var operator = value.operator,

@@ -20,0 +20,0 @@ argument = value.argument;

@@ -17,3 +17,3 @@ 'use strict';

// eslint-disable-next-line global-require
var getValue = require('./index.js').default;
var getValue = require('.').default;
var operator = value.operator,

@@ -20,0 +20,0 @@ argument = value.argument,

{
"name": "jsx-ast-utils",
"version": "3.2.0",
"version": "3.2.1",
"description": "AST utility module for statically analyzing JSX",

@@ -10,6 +10,7 @@ "main": "lib/index.js",

"prepublish": "not-in-publish || (safe-publish-latest && npm test && npm run build)",
"coveralls": "cat ./reports/lcov.info | coveralls",
"prelint": "npm run build",
"lint": "eslint .",
"pretest": "npm run lint",
"test": "npm run tests-only --",
"posttest": "aud --production",
"tests-only": "jest --coverage",

@@ -19,4 +20,5 @@ "test:watch": "npm run tests-only -- --watch"

"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/parser": "^7.12.11",
"@babel/core": "^7.15.5",
"@babel/parser": "^7.15.6",
"aud": "^1.1.5",
"babel-cli": "^6.26.0",

@@ -31,6 +33,5 @@ "babel-core": "^6.26.3",

"babylon": "^6.18.0",
"coveralls": "^3.1.0",
"eslint": "^7.15.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-import": "^2.24.2",
"flow-parser": "^0.126.1",

@@ -40,4 +41,4 @@ "in-publish": "^2.0.1",

"jest-cli": "^20.0.4",
"object.entries": "^1.1.3",
"object.fromentries": "^2.0.3",
"object.entries": "^1.1.4",
"object.fromentries": "^2.0.4",
"rimraf": "^2.7.1",

@@ -58,3 +59,3 @@ "safe-publish-latest": "^1.1.4"

"type": "git",
"url": "https://github.com/evcohen/jsx-ast-utils"
"url": "https://github.com/jsx-eslint/jsx-ast-utils"
},

@@ -64,5 +65,7 @@ "license": "MIT",

"coverageReporters": [
"lcov"
"lcov",
"html",
"json"
],
"coverageDirectory": "reports",
"coverageDirectory": "coverage",
"testPathIgnorePatterns": [

@@ -74,5 +77,5 @@ "/node_modules/",

"dependencies": {
"array-includes": "^3.1.2",
"array-includes": "^3.1.3",
"object.assign": "^4.1.2"
}
}

@@ -1,25 +0,12 @@

<p align="center">
<a href="https://travis-ci.org/evcohen/jsx-ast-utils">
<img src="https://api.travis-ci.org/evcohen/jsx-ast-utils.svg?branch=master"
alt="build status">
</a>
<a href="https://npmjs.org/package/jsx-ast-utils">
<img src="https://img.shields.io/npm/v/jsx-ast-utils.svg"
alt="npm version">
</a>
<a href="https://github.com/evcohen/jsx-ast-utils/blob/master/LICENSE.md">
<img src="https://img.shields.io/npm/l/jsx-ast-utils.svg"
alt="license">
</a>
<a href='https://coveralls.io/github/evcohen/jsx-ast-utils?branch=master'>
<img src='https://coveralls.io/repos/github/evcohen/jsx-ast-utils/badge.svg?branch=master' alt='Coverage Status' />
</a>
<a href='https://npmjs.org/package/jsx-ast-utils'>
<img src='https://img.shields.io/npm/dt/jsx-ast-utils.svg'
alt='Total npm downloads' />
</a>
</p>
# jsx-ast-utils <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
# jsx-ast-utils
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
AST utility module for statically analyzing JSX.

@@ -33,3 +20,3 @@

## Usage
This is a utility module to evaluate AST objects for JSX syntax. This can be super useful when writing linting rules for JSX code. It was originally in the code for [eslint-plugin-jsx-a11y](https://github.com/evcohen/eslint-plugin-jsx-a11y), however I thought it could be useful to be extracted and maintained separately so **you** could write new interesting rules to statically analyze JSX.
This is a utility module to evaluate AST objects for JSX syntax. This can be super useful when writing linting rules for JSX code. It was originally in the code for [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y), however I thought it could be useful to be extracted and maintained separately so **you** could write new interesting rules to statically analyze JSX.

@@ -296,1 +283,18 @@ ### ESLint example

```
[1]: https://npmjs.org/package/jsx-ast-utils
[2]: https://versionbadg.es/jsx-eslint/jsx-ast-utils.svg
[5]: https://david-dm.org/jsx-eslint/jsx-ast-utils.svg
[6]: https://david-dm.org/jsx-eslint/jsx-ast-utils
[7]: https://david-dm.org/jsx-eslint/jsx-ast-utils/dev-status.svg
[8]: https://david-dm.org/jsx-eslint/jsx-ast-utils#info=devDependencies
[11]: https://nodei.co/npm/jsx-ast-utils.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/jsx-ast-utils.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/jsx-ast-utils.svg
[downloads-url]: https://npm-stat.com/charts.html?package=jsx-ast-utils
[codecov-image]: https://codecov.io/gh/jsx-eslint/jsx-ast-utils/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/jsx-eslint/jsx-ast-utils/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/jsx-eslint/jsx-ast-utils
[actions-url]: https://github.com/jsx-eslint/jsx-ast-utils/actions

@@ -9,4 +9,4 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
return value.elements.map((element) => getValue(element));
}

@@ -11,4 +11,4 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
return `${getValue(value.left)} ${value.operator} ${getValue(value.right)}`;
}

@@ -11,3 +11,3 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
const { operator, left, right } = value;

@@ -14,0 +14,0 @@ const leftVal = getValue(left);

@@ -12,3 +12,3 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
const callee = getValue(value.callee);

@@ -15,0 +15,0 @@

@@ -12,5 +12,5 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
const args = Array.isArray(value.arguments) ? value.arguments.map((x) => getValue(x)).join(', ') : '';
return `${getValue(value.callee)}${value.optional ? '?.' : ''}(${args})`;
}

@@ -11,4 +11,4 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
return getValue(value.expression);
}

@@ -9,3 +9,3 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
const {

@@ -12,0 +12,0 @@ test,

@@ -61,3 +61,3 @@ import Literal from '../Literal';

const errorMessage = (expression) => `The prop value with an expression type of ${expression} could not be resolved. Please file issue to get this fixed immediately.`;
const errorMessage = (expression) => `The prop value with an expression type of ${expression} could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.`;

@@ -64,0 +64,0 @@ /**

@@ -11,3 +11,3 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
const { operator, left, right } = value;

@@ -14,0 +14,0 @@ const leftVal = getValue(left);

@@ -11,4 +11,4 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
return `${getValue(value.object)}${value.optional ? '?.' : '.'}${getValue(value.property)}`;
}

@@ -11,3 +11,3 @@ import assign from 'object.assign';

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
return value.properties.reduce((obj, property) => {

@@ -14,0 +14,0 @@ const object = { ...obj };

@@ -11,4 +11,4 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
return `${getValue(value.callee)}?.(${value.arguments.map((x) => getValue(x)).join(', ')})`;
}

@@ -11,4 +11,4 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
return `${getValue(value.object)}?.${getValue(value.property)}`;
}

@@ -15,3 +15,3 @@ const extractValueFromThisExpression = require('./ThisExpression').default;

// const getValue = require('.').default;
const errorMessage = 'The prop value with an expression type of TSNonNullExpression could not be resolved. Please file issue to get this fixed immediately.';
const errorMessage = 'The prop value with an expression type of TSNonNullExpression could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.';

@@ -18,0 +18,0 @@ // it's just the name

@@ -11,4 +11,4 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
return getValue(value.expression);
}

@@ -11,3 +11,3 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
const { operator, argument } = value;

@@ -14,0 +14,0 @@

@@ -11,3 +11,3 @@ /**

// eslint-disable-next-line global-require
const getValue = require('./index.js').default;
const getValue = require('.').default;
const { operator, argument, prefix } = value;

@@ -14,0 +14,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc