@remotion/eslint-plugin 4.0.541 → 4.0.543

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/cjs/index.js CHANGED
@@ -430,7 +430,8 @@ var no_string_assets_default = createRule7({
430
430
  if (node.type !== "JSXAttribute") {
431
431
  return;
432
432
  }
433
- if (node.name.name !== "src") {
433
+ const attributeName = node.name.name;
434
+ if (attributeName !== "src" && attributeName !== "srcSet") {
434
435
  return;
435
436
  }
436
437
  const value = node.value;
@@ -454,13 +455,12 @@ var no_string_assets_default = createRule7({
454
455
  return;
455
456
  }
456
457
  if (name.name === "Img" || name.name === "img" || name.name === "Audio" || name.name === "audio" || name.name === "Video" || name.name === "video" || name.name === "source" || name.name === "Html5Video" || name.name === "Html5Audio") {
457
- if (stringValue.startsWith("http://")) {
458
+ if (stringValue.startsWith("data:")) {
458
459
  return;
459
460
  }
460
- if (stringValue.startsWith("https://")) {
461
- return;
462
- }
463
- if (stringValue.startsWith("data:")) {
461
+ const urls = attributeName === "srcSet" ? stringValue.split(",").map((candidate) => candidate.trim().split(/\s+/)[0]) : [stringValue];
462
+ const isRemote = urls.every((url) => url.startsWith("http://") || url.startsWith("https://") || url.startsWith("data:"));
463
+ if (isRemote) {
464
464
  return;
465
465
  }
466
466
  context.report({
@@ -711,11 +711,15 @@ var staticfile_no_relative_default = createRule10({
711
711
  return;
712
712
  }
713
713
  const firstArg = args[0];
714
+ let value = null;
714
715
  if (firstArg.type === "Literal") {
715
- const value = firstArg.value;
716
- if (typeof value !== "string") {
717
- return;
716
+ if (typeof firstArg.value === "string") {
717
+ value = firstArg.value;
718
718
  }
719
+ } else if (firstArg.type === "TemplateLiteral") {
720
+ value = firstArg.quasis[0]?.value.cooked ?? null;
721
+ }
722
+ if (value !== null) {
719
723
  if (value.startsWith("./")) {
720
724
  context.report({
721
725
  messageId: "RelativePathStaticFile",
@@ -734,7 +738,7 @@ var staticfile_no_relative_default = createRule10({
734
738
  node
735
739
  });
736
740
  }
737
- if (value.startsWith("/Users") || value.startsWith("/home") || value.startsWith("/tmp") || value.startsWith("/etc") || value.startsWith("/opt") || value.startsWith("/var") || value.startsWith("C:") || value.startsWith("D:") || value.startsWith("E:")) {
741
+ if (value.startsWith("/Users") || value.startsWith("/home") || value.startsWith("/tmp") || value.startsWith("/etc") || value.startsWith("/opt") || value.startsWith("/var") || /^[a-zA-Z]:[\\/]/.test(value) || value.startsWith("\\\\")) {
738
742
  context.report({
739
743
  messageId: "AbsoluteStaticFile",
740
744
  node
@@ -785,11 +789,15 @@ var staticfile_no_remote_default = createRule11({
785
789
  return;
786
790
  }
787
791
  const firstArg = args[0];
792
+ let value = null;
788
793
  if (firstArg.type === "Literal") {
789
- const value = firstArg.value;
790
- if (typeof value !== "string") {
791
- return;
794
+ if (typeof firstArg.value === "string") {
795
+ value = firstArg.value;
792
796
  }
797
+ } else if (firstArg.type === "TemplateLiteral") {
798
+ value = firstArg.quasis[0]?.value.cooked ?? null;
799
+ }
800
+ if (value !== null) {
793
801
  if (value.startsWith("http://")) {
794
802
  context.report({
795
803
  messageId: "RelativePathStaticFile",
@@ -460,7 +460,8 @@ var init_no_string_assets = __esm(() => {
460
460
  if (node.type !== "JSXAttribute") {
461
461
  return;
462
462
  }
463
- if (node.name.name !== "src") {
463
+ const attributeName = node.name.name;
464
+ if (attributeName !== "src" && attributeName !== "srcSet") {
464
465
  return;
465
466
  }
466
467
  const value = node.value;
@@ -484,13 +485,12 @@ var init_no_string_assets = __esm(() => {
484
485
  return;
485
486
  }
486
487
  if (name.name === "Img" || name.name === "img" || name.name === "Audio" || name.name === "audio" || name.name === "Video" || name.name === "video" || name.name === "source" || name.name === "Html5Video" || name.name === "Html5Audio") {
487
- if (stringValue.startsWith("http://")) {
488
+ if (stringValue.startsWith("data:")) {
488
489
  return;
489
490
  }
490
- if (stringValue.startsWith("https://")) {
491
- return;
492
- }
493
- if (stringValue.startsWith("data:")) {
491
+ const urls = attributeName === "srcSet" ? stringValue.split(",").map((candidate) => candidate.trim().split(/\s+/)[0]) : [stringValue];
492
+ const isRemote = urls.every((url) => url.startsWith("http://") || url.startsWith("https://") || url.startsWith("data:"));
493
+ if (isRemote) {
494
494
  return;
495
495
  }
496
496
  context.report({
@@ -750,11 +750,15 @@ var init_staticfile_no_relative = __esm(() => {
750
750
  return;
751
751
  }
752
752
  const firstArg = args[0];
753
+ let value = null;
753
754
  if (firstArg.type === "Literal") {
754
- const value = firstArg.value;
755
- if (typeof value !== "string") {
756
- return;
755
+ if (typeof firstArg.value === "string") {
756
+ value = firstArg.value;
757
757
  }
758
+ } else if (firstArg.type === "TemplateLiteral") {
759
+ value = firstArg.quasis[0]?.value.cooked ?? null;
760
+ }
761
+ if (value !== null) {
758
762
  if (value.startsWith("./")) {
759
763
  context.report({
760
764
  messageId: "RelativePathStaticFile",
@@ -773,7 +777,7 @@ var init_staticfile_no_relative = __esm(() => {
773
777
  node
774
778
  });
775
779
  }
776
- if (value.startsWith("/Users") || value.startsWith("/home") || value.startsWith("/tmp") || value.startsWith("/etc") || value.startsWith("/opt") || value.startsWith("/var") || value.startsWith("C:") || value.startsWith("D:") || value.startsWith("E:")) {
780
+ if (value.startsWith("/Users") || value.startsWith("/home") || value.startsWith("/tmp") || value.startsWith("/etc") || value.startsWith("/opt") || value.startsWith("/var") || /^[a-zA-Z]:[\\/]/.test(value) || value.startsWith("\\\\")) {
777
781
  context.report({
778
782
  messageId: "AbsoluteStaticFile",
779
783
  node
@@ -827,11 +831,15 @@ var init_staticfile_no_remote = __esm(() => {
827
831
  return;
828
832
  }
829
833
  const firstArg = args[0];
834
+ let value = null;
830
835
  if (firstArg.type === "Literal") {
831
- const value = firstArg.value;
832
- if (typeof value !== "string") {
833
- return;
836
+ if (typeof firstArg.value === "string") {
837
+ value = firstArg.value;
834
838
  }
839
+ } else if (firstArg.type === "TemplateLiteral") {
840
+ value = firstArg.quasis[0]?.value.cooked ?? null;
841
+ }
842
+ if (value !== null) {
835
843
  if (value.startsWith("http://")) {
836
844
  context.report({
837
845
  messageId: "RelativePathStaticFile",
package/package.json CHANGED
@@ -3,11 +3,11 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/eslint-plugin"
4
4
  },
5
5
  "name": "@remotion/eslint-plugin",
6
- "version": "4.0.541",
6
+ "version": "4.0.543",
7
7
  "description": "Rules for writing Remotion code",
8
8
  "scripts": {
9
9
  "test": "node src/tests/execute.mjs",
10
- "make": "node ../../node_modules/typescript/bin/tsc -d && bun --env-file=../.env.bundle bundle.ts"
10
+ "make": "node ../.monorepo/tsrs.cjs -d && bun --env-file=../.env.bundle bundle.ts"
11
11
  },
12
12
  "main": "dist/index.js",
13
13
  "bugs": {