es-check 9.1.1 → 9.1.2-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +7 -2
  2. package/utils.js +23 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-check",
3
- "version": "9.1.1",
3
+ "version": "9.1.2-0",
4
4
  "description": "Checks the ECMAScript version of .js glob against a specified version of ECMAScript with a shell command",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -27,7 +27,8 @@
27
27
  "report:coverage": "nyc report --reporter=lcov > coverage.lcov && codecov",
28
28
  "setup": "pnpm install --reporter=silent",
29
29
  "test": "nyc mocha test.js utils.test.js browserslist.test.js polyfill.test.js completion.test.js --timeout 10s",
30
- "update": "codependence --update"
30
+ "update": "codependence --update",
31
+ "benchmark": "./benchmarks/run-benchmarks.sh"
31
32
  },
32
33
  "repository": {
33
34
  "type": "git",
@@ -39,10 +40,13 @@
39
40
  },
40
41
  "homepage": "https://github.com/yowainwright/es-check#readme",
41
42
  "devDependencies": {
43
+ "@babel/parser": "^7.27.1",
42
44
  "@commitlint/cli": "19.8.0",
43
45
  "@commitlint/config-conventional": "19.8.0",
44
46
  "@commitlint/format": "^19.3.0",
45
47
  "@commitlint/prompt": "19.8.0",
48
+ "@swc/core": "^1.11.24",
49
+ "are-you-es5": "^2.1.2",
46
50
  "assert": "^2.1.0",
47
51
  "codecov": "^3.8.3",
48
52
  "codependence": "^0.3.1",
@@ -50,6 +54,7 @@
50
54
  "conventional-changelog-cli": "^5.0.0",
51
55
  "eslint": "9.24.0",
52
56
  "eslint-config-prettier": "10.1.1",
57
+ "eslint-plugin-es5": "^1.5.0",
53
58
  "husky": "9.1.7",
54
59
  "is-ci": "^3.0.1",
55
60
  "mocha": "11.1.0",
package/utils.js CHANGED
@@ -149,7 +149,29 @@ const checkMap = {
149
149
  if (!node.callee || node.callee.type !== 'Identifier') {
150
150
  return false;
151
151
  }
152
- return node.callee.name === astInfo.callee;
152
+
153
+ if (node.callee.name !== astInfo.callee) {
154
+ return false;
155
+ }
156
+
157
+ if (astInfo.hasOptionsCause) {
158
+ if (!node.arguments || node.arguments.length < 2) {
159
+ return false;
160
+ }
161
+
162
+ const secondArg = node.arguments[1];
163
+ if (secondArg.type !== 'ObjectExpression') {
164
+ return false;
165
+ }
166
+
167
+ return secondArg.properties.some(prop =>
168
+ prop.key &&
169
+ prop.key.type === 'Identifier' &&
170
+ prop.key.name === 'cause'
171
+ );
172
+ }
173
+
174
+ return true;
153
175
  },
154
176
  default: () => false
155
177
  };