eslint-plugin-ziloen 0.1.1 → 0.1.3

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.
@@ -1,6 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ default: () => src_default
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+
1
27
  // src/utils.ts
2
- import { ESLintUtils } from "@typescript-eslint/utils";
3
- var createEslintRule = ESLintUtils.RuleCreator((ruleName) => ruleName);
28
+ var import_utils = require("@typescript-eslint/utils");
29
+ var createEslintRule = import_utils.ESLintUtils.RuleCreator((ruleName) => ruleName);
4
30
 
5
31
  // src/rules/generic-spacing.ts
6
32
  var RULE_NAME = "generic-spacing";
@@ -99,13 +125,13 @@ var genericSpacing = createEslintRule({
99
125
  var generic_spacing_default = genericSpacing;
100
126
 
101
127
  // src/rules/jsx-strict-logical-expressions.ts
102
- import { ESLintUtils as ESLintUtils2, TSESTree } from "@typescript-eslint/utils";
103
- import { TypeFlags as TypeFlags2 } from "typescript";
128
+ var import_utils3 = require("@typescript-eslint/utils");
129
+ var import_typescript2 = require("typescript");
104
130
 
105
131
  // src/tsutils.ts
106
- import { TypeFlags } from "typescript";
132
+ var import_typescript = require("typescript");
107
133
  function isUnionType(type) {
108
- return (type.flags & TypeFlags.Union) !== 0;
134
+ return (type.flags & import_typescript.TypeFlags.Union) !== 0;
109
135
  }
110
136
  function unionTypeParts(type) {
111
137
  return isUnionType(type) ? type.types : [type];
@@ -148,7 +174,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
148
174
  }
149
175
  },
150
176
  create(context, [options]) {
151
- const parserServices = ESLintUtils2.getParserServices(context);
177
+ const parserServices = import_utils3.ESLintUtils.getParserServices(context);
152
178
  const typeChecker = parserServices.program.getTypeChecker();
153
179
  function checkIdentifier(node) {
154
180
  const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);
@@ -156,7 +182,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
156
182
  getConstrainedTypeAtLocation(typeChecker, tsNode)
157
183
  );
158
184
  const hasPotentiallyFalseyString = types.some(
159
- (type) => isTypeFlagSet(type, TypeFlags2.StringLike) && (!type.isStringLiteral() || type.value === "")
185
+ (type) => isTypeFlagSet(type, import_typescript2.TypeFlags.StringLike) && (!type.isStringLiteral() || type.value === "")
160
186
  );
161
187
  if (!options.allowString && hasPotentiallyFalseyString) {
162
188
  return "conditionErrorFalseyString";
@@ -164,7 +190,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
164
190
  const hasPotentiallyFalseyNumber = types.some(
165
191
  (type) => isTypeFlagSet(
166
192
  type,
167
- TypeFlags2.NumberLike | TypeFlags2.BigIntLike
193
+ import_typescript2.TypeFlags.NumberLike | import_typescript2.TypeFlags.BigIntLike
168
194
  ) && (!type.isNumberLiteral() || type.value === 0)
169
195
  );
170
196
  if (!options.allowNumber && hasPotentiallyFalseyNumber) {
@@ -184,30 +210,30 @@ var jsxStrictLogicalExpressions = createEslintRule({
184
210
  }
185
211
  function determineNode(originalNode) {
186
212
  let nodeToEvaluate = originalNode;
187
- if (nodeToEvaluate.type === TSESTree.AST_NODE_TYPES.ChainExpression) {
213
+ if (nodeToEvaluate.type === import_utils3.TSESTree.AST_NODE_TYPES.ChainExpression) {
188
214
  nodeToEvaluate = nodeToEvaluate.expression;
189
215
  }
190
- if (nodeToEvaluate.type === TSESTree.AST_NODE_TYPES.MemberExpression && nodeToEvaluate.property.type !== TSESTree.AST_NODE_TYPES.PrivateIdentifier) {
216
+ if (nodeToEvaluate.type === import_utils3.TSESTree.AST_NODE_TYPES.MemberExpression && nodeToEvaluate.property.type !== import_utils3.TSESTree.AST_NODE_TYPES.PrivateIdentifier) {
191
217
  nodeToEvaluate = nodeToEvaluate.property;
192
218
  }
193
219
  return nodeToEvaluate;
194
220
  }
195
221
  function checkLogicalExpression(expressionNode, checkRightNode) {
196
222
  const leftNode = determineNode(expressionNode.left);
197
- if (leftNode.type === TSESTree.AST_NODE_TYPES.LogicalExpression) {
223
+ if (leftNode.type === import_utils3.TSESTree.AST_NODE_TYPES.LogicalExpression) {
198
224
  checkLogicalExpression(leftNode, true);
199
- } else if (leftNode.type === TSESTree.AST_NODE_TYPES.Identifier) {
225
+ } else if (leftNode.type === import_utils3.TSESTree.AST_NODE_TYPES.Identifier) {
200
226
  checkAndReportIdentifier(leftNode, expressionNode.left);
201
227
  }
202
228
  if (checkRightNode) {
203
229
  const rightNode = determineNode(expressionNode.right);
204
- if (rightNode.type === TSESTree.AST_NODE_TYPES.Identifier) {
230
+ if (rightNode.type === import_utils3.TSESTree.AST_NODE_TYPES.Identifier) {
205
231
  checkAndReportIdentifier(rightNode, expressionNode.right);
206
232
  }
207
233
  }
208
234
  }
209
235
  function checkJSXExpression(node) {
210
- if (node.expression.type === TSESTree.AST_NODE_TYPES.LogicalExpression && node.expression.operator === "&&") {
236
+ if (node.expression.type === import_utils3.TSESTree.AST_NODE_TYPES.LogicalExpression && node.expression.operator === "&&") {
211
237
  checkLogicalExpression(node.expression, false);
212
238
  }
213
239
  }
@@ -220,15 +246,12 @@ var jsx_strict_logical_expressions_default = jsxStrictLogicalExpressions;
220
246
 
221
247
  // src/index.ts
222
248
  var ziloen = {
223
- meta: {
224
- name: "ziloen"
225
- },
249
+ // meta: {
250
+ // name: "ziloen"
251
+ // },
226
252
  rules: {
227
253
  "generic-spacing": generic_spacing_default,
228
254
  "jsx-strict-logical-expressions": jsx_strict_logical_expressions_default
229
255
  }
230
256
  };
231
257
  var src_default = ziloen;
232
- export {
233
- src_default as default
234
- };
package/dist/index.js CHANGED
@@ -1,32 +1,6 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- default: () => src_default
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
-
27
1
  // src/utils.ts
28
- var import_utils = require("@typescript-eslint/utils");
29
- var createEslintRule = import_utils.ESLintUtils.RuleCreator((ruleName) => ruleName);
2
+ import { ESLintUtils } from "@typescript-eslint/utils";
3
+ var createEslintRule = ESLintUtils.RuleCreator((ruleName) => ruleName);
30
4
 
31
5
  // src/rules/generic-spacing.ts
32
6
  var RULE_NAME = "generic-spacing";
@@ -125,13 +99,13 @@ var genericSpacing = createEslintRule({
125
99
  var generic_spacing_default = genericSpacing;
126
100
 
127
101
  // src/rules/jsx-strict-logical-expressions.ts
128
- var import_utils3 = require("@typescript-eslint/utils");
129
- var import_typescript2 = require("typescript");
102
+ import { ESLintUtils as ESLintUtils2, TSESTree } from "@typescript-eslint/utils";
103
+ import { TypeFlags as TypeFlags2 } from "typescript";
130
104
 
131
105
  // src/tsutils.ts
132
- var import_typescript = require("typescript");
106
+ import { TypeFlags } from "typescript";
133
107
  function isUnionType(type) {
134
- return (type.flags & import_typescript.TypeFlags.Union) !== 0;
108
+ return (type.flags & TypeFlags.Union) !== 0;
135
109
  }
136
110
  function unionTypeParts(type) {
137
111
  return isUnionType(type) ? type.types : [type];
@@ -174,7 +148,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
174
148
  }
175
149
  },
176
150
  create(context, [options]) {
177
- const parserServices = import_utils3.ESLintUtils.getParserServices(context);
151
+ const parserServices = ESLintUtils2.getParserServices(context);
178
152
  const typeChecker = parserServices.program.getTypeChecker();
179
153
  function checkIdentifier(node) {
180
154
  const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);
@@ -182,7 +156,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
182
156
  getConstrainedTypeAtLocation(typeChecker, tsNode)
183
157
  );
184
158
  const hasPotentiallyFalseyString = types.some(
185
- (type) => isTypeFlagSet(type, import_typescript2.TypeFlags.StringLike) && (!type.isStringLiteral() || type.value === "")
159
+ (type) => isTypeFlagSet(type, TypeFlags2.StringLike) && (!type.isStringLiteral() || type.value === "")
186
160
  );
187
161
  if (!options.allowString && hasPotentiallyFalseyString) {
188
162
  return "conditionErrorFalseyString";
@@ -190,7 +164,7 @@ var jsxStrictLogicalExpressions = createEslintRule({
190
164
  const hasPotentiallyFalseyNumber = types.some(
191
165
  (type) => isTypeFlagSet(
192
166
  type,
193
- import_typescript2.TypeFlags.NumberLike | import_typescript2.TypeFlags.BigIntLike
167
+ TypeFlags2.NumberLike | TypeFlags2.BigIntLike
194
168
  ) && (!type.isNumberLiteral() || type.value === 0)
195
169
  );
196
170
  if (!options.allowNumber && hasPotentiallyFalseyNumber) {
@@ -210,30 +184,30 @@ var jsxStrictLogicalExpressions = createEslintRule({
210
184
  }
211
185
  function determineNode(originalNode) {
212
186
  let nodeToEvaluate = originalNode;
213
- if (nodeToEvaluate.type === import_utils3.TSESTree.AST_NODE_TYPES.ChainExpression) {
187
+ if (nodeToEvaluate.type === TSESTree.AST_NODE_TYPES.ChainExpression) {
214
188
  nodeToEvaluate = nodeToEvaluate.expression;
215
189
  }
216
- if (nodeToEvaluate.type === import_utils3.TSESTree.AST_NODE_TYPES.MemberExpression && nodeToEvaluate.property.type !== import_utils3.TSESTree.AST_NODE_TYPES.PrivateIdentifier) {
190
+ if (nodeToEvaluate.type === TSESTree.AST_NODE_TYPES.MemberExpression && nodeToEvaluate.property.type !== TSESTree.AST_NODE_TYPES.PrivateIdentifier) {
217
191
  nodeToEvaluate = nodeToEvaluate.property;
218
192
  }
219
193
  return nodeToEvaluate;
220
194
  }
221
195
  function checkLogicalExpression(expressionNode, checkRightNode) {
222
196
  const leftNode = determineNode(expressionNode.left);
223
- if (leftNode.type === import_utils3.TSESTree.AST_NODE_TYPES.LogicalExpression) {
197
+ if (leftNode.type === TSESTree.AST_NODE_TYPES.LogicalExpression) {
224
198
  checkLogicalExpression(leftNode, true);
225
- } else if (leftNode.type === import_utils3.TSESTree.AST_NODE_TYPES.Identifier) {
199
+ } else if (leftNode.type === TSESTree.AST_NODE_TYPES.Identifier) {
226
200
  checkAndReportIdentifier(leftNode, expressionNode.left);
227
201
  }
228
202
  if (checkRightNode) {
229
203
  const rightNode = determineNode(expressionNode.right);
230
- if (rightNode.type === import_utils3.TSESTree.AST_NODE_TYPES.Identifier) {
204
+ if (rightNode.type === TSESTree.AST_NODE_TYPES.Identifier) {
231
205
  checkAndReportIdentifier(rightNode, expressionNode.right);
232
206
  }
233
207
  }
234
208
  }
235
209
  function checkJSXExpression(node) {
236
- if (node.expression.type === import_utils3.TSESTree.AST_NODE_TYPES.LogicalExpression && node.expression.operator === "&&") {
210
+ if (node.expression.type === TSESTree.AST_NODE_TYPES.LogicalExpression && node.expression.operator === "&&") {
237
211
  checkLogicalExpression(node.expression, false);
238
212
  }
239
213
  }
@@ -246,12 +220,15 @@ var jsx_strict_logical_expressions_default = jsxStrictLogicalExpressions;
246
220
 
247
221
  // src/index.ts
248
222
  var ziloen = {
249
- meta: {
250
- name: "ziloen"
251
- },
223
+ // meta: {
224
+ // name: "ziloen"
225
+ // },
252
226
  rules: {
253
227
  "generic-spacing": generic_spacing_default,
254
228
  "jsx-strict-logical-expressions": jsx_strict_logical_expressions_default
255
229
  }
256
230
  };
257
231
  var src_default = ziloen;
232
+ export {
233
+ src_default as default
234
+ };
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "eslint-plugin-ziloen",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
+ "type": "module",
4
5
  "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
5
7
  "files": [
6
8
  "dist"
7
9
  ],