@ms-cloudpack/eslint-plugin 0.6.0 → 0.6.2

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 +1 @@
1
- {"version":3,"file":"flat.d.mts","sourceRoot":"","sources":["../src/flat.mts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM;;;;;;;2FAK68J,CAAC;;CAFz9J,CAAC;AACF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"flat.d.mts","sourceRoot":"","sources":["../src/flat.mts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM;;;;;;;2FAK6xK,CAAC;;CAFzyK,CAAC;AACF,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM;IAEV,gGAAgG;;;;;;;2FAKwuJ,CAAC;;CAH10J,CAAC;AAEF,SAAS,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM;IAEV,gGAAgG;;;;;;;2FAKwjK,CAAC;;CAH1pK,CAAC;AAEF,SAAS,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getImportPathLiteralNode.d.ts","sourceRoot":"","sources":["../../src/utils/getImportPathLiteralNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,MAAM,cAAc,GACtB,QAAQ,CAAC,cAAc,GACvB,QAAQ,CAAC,oBAAoB,GAC7B,QAAQ,CAAC,sBAAsB,GAC/B,QAAQ,CAAC,iBAAiB,GAC1B,QAAQ,CAAC,gBAAgB,GACzB,QAAQ,CAAC,yBAAyB,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,cAAc,GACnB;IAAE,QAAQ,EAAE,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,eAAe,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAwC5F"}
1
+ {"version":3,"file":"getImportPathLiteralNode.d.ts","sourceRoot":"","sources":["../../src/utils/getImportPathLiteralNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,MAAM,cAAc,GACtB,QAAQ,CAAC,cAAc,GACvB,QAAQ,CAAC,oBAAoB,GAC7B,QAAQ,CAAC,sBAAsB,GAC/B,QAAQ,CAAC,iBAAiB,GAC1B,QAAQ,CAAC,gBAAgB,GACzB,QAAQ,CAAC,yBAAyB,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,cAAc,GACnB;IAAE,QAAQ,EAAE,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,eAAe,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA6C5F"}
@@ -36,7 +36,10 @@ function getImportPathLiteralNode(node) {
36
36
  if (pathNode?.type === 'Literal' && typeof pathNode.value === 'string') {
37
37
  return { pathNode, importPath: pathNode.value };
38
38
  }
39
- if (pathNode?.type === 'TemplateLiteral' && pathNode.expressions.length === 0 && pathNode.quasis.length === 1) {
39
+ if (pathNode?.type === 'TemplateLiteral' &&
40
+ pathNode.expressions.length === 0 &&
41
+ pathNode.quasis.length === 1 &&
42
+ pathNode.quasis[0].value.cooked) {
40
43
  return { pathNode, importPath: pathNode.quasis[0].value.cooked };
41
44
  }
42
45
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"getImportPathLiteralNode.js","sourceRoot":"","sources":["../../src/utils/getImportPathLiteralNode.ts"],"names":[],"mappings":";;AAcA,4DA0CC;AA9CD;;;GAGG;AACH,SAAgB,wBAAwB,CACtC,IAAoB;IAEpB,IAAI,QAAQ,GAAyB,IAAI,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;IACzB,CAAC;IAED,IAAI,QAAQ,EAAE,IAAI,KAAK,SAAS,IAAI,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;IAClD,CAAC;IAED,IAAI,QAAQ,EAAE,IAAI,KAAK,iBAAiB,IAAI,QAAQ,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9G,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IACnE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\n\nexport type ImportLikeNode =\n | TSESTree.CallExpression\n | TSESTree.ExportAllDeclaration\n | TSESTree.ExportNamedDeclaration\n | TSESTree.ImportDeclaration\n | TSESTree.ImportExpression\n | TSESTree.TSImportEqualsDeclaration;\n\n/**\n * Verifies that the given node contains a string literal import path, and if so, returns the path node.\n * (For `CallExpression` nodes, also verifies that the callee is `require` or `require.resolve`.)\n */\nexport function getImportPathLiteralNode(\n node: ImportLikeNode,\n): { pathNode: TSESTree.StringLiteral | TSESTree.TemplateLiteral; importPath: string } | null {\n let pathNode: TSESTree.Node | null = null;\n\n if (node.type === 'CallExpression') {\n const isRequire = node.callee.type === 'Identifier' && node.callee.name === 'require';\n const isRequireResolve =\n node.callee.type === 'MemberExpression' &&\n node.callee.object.type === 'Identifier' &&\n node.callee.object.name === 'require' &&\n node.callee.property.type === 'Identifier' &&\n node.callee.property.name === 'resolve';\n\n if ((isRequire || isRequireResolve) && node.arguments.length === 1) {\n pathNode = node.arguments[0];\n }\n } else if (node.type === 'TSImportEqualsDeclaration') {\n if (node.moduleReference.type === 'TSExternalModuleReference') {\n // import foo = require('foo');\n pathNode = node.moduleReference.expression;\n }\n } else if (\n node.type === 'ExportNamedDeclaration' &&\n node.declaration?.type === 'TSImportEqualsDeclaration' &&\n node.declaration.moduleReference.type === 'TSExternalModuleReference'\n ) {\n // export import foo = require('foo');\n pathNode = node.declaration.moduleReference.expression;\n } else {\n pathNode = node.source;\n }\n\n if (pathNode?.type === 'Literal' && typeof pathNode.value === 'string') {\n return { pathNode, importPath: pathNode.value };\n }\n\n if (pathNode?.type === 'TemplateLiteral' && pathNode.expressions.length === 0 && pathNode.quasis.length === 1) {\n return { pathNode, importPath: pathNode.quasis[0].value.cooked };\n }\n\n return null;\n}\n"]}
1
+ {"version":3,"file":"getImportPathLiteralNode.js","sourceRoot":"","sources":["../../src/utils/getImportPathLiteralNode.ts"],"names":[],"mappings":";;AAcA,4DA+CC;AAnDD;;;GAGG;AACH,SAAgB,wBAAwB,CACtC,IAAoB;IAEpB,IAAI,QAAQ,GAAyB,IAAI,CAAC;IAE1C,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;QACnC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC;QACtF,MAAM,gBAAgB,GACpB,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB;YACvC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY;YACxC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS;YACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY;YAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC;QAE1C,IAAI,CAAC,SAAS,IAAI,gBAAgB,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnE,QAAQ,GAAG,IA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LikeNode =\n | TSESTree.CallExpression\n | TSESTree.ExportAllDeclaration\n | TSESTree.ExportNamedDeclaration\n | TSESTree.ImportDeclaration\n | TSESTree.ImportExpression\n | TSESTree.TSImportEqualsDeclaration;\n\n/**\n * Verifies that the given node contains a string literal import path, and if so, returns the path node.\n * (For `CallExpression` nodes, also verifies that the callee is `require` or `require.resolve`.)\n */\nexport function getImportPathLiteralNode(\n node: ImportLikeNode,\n): { pathNode: TSESTree.StringLiteral | TSESTree.TemplateLiteral; importPath: string } | null {\n let pathNode: TSESTree.Node | null = null;\n\n if (node.type === 'CallExpression') {\n const isRequire = node.callee.type === 'Identifier' && node.callee.name === 'require';\n const isRequireResolve =\n node.callee.type === 'MemberExpression' &&\n node.callee.object.type === 'Identifier' &&\n node.callee.object.name === 'require' &&\n node.callee.property.type === 'Identifier' &&\n node.callee.property.name === 'resolve';\n\n if ((isRequire || isRequireResolve) && node.arguments.length === 1) {\n pathNode = node.arguments[0];\n }\n } else if (node.type === 'TSImportEqualsDeclaration') {\n if (node.moduleReference.type === 'TSExternalModuleReference') {\n // import foo = require('foo');\n pathNode = node.moduleReference.expression;\n }\n } else if (\n node.type === 'ExportNamedDeclaration' &&\n node.declaration?.type === 'TSImportEqualsDeclaration' &&\n node.declaration.moduleReference.type === 'TSExternalModuleReference'\n ) {\n // export import foo = require('foo');\n pathNode = node.declaration.moduleReference.expression;\n } else {\n pathNode = node.source;\n }\n\n if (pathNode?.type === 'Literal' && typeof pathNode.value === 'string') {\n return { pathNode, importPath: pathNode.value };\n }\n\n if (\n pathNode?.type === 'TemplateLiteral' &&\n pathNode.expressions.length === 0 &&\n pathNode.quasis.length === 1 &&\n pathNode.quasis[0].value.cooked\n ) {\n return { pathNode, importPath: pathNode.quasis[0].value.cooked };\n }\n\n return null;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/eslint-plugin",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "A set of ESLint rules for Cloudpack",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -27,7 +27,7 @@
27
27
  "resolve": "^1.22.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "@rnx-kit/eslint-plugin": "^0.8.0",
30
+ "@rnx-kit/eslint-plugin": "^0.9.0",
31
31
  "@typescript-eslint/eslint-plugin": "^8.0.0",
32
32
  "@typescript-eslint/parser": "^8.0.0",
33
33
  "eslint": "^8.0.0 || ^9.0.0",
@@ -42,13 +42,13 @@
42
42
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
43
43
  "@ms-cloudpack/scripts": "^0.0.1",
44
44
  "@ms-cloudpack/test-utilities": "^0.5.0",
45
- "@rnx-kit/eslint-plugin": "^0.8.0",
45
+ "@rnx-kit/eslint-plugin": "^0.9.0",
46
46
  "@typescript-eslint/eslint-plugin": "^8.0.0",
47
47
  "@typescript-eslint/parser": "^8.0.0",
48
48
  "@typescript-eslint/rule-tester": "^8.0.0",
49
49
  "@typescript-eslint/utils": "^8.0.0",
50
50
  "eslint": "^9.0.0",
51
- "typescript": "~5.8.0"
51
+ "typescript": "~5.9.0"
52
52
  },
53
53
  "files": [
54
54
  "lib/**/!(*.test.*)"