eslint-plugin-ziloen 0.1.17 → 0.1.19
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.js +7 -9
- package/package.json +12 -9
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
import { TypeFlags } from "typescript";
|
|
2
3
|
|
|
3
4
|
//#region src/utils.ts
|
|
4
5
|
const createEslintRule = ESLintUtils.RuleCreator((ruleName) => ruleName);
|
|
@@ -83,12 +84,11 @@ const genericSpacing = createEslintRule({
|
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
86
|
});
|
|
86
|
-
var generic_spacing_default = genericSpacing;
|
|
87
87
|
|
|
88
88
|
//#endregion
|
|
89
89
|
//#region src/tsutils.ts
|
|
90
90
|
function isUnionType(type) {
|
|
91
|
-
return (type.flags &
|
|
91
|
+
return (type.flags & TypeFlags.Union) !== 0;
|
|
92
92
|
}
|
|
93
93
|
/** Returns all types of a union type or an array containing `type` itself if it's no union type. */
|
|
94
94
|
function unionTypeParts(type) {
|
|
@@ -139,9 +139,9 @@ const jsxStrictLogicalExpressions = createEslintRule({
|
|
|
139
139
|
const typeChecker = parserServices.program.getTypeChecker();
|
|
140
140
|
function checkIdentifier(node) {
|
|
141
141
|
const types = unionTypeParts(getConstrainedTypeAtLocation(typeChecker, parserServices.esTreeNodeToTSNodeMap.get(node)));
|
|
142
|
-
const hasPotentiallyFalseyString = types.some((type) => isTypeFlagSet(type,
|
|
142
|
+
const hasPotentiallyFalseyString = types.some((type) => isTypeFlagSet(type, TypeFlags.StringLike) && (!type.isStringLiteral() || type.value === ""));
|
|
143
143
|
if (!options.allowString && hasPotentiallyFalseyString) return "conditionErrorFalseyString";
|
|
144
|
-
const hasPotentiallyFalseyNumber = types.some((type) => isTypeFlagSet(type,
|
|
144
|
+
const hasPotentiallyFalseyNumber = types.some((type) => isTypeFlagSet(type, TypeFlags.NumberLike | TypeFlags.BigIntLike) && (!type.isNumberLiteral() || type.value === 0));
|
|
145
145
|
if (!options.allowNumber && hasPotentiallyFalseyNumber) return "conditionErrorFalseyNumber";
|
|
146
146
|
}
|
|
147
147
|
function checkAndReportIdentifier(node, fixNode) {
|
|
@@ -173,15 +173,13 @@ const jsxStrictLogicalExpressions = createEslintRule({
|
|
|
173
173
|
return { JSXExpressionContainer: checkJSXExpression };
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
|
-
var jsx_strict_logical_expressions_default = jsxStrictLogicalExpressions;
|
|
177
176
|
|
|
178
177
|
//#endregion
|
|
179
178
|
//#region src/index.ts
|
|
180
179
|
const ziloen = { rules: {
|
|
181
|
-
"generic-spacing":
|
|
182
|
-
"jsx-strict-logical-expressions":
|
|
180
|
+
"generic-spacing": genericSpacing,
|
|
181
|
+
"jsx-strict-logical-expressions": jsxStrictLogicalExpressions
|
|
183
182
|
} };
|
|
184
|
-
var src_default = ziloen;
|
|
185
183
|
|
|
186
184
|
//#endregion
|
|
187
|
-
export {
|
|
185
|
+
export { ziloen as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-ziloen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -14,17 +14,20 @@
|
|
|
14
14
|
"test": "vitest"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@typescript-eslint/utils": "8.
|
|
17
|
+
"@typescript-eslint/utils": "8.56.1"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/eslint": "^9.6.1",
|
|
21
21
|
"@types/node": "^24.1.0",
|
|
22
|
-
"@typescript-eslint/parser": "8.
|
|
23
|
-
"bumpp": "^10.
|
|
24
|
-
"eslint": "^
|
|
25
|
-
"eslint-vitest-rule-tester": "^3.0
|
|
26
|
-
"tsdown": "^0.
|
|
27
|
-
"typescript": "
|
|
28
|
-
"vitest": "^4.0.
|
|
22
|
+
"@typescript-eslint/parser": "8.56.1",
|
|
23
|
+
"bumpp": "^10.4.1",
|
|
24
|
+
"eslint": "^10.0.2",
|
|
25
|
+
"eslint-vitest-rule-tester": "^3.1.0",
|
|
26
|
+
"tsdown": "^0.20.3",
|
|
27
|
+
"typescript": "6.0.0-beta",
|
|
28
|
+
"vitest": "^4.0.18"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"typescript": ">=5.9.0"
|
|
29
32
|
}
|
|
30
33
|
}
|