eslint-plugin-ziloen 0.1.4 → 0.1.5

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.
package/dist/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
@@ -126,10 +136,20 @@ var generic_spacing_default = genericSpacing;
126
136
 
127
137
  // src/rules/jsx-strict-logical-expressions.ts
128
138
  var import_utils3 = require("@typescript-eslint/utils");
129
- var import_tsutils = require("tsutils");
130
- var import_typescript = require("typescript");
139
+ var ts2 = __toESM(require("typescript"), 1);
131
140
 
132
141
  // src/tsutils.ts
142
+ var ts = __toESM(require("typescript"), 1);
143
+ function isUnionType(type) {
144
+ return (type.flags & ts.TypeFlags.Union) !== 0;
145
+ }
146
+ function unionTypeParts(type) {
147
+ return isUnionType(type) ? type.types : [type];
148
+ }
149
+ function isFlagSet(obj, flag) {
150
+ return (obj.flags & flag) !== 0;
151
+ }
152
+ var isTypeFlagSet = isFlagSet;
133
153
  function getConstrainedTypeAtLocation(checker, node) {
134
154
  const nodeType = checker.getTypeAtLocation(node);
135
155
  const constrained = checker.getBaseConstraintOfType(nodeType);
@@ -168,19 +188,19 @@ var jsxStrictLogicalExpressions = createEslintRule({
168
188
  const typeChecker = parserServices.program.getTypeChecker();
169
189
  function checkIdentifier(node) {
170
190
  const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);
171
- const types = (0, import_tsutils.unionTypeParts)(
191
+ const types = unionTypeParts(
172
192
  getConstrainedTypeAtLocation(typeChecker, tsNode)
173
193
  );
174
194
  const hasPotentiallyFalseyString = types.some(
175
- (type) => (0, import_tsutils.isTypeFlagSet)(type, import_typescript.TypeFlags.StringLike) && (!type.isStringLiteral() || type.value === "")
195
+ (type) => isTypeFlagSet(type, ts2.TypeFlags.StringLike) && (!type.isStringLiteral() || type.value === "")
176
196
  );
177
197
  if (!options.allowString && hasPotentiallyFalseyString) {
178
198
  return "conditionErrorFalseyString";
179
199
  }
180
200
  const hasPotentiallyFalseyNumber = types.some(
181
- (type) => (0, import_tsutils.isTypeFlagSet)(
201
+ (type) => isTypeFlagSet(
182
202
  type,
183
- import_typescript.TypeFlags.NumberLike | import_typescript.TypeFlags.BigIntLike
203
+ ts2.TypeFlags.NumberLike | ts2.TypeFlags.BigIntLike
184
204
  ) && (!type.isNumberLiteral() || type.value === 0)
185
205
  );
186
206
  if (!options.allowNumber && hasPotentiallyFalseyNumber) {
package/dist/index.js CHANGED
@@ -100,10 +100,20 @@ var generic_spacing_default = genericSpacing;
100
100
 
101
101
  // src/rules/jsx-strict-logical-expressions.ts
102
102
  import { ESLintUtils as ESLintUtils2, TSESTree } from "@typescript-eslint/utils";
103
- import { isTypeFlagSet, unionTypeParts } from "tsutils";
104
- import { TypeFlags } from "typescript";
103
+ import * as ts2 from "typescript";
105
104
 
106
105
  // src/tsutils.ts
106
+ import * as ts from "typescript";
107
+ function isUnionType(type) {
108
+ return (type.flags & ts.TypeFlags.Union) !== 0;
109
+ }
110
+ function unionTypeParts(type) {
111
+ return isUnionType(type) ? type.types : [type];
112
+ }
113
+ function isFlagSet(obj, flag) {
114
+ return (obj.flags & flag) !== 0;
115
+ }
116
+ var isTypeFlagSet = isFlagSet;
107
117
  function getConstrainedTypeAtLocation(checker, node) {
108
118
  const nodeType = checker.getTypeAtLocation(node);
109
119
  const constrained = checker.getBaseConstraintOfType(nodeType);
@@ -146,7 +156,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
146
156
  getConstrainedTypeAtLocation(typeChecker, tsNode)
147
157
  );
148
158
  const hasPotentiallyFalseyString = types.some(
149
- (type) => isTypeFlagSet(type, TypeFlags.StringLike) && (!type.isStringLiteral() || type.value === "")
159
+ (type) => isTypeFlagSet(type, ts2.TypeFlags.StringLike) && (!type.isStringLiteral() || type.value === "")
150
160
  );
151
161
  if (!options.allowString && hasPotentiallyFalseyString) {
152
162
  return "conditionErrorFalseyString";
@@ -154,7 +164,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
154
164
  const hasPotentiallyFalseyNumber = types.some(
155
165
  (type) => isTypeFlagSet(
156
166
  type,
157
- TypeFlags.NumberLike | TypeFlags.BigIntLike
167
+ ts2.TypeFlags.NumberLike | ts2.TypeFlags.BigIntLike
158
168
  ) && (!type.isNumberLiteral() || type.value === 0)
159
169
  );
160
170
  if (!options.allowNumber && hasPotentiallyFalseyNumber) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-ziloen",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -26,7 +26,6 @@
26
26
  "eslint": "^8.52.0",
27
27
  "rimraf": "^5.0.5",
28
28
  "tsup": "^7.2.0",
29
- "tsutils": "^3.21.0",
30
29
  "typescript": "^5.2.2",
31
30
  "unbuild": "^2.0.0"
32
31
  }