@cedarjs/eslint-plugin 5.0.4-next.167 → 5.0.4

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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { ESLintUtils } from '@typescript-eslint/utils';
2
2
  export declare const meta: {
3
3
  name: string;
4
- version: string;
4
+ version: any;
5
5
  };
6
6
  export declare const rules: {
7
7
  'process-env-computed': ESLintUtils.RuleModule<"unexpected", [], unknown, ESLintUtils.RuleListener>;
@@ -11,7 +11,7 @@ export declare const rules: {
11
11
  declare const plugin: {
12
12
  meta: {
13
13
  name: string;
14
- version: string;
14
+ version: any;
15
15
  };
16
16
  rules: {
17
17
  'process-env-computed': ESLintUtils.RuleModule<"unexpected", [], unknown, ESLintUtils.RuleListener>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAQ3D,eAAO,MAAM,IAAI;;;CAGhB,CAAA;AAED,eAAO,MAAM,KAAK;;;;CAIwC,CAAA;AAE1D,QAAA,MAAM,MAAM;;;;;;;;;;CAAkB,CAAA;AAE9B,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAM3D,eAAO,MAAM,IAAI;;;CAGhB,CAAA;AAED,eAAO,MAAM,KAAK;;;;CAIwC,CAAA;AAE1D,QAAA,MAAM,MAAM;;;;;;;;;;CAAkB,CAAA;AAE9B,eAAe,MAAM,CAAA"}
package/dist/index.js CHANGED
@@ -1,20 +1,44 @@
1
- import pkgJson from "../package.json" with { type: "json" };
2
- import { processEnvComputedRule } from "./process-env-computed.js";
3
- import { serviceTypeAnnotations } from "./service-type-annotations.js";
4
- import { unsupportedRouteComponents } from "./unsupported-route-components.js";
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
+ var index_exports = {};
20
+ __export(index_exports, {
21
+ default: () => index_default,
22
+ meta: () => meta,
23
+ rules: () => rules
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ var import_process_env_computed = require("./process-env-computed.js");
27
+ var import_service_type_annotations = require("./service-type-annotations.js");
28
+ var import_unsupported_route_components = require("./unsupported-route-components.js");
5
29
  const meta = {
6
30
  name: "@cedarjs/eslint-plugin",
7
- version: pkgJson.version
31
+ version: require("../package.json").version
8
32
  };
9
33
  const rules = {
10
- "process-env-computed": processEnvComputedRule,
11
- "service-type-annotations": serviceTypeAnnotations,
12
- "unsupported-route-components": unsupportedRouteComponents
34
+ "process-env-computed": import_process_env_computed.processEnvComputedRule,
35
+ "service-type-annotations": import_service_type_annotations.serviceTypeAnnotations,
36
+ "unsupported-route-components": import_unsupported_route_components.unsupportedRouteComponents
13
37
  };
14
38
  const plugin = { meta, rules };
15
39
  var index_default = plugin;
16
- export {
17
- index_default as default,
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
18
42
  meta,
19
43
  rules
20
- };
44
+ });
@@ -1,10 +1,33 @@
1
- import { ESLintUtils, AST_NODE_TYPES } from "@typescript-eslint/utils";
2
- const createRule = ESLintUtils.RuleCreator.withoutDocs;
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
+ var process_env_computed_exports = {};
20
+ __export(process_env_computed_exports, {
21
+ processEnvComputedRule: () => processEnvComputedRule
22
+ });
23
+ module.exports = __toCommonJS(process_env_computed_exports);
24
+ var import_utils = require("@typescript-eslint/utils");
25
+ const createRule = import_utils.ESLintUtils.RuleCreator.withoutDocs;
3
26
  function isProcessEnv(node) {
4
- return node.type === AST_NODE_TYPES.MemberExpression && hasName(node.object, "process") && hasName(node.property, "env");
27
+ return node.type === import_utils.AST_NODE_TYPES.MemberExpression && hasName(node.object, "process") && hasName(node.property, "env");
5
28
  }
6
29
  function hasName(node, name) {
7
- return node.type === AST_NODE_TYPES.Identifier && node.name === name;
30
+ return node.type === import_utils.AST_NODE_TYPES.Identifier && node.name === name;
8
31
  }
9
32
  function isTestFile(filename) {
10
33
  return filename.endsWith(".test.ts") || filename.endsWith(".test.js") || filename.endsWith(".test.tsx") || filename.endsWith(".test.jsx") || filename.endsWith(".test.mts") || filename.endsWith(".test.mjs") || filename.endsWith(".test.cjs") || filename.endsWith(".spec.ts") || filename.endsWith(".spec.js") || filename.endsWith(".spec.tsx") || filename.endsWith(".spec.jsx") || filename.endsWith(".spec.mts") || filename.endsWith(".spec.mjs") || filename.endsWith(".spec.cjs") || filename.includes("/__tests__/");
@@ -36,6 +59,7 @@ const processEnvComputedRule = createRule({
36
59
  };
37
60
  }
38
61
  });
39
- export {
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
40
64
  processEnvComputedRule
41
- };
65
+ });
@@ -1,6 +1,29 @@
1
- import { basename } from "node:path";
2
- import { ESLintUtils, AST_NODE_TYPES } from "@typescript-eslint/utils";
3
- const createRule = ESLintUtils.RuleCreator.withoutDocs;
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
+ var service_type_annotations_exports = {};
20
+ __export(service_type_annotations_exports, {
21
+ serviceTypeAnnotations: () => serviceTypeAnnotations
22
+ });
23
+ module.exports = __toCommonJS(service_type_annotations_exports);
24
+ var import_node_path = require("node:path");
25
+ var import_utils = require("@typescript-eslint/utils");
26
+ const createRule = import_utils.ESLintUtils.RuleCreator.withoutDocs;
4
27
  const capitalizeFirstLetter = (str) => str.charAt(0).toUpperCase() + str.slice(1);
5
28
  const serviceTypeAnnotations = createRule({
6
29
  meta: {
@@ -16,7 +39,7 @@ const serviceTypeAnnotations = createRule({
16
39
  },
17
40
  defaultOptions: [],
18
41
  create(context) {
19
- const thisFilename = basename(context.filename);
42
+ const thisFilename = (0, import_node_path.basename)(context.filename);
20
43
  const sansTS = thisFilename.replace(".ts", "");
21
44
  const thisFileCorrespondingImport = `types/${sansTS}`;
22
45
  let importForThisFile = null;
@@ -28,18 +51,18 @@ const serviceTypeAnnotations = createRule({
28
51
  },
29
52
  // Then start looking at every exported fn/const
30
53
  ExportNamedDeclaration(node) {
31
- if (node.declaration?.type !== AST_NODE_TYPES.VariableDeclaration) {
54
+ if (node.declaration?.type !== import_utils.AST_NODE_TYPES.VariableDeclaration) {
32
55
  return;
33
56
  }
34
57
  node.declaration.declarations.forEach((vd) => {
35
- if (vd.type === AST_NODE_TYPES.VariableDeclarator && vd.id.type === AST_NODE_TYPES.Identifier) {
58
+ if (vd.type === import_utils.AST_NODE_TYPES.VariableDeclarator && vd.id.type === import_utils.AST_NODE_TYPES.Identifier) {
36
59
  if (vd.id.name.startsWith("_")) {
37
60
  return;
38
61
  }
39
62
  const isGlobalOrMutationResolver = /^[a-z]/.test(vd.id.name);
40
63
  const suffix = isGlobalOrMutationResolver ? "Resolver" : "TypeResolvers";
41
64
  const typeName = capitalizeFirstLetter(vd.id.name) + suffix;
42
- if (isGlobalOrMutationResolver && vd.init?.type !== AST_NODE_TYPES.ArrowFunctionExpression) {
65
+ if (isGlobalOrMutationResolver && vd.init?.type !== import_utils.AST_NODE_TYPES.ArrowFunctionExpression) {
43
66
  return;
44
67
  }
45
68
  const tsID = vd.id;
@@ -75,7 +98,7 @@ const serviceTypeAnnotations = createRule({
75
98
  if (!("typeName" in type)) {
76
99
  return;
77
100
  }
78
- const isCorrectType = type.typeName?.type === AST_NODE_TYPES.Identifier && type.typeName?.name === typeName;
101
+ const isCorrectType = type.typeName?.type === import_utils.AST_NODE_TYPES.Identifier && type.typeName?.name === typeName;
79
102
  if (isCorrectType) {
80
103
  return;
81
104
  }
@@ -111,6 +134,7 @@ const serviceTypeAnnotations = createRule({
111
134
  };
112
135
  }
113
136
  });
114
- export {
137
+ // Annotate the CommonJS export names for ESM import in node:
138
+ 0 && (module.exports = {
115
139
  serviceTypeAnnotations
116
- };
140
+ });
@@ -1,12 +1,35 @@
1
- import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
2
- const createRule = ESLintUtils.RuleCreator.withoutDocs;
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
+ var unsupported_route_components_exports = {};
20
+ __export(unsupported_route_components_exports, {
21
+ unsupportedRouteComponents: () => unsupportedRouteComponents
22
+ });
23
+ module.exports = __toCommonJS(unsupported_route_components_exports);
24
+ var import_utils = require("@typescript-eslint/utils");
25
+ const createRule = import_utils.ESLintUtils.RuleCreator.withoutDocs;
3
26
  function isAllowedElement(name) {
4
27
  const allowedElements = ["Router", "Route", "Set", "PrivateSet", "Private"];
5
28
  return allowedElements.includes(name);
6
29
  }
7
30
  function checkNodes(nodesToCheck, context) {
8
- if (nodesToCheck.type === AST_NODE_TYPES.JSXElement) {
9
- const name = nodesToCheck.openingElement.name.type === AST_NODE_TYPES.JSXIdentifier ? nodesToCheck.openingElement.name.name : null;
31
+ if (nodesToCheck.type === import_utils.AST_NODE_TYPES.JSXElement) {
32
+ const name = nodesToCheck.openingElement.name.type === import_utils.AST_NODE_TYPES.JSXIdentifier ? nodesToCheck.openingElement.name.name : null;
10
33
  if (name && !isAllowedElement(name)) {
11
34
  context.report({
12
35
  node: nodesToCheck,
@@ -36,11 +59,11 @@ const unsupportedRouteComponents = createRule({
36
59
  VariableDeclaration(node) {
37
60
  if (isRoutesRenderBlock(node.declarations[0])) {
38
61
  const routesDeclaration = node.declarations[0].init;
39
- if (routesDeclaration?.type === AST_NODE_TYPES.ArrowFunctionExpression) {
40
- if (routesDeclaration.body.type === AST_NODE_TYPES.JSXElement) {
62
+ if (routesDeclaration?.type === import_utils.AST_NODE_TYPES.ArrowFunctionExpression) {
63
+ if (routesDeclaration.body.type === import_utils.AST_NODE_TYPES.JSXElement) {
41
64
  checkNodes(routesDeclaration.body, context);
42
- } else if (routesDeclaration.body.type === AST_NODE_TYPES.BlockStatement) {
43
- if (routesDeclaration.body.body[0].type === AST_NODE_TYPES.ReturnStatement && routesDeclaration.body.body[0].argument?.type === AST_NODE_TYPES.JSXElement) {
65
+ } else if (routesDeclaration.body.type === import_utils.AST_NODE_TYPES.BlockStatement) {
66
+ if (routesDeclaration.body.body[0].type === import_utils.AST_NODE_TYPES.ReturnStatement && routesDeclaration.body.body[0].argument?.type === import_utils.AST_NODE_TYPES.JSXElement) {
44
67
  const routesReturnStatement = routesDeclaration.body.body[0].argument;
45
68
  checkNodes(routesReturnStatement, context);
46
69
  }
@@ -52,8 +75,9 @@ const unsupportedRouteComponents = createRule({
52
75
  }
53
76
  });
54
77
  function isRoutesRenderBlock(node) {
55
- return node?.type === AST_NODE_TYPES.VariableDeclarator && node?.id.type === AST_NODE_TYPES.Identifier && node?.id.name === "Routes";
78
+ return node?.type === import_utils.AST_NODE_TYPES.VariableDeclarator && node?.id.type === import_utils.AST_NODE_TYPES.Identifier && node?.id.name === "Routes";
56
79
  }
57
- export {
80
+ // Annotate the CommonJS export names for ESM import in node:
81
+ 0 && (module.exports = {
58
82
  unsupportedRouteComponents
59
- };
83
+ });
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@cedarjs/eslint-plugin",
3
- "version": "5.0.4-next.167",
3
+ "version": "5.0.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
7
7
  "directory": "packages/eslint-plugin"
8
8
  },
9
9
  "license": "MIT",
10
- "type": "module",
10
+ "type": "commonjs",
11
11
  "main": "./dist/index.js",
12
12
  "types": "./dist/index.d.ts",
13
13
  "files": [
14
14
  "dist"
15
15
  ],
16
16
  "scripts": {
17
- "build": "node ./build.mts",
17
+ "build": "node ./build.mts && yarn build:types",
18
18
  "build:pack": "yarn pack -o cedarjs-eslint-plugin.tgz",
19
- "build:types": "tsc --build --verbose ./tsconfig.build.json",
19
+ "build:types": "tsc --build --verbose",
20
20
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build\"",
21
21
  "prepublishOnly": "NODE_ENV=production yarn build",
22
22
  "test": "vitest run",
@@ -27,13 +27,13 @@
27
27
  "eslint": "8.57.1"
28
28
  },
29
29
  "devDependencies": {
30
- "@cedarjs/framework-tools": "5.0.4-next.167",
30
+ "@cedarjs/framework-tools": "5.0.4",
31
31
  "@types/eslint": "8.56.12",
32
32
  "@types/estree": "1.0.9",
33
33
  "@typescript-eslint/parser": "8.60.1",
34
34
  "@typescript-eslint/rule-tester": "8.60.1",
35
35
  "typescript": "5.9.3",
36
- "vitest": "4.1.10"
36
+ "vitest": "3.2.6"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=24"