eslint-plugin-ziloen 0.1.3 → 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 +15 -5
- package/dist/index.js +5 -5
- package/package.json +8 -2
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,12 +136,12 @@ 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
|
|
139
|
+
var ts2 = __toESM(require("typescript"), 1);
|
|
130
140
|
|
|
131
141
|
// src/tsutils.ts
|
|
132
|
-
var
|
|
142
|
+
var ts = __toESM(require("typescript"), 1);
|
|
133
143
|
function isUnionType(type) {
|
|
134
|
-
return (type.flags &
|
|
144
|
+
return (type.flags & ts.TypeFlags.Union) !== 0;
|
|
135
145
|
}
|
|
136
146
|
function unionTypeParts(type) {
|
|
137
147
|
return isUnionType(type) ? type.types : [type];
|
|
@@ -182,7 +192,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
|
|
|
182
192
|
getConstrainedTypeAtLocation(typeChecker, tsNode)
|
|
183
193
|
);
|
|
184
194
|
const hasPotentiallyFalseyString = types.some(
|
|
185
|
-
(type) => isTypeFlagSet(type,
|
|
195
|
+
(type) => isTypeFlagSet(type, ts2.TypeFlags.StringLike) && (!type.isStringLiteral() || type.value === "")
|
|
186
196
|
);
|
|
187
197
|
if (!options.allowString && hasPotentiallyFalseyString) {
|
|
188
198
|
return "conditionErrorFalseyString";
|
|
@@ -190,7 +200,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
|
|
|
190
200
|
const hasPotentiallyFalseyNumber = types.some(
|
|
191
201
|
(type) => isTypeFlagSet(
|
|
192
202
|
type,
|
|
193
|
-
|
|
203
|
+
ts2.TypeFlags.NumberLike | ts2.TypeFlags.BigIntLike
|
|
194
204
|
) && (!type.isNumberLiteral() || type.value === 0)
|
|
195
205
|
);
|
|
196
206
|
if (!options.allowNumber && hasPotentiallyFalseyNumber) {
|
package/dist/index.js
CHANGED
|
@@ -100,12 +100,12 @@ 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
|
|
103
|
+
import * as ts2 from "typescript";
|
|
104
104
|
|
|
105
105
|
// src/tsutils.ts
|
|
106
|
-
import
|
|
106
|
+
import * as ts from "typescript";
|
|
107
107
|
function isUnionType(type) {
|
|
108
|
-
return (type.flags & TypeFlags.Union) !== 0;
|
|
108
|
+
return (type.flags & ts.TypeFlags.Union) !== 0;
|
|
109
109
|
}
|
|
110
110
|
function unionTypeParts(type) {
|
|
111
111
|
return isUnionType(type) ? type.types : [type];
|
|
@@ -156,7 +156,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
|
|
|
156
156
|
getConstrainedTypeAtLocation(typeChecker, tsNode)
|
|
157
157
|
);
|
|
158
158
|
const hasPotentiallyFalseyString = types.some(
|
|
159
|
-
(type) => isTypeFlagSet(type,
|
|
159
|
+
(type) => isTypeFlagSet(type, ts2.TypeFlags.StringLike) && (!type.isStringLiteral() || type.value === "")
|
|
160
160
|
);
|
|
161
161
|
if (!options.allowString && hasPotentiallyFalseyString) {
|
|
162
162
|
return "conditionErrorFalseyString";
|
|
@@ -164,7 +164,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
|
|
|
164
164
|
const hasPotentiallyFalseyNumber = types.some(
|
|
165
165
|
(type) => isTypeFlagSet(
|
|
166
166
|
type,
|
|
167
|
-
|
|
167
|
+
ts2.TypeFlags.NumberLike | ts2.TypeFlags.BigIntLike
|
|
168
168
|
) && (!type.isNumberLiteral() || type.value === 0)
|
|
169
169
|
);
|
|
170
170
|
if (!options.allowNumber && hasPotentiallyFalseyNumber) {
|
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-ziloen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
|
-
"module": "./dist/index.
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
7
13
|
"files": [
|
|
8
14
|
"dist"
|
|
9
15
|
],
|