@remotion/eslint-plugin 4.0.484 → 4.0.486
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 +97 -7
- package/dist/esm/index.mjs +100 -10
- package/dist/index.d.ts +4 -0
- package/dist/rules/valid-composition-and-folder-name.d.ts +3 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -935,13 +935,101 @@ var rule = createRule13({
|
|
|
935
935
|
});
|
|
936
936
|
var v4_import_default = rule;
|
|
937
937
|
|
|
938
|
-
// src/rules/
|
|
938
|
+
// src/rules/valid-composition-and-folder-name.ts
|
|
939
939
|
var import_utils14 = require("@typescript-eslint/utils");
|
|
940
940
|
var createRule14 = import_utils14.ESLintUtils.RuleCreator(() => {
|
|
941
941
|
return `https://github.com/remotion-dev/remotion`;
|
|
942
942
|
});
|
|
943
|
+
var validNameRegex = /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/;
|
|
944
|
+
var InvalidCompositionId = "Composition IDs can only contain a-z, A-Z, 0-9, CJK characters and -.";
|
|
945
|
+
var InvalidFolderName = "Folder names can only contain a-z, A-Z, 0-9, CJK characters and -.";
|
|
946
|
+
var getStringValue = (value) => {
|
|
947
|
+
if (!value) {
|
|
948
|
+
return null;
|
|
949
|
+
}
|
|
950
|
+
if (value.type === "Literal") {
|
|
951
|
+
return typeof value.value === "string" ? value.value : null;
|
|
952
|
+
}
|
|
953
|
+
if (value.type !== "JSXExpressionContainer") {
|
|
954
|
+
return null;
|
|
955
|
+
}
|
|
956
|
+
const { expression } = value;
|
|
957
|
+
if (expression.type === "Literal") {
|
|
958
|
+
return typeof expression.value === "string" ? expression.value : null;
|
|
959
|
+
}
|
|
960
|
+
if (expression.type === "TemplateLiteral" && expression.expressions.length === 0) {
|
|
961
|
+
return expression.quasis[0].value.cooked;
|
|
962
|
+
}
|
|
963
|
+
return null;
|
|
964
|
+
};
|
|
965
|
+
var getJsxElementName = (node) => {
|
|
966
|
+
if (node.type !== "JSXIdentifier") {
|
|
967
|
+
return null;
|
|
968
|
+
}
|
|
969
|
+
return node.name;
|
|
970
|
+
};
|
|
971
|
+
var valid_composition_and_folder_name_default = createRule14({
|
|
972
|
+
name: "valid-composition-and-folder-name",
|
|
973
|
+
meta: {
|
|
974
|
+
type: "problem",
|
|
975
|
+
docs: {
|
|
976
|
+
description: "Warns about invalid Remotion composition IDs and folder names.",
|
|
977
|
+
recommended: "warn"
|
|
978
|
+
},
|
|
979
|
+
fixable: undefined,
|
|
980
|
+
schema: [],
|
|
981
|
+
messages: {
|
|
982
|
+
InvalidCompositionId,
|
|
983
|
+
InvalidFolderName
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
defaultOptions: [],
|
|
987
|
+
create: (context) => {
|
|
988
|
+
return {
|
|
989
|
+
JSXAttribute: (node) => {
|
|
990
|
+
if (node.type !== "JSXAttribute") {
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
if (node.name.type !== "JSXIdentifier") {
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
const parent = node.parent;
|
|
997
|
+
if (!parent || parent.type !== "JSXOpeningElement") {
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
const elementName = getJsxElementName(parent.name);
|
|
1001
|
+
if (elementName === null) {
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
const propName = node.name.name;
|
|
1005
|
+
const value = getStringValue(node.value);
|
|
1006
|
+
if (value === null || validNameRegex.test(value)) {
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
if ((elementName === "Composition" || elementName === "Still") && propName === "id") {
|
|
1010
|
+
context.report({
|
|
1011
|
+
messageId: "InvalidCompositionId",
|
|
1012
|
+
node
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
if (elementName === "Folder" && propName === "name") {
|
|
1016
|
+
context.report({
|
|
1017
|
+
messageId: "InvalidFolderName",
|
|
1018
|
+
node
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
// src/rules/volume-callback.ts
|
|
1027
|
+
var import_utils15 = require("@typescript-eslint/utils");
|
|
1028
|
+
var createRule15 = import_utils15.ESLintUtils.RuleCreator(() => {
|
|
1029
|
+
return `https://github.com/remotion-dev/remotion`;
|
|
1030
|
+
});
|
|
943
1031
|
var VolumeCallback = "Prefer a callback function for setting the volume: `volume={(f) => interpolate(...)}`. See https://www.remotion.dev/docs/audio/volume";
|
|
944
|
-
var volume_callback_default =
|
|
1032
|
+
var volume_callback_default = createRule15({
|
|
945
1033
|
name: "volume-callback",
|
|
946
1034
|
meta: {
|
|
947
1035
|
type: "problem",
|
|
@@ -1009,15 +1097,15 @@ var volume_callback_default = createRule14({
|
|
|
1009
1097
|
});
|
|
1010
1098
|
|
|
1011
1099
|
// src/rules/warn-native-media-tag.ts
|
|
1012
|
-
var
|
|
1013
|
-
var
|
|
1100
|
+
var import_utils16 = require("@typescript-eslint/utils");
|
|
1101
|
+
var createRule16 = import_utils16.ESLintUtils.RuleCreator(() => {
|
|
1014
1102
|
return `https://github.com/remotion-dev/remotion`;
|
|
1015
1103
|
});
|
|
1016
1104
|
var NoNativeImgTag = "Prefer the <Img /> tag from 'remotion' package, because it will wait until the image is loaded when you are rendering your video.";
|
|
1017
1105
|
var NoNativeIFrameTag = "Prefer the <IFrame /> tag from 'remotion' package, because it will wait until the iframe is loaded when you are rendering your video.";
|
|
1018
1106
|
var NoNativeAudioTag = "Use the <Audio /> tag from '@remotion/media' package, because it will synchronize with the Remotion timeline.";
|
|
1019
1107
|
var NoNativeVideoTag = "Use the <Video /> tag from '@remotion/media' package, because it will synchronize with the Remotion timeline.";
|
|
1020
|
-
var warn_native_media_tag_default =
|
|
1108
|
+
var warn_native_media_tag_default = createRule16({
|
|
1021
1109
|
name: "warn-native-media-tag",
|
|
1022
1110
|
meta: {
|
|
1023
1111
|
type: "problem",
|
|
@@ -1121,7 +1209,8 @@ var rules = {
|
|
|
1121
1209
|
"non-pure-animation": non_pure_animation_default,
|
|
1122
1210
|
"slow-css-property": slow_css_property_default,
|
|
1123
1211
|
"v4-config-import": v4_import_default,
|
|
1124
|
-
"no-object-fit-on-media-video": no_object_fit_on_media_video_default
|
|
1212
|
+
"no-object-fit-on-media-video": no_object_fit_on_media_video_default,
|
|
1213
|
+
"valid-composition-and-folder-name": valid_composition_and_folder_name_default
|
|
1125
1214
|
};
|
|
1126
1215
|
var recommendedRuleConfig = {
|
|
1127
1216
|
"@remotion/warn-native-media-tag": "error",
|
|
@@ -1137,7 +1226,8 @@ var recommendedRuleConfig = {
|
|
|
1137
1226
|
"@remotion/no-background-image": "error",
|
|
1138
1227
|
"@remotion/non-pure-animation": "warn",
|
|
1139
1228
|
"@remotion/v4-config-import": "error",
|
|
1140
|
-
"@remotion/no-object-fit-on-media-video": "warn"
|
|
1229
|
+
"@remotion/no-object-fit-on-media-video": "warn",
|
|
1230
|
+
"@remotion/valid-composition-and-folder-name": "error"
|
|
1141
1231
|
};
|
|
1142
1232
|
var configs = {
|
|
1143
1233
|
recommended: {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -973,14 +973,101 @@ var init_v4_import = __esm(() => {
|
|
|
973
973
|
v4_import_default = rule;
|
|
974
974
|
});
|
|
975
975
|
|
|
976
|
-
// src/rules/
|
|
976
|
+
// src/rules/valid-composition-and-folder-name.ts
|
|
977
977
|
import { ESLintUtils as ESLintUtils14 } from "@typescript-eslint/utils";
|
|
978
|
-
var createRule14,
|
|
979
|
-
|
|
978
|
+
var createRule14, validNameRegex, InvalidCompositionId = "Composition IDs can only contain a-z, A-Z, 0-9, CJK characters and -.", InvalidFolderName = "Folder names can only contain a-z, A-Z, 0-9, CJK characters and -.", getStringValue = (value) => {
|
|
979
|
+
if (!value) {
|
|
980
|
+
return null;
|
|
981
|
+
}
|
|
982
|
+
if (value.type === "Literal") {
|
|
983
|
+
return typeof value.value === "string" ? value.value : null;
|
|
984
|
+
}
|
|
985
|
+
if (value.type !== "JSXExpressionContainer") {
|
|
986
|
+
return null;
|
|
987
|
+
}
|
|
988
|
+
const { expression } = value;
|
|
989
|
+
if (expression.type === "Literal") {
|
|
990
|
+
return typeof expression.value === "string" ? expression.value : null;
|
|
991
|
+
}
|
|
992
|
+
if (expression.type === "TemplateLiteral" && expression.expressions.length === 0) {
|
|
993
|
+
return expression.quasis[0].value.cooked;
|
|
994
|
+
}
|
|
995
|
+
return null;
|
|
996
|
+
}, getJsxElementName = (node) => {
|
|
997
|
+
if (node.type !== "JSXIdentifier") {
|
|
998
|
+
return null;
|
|
999
|
+
}
|
|
1000
|
+
return node.name;
|
|
1001
|
+
}, valid_composition_and_folder_name_default;
|
|
1002
|
+
var init_valid_composition_and_folder_name = __esm(() => {
|
|
980
1003
|
createRule14 = ESLintUtils14.RuleCreator(() => {
|
|
981
1004
|
return `https://github.com/remotion-dev/remotion`;
|
|
982
1005
|
});
|
|
983
|
-
|
|
1006
|
+
validNameRegex = /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/;
|
|
1007
|
+
valid_composition_and_folder_name_default = createRule14({
|
|
1008
|
+
name: "valid-composition-and-folder-name",
|
|
1009
|
+
meta: {
|
|
1010
|
+
type: "problem",
|
|
1011
|
+
docs: {
|
|
1012
|
+
description: "Warns about invalid Remotion composition IDs and folder names.",
|
|
1013
|
+
recommended: "warn"
|
|
1014
|
+
},
|
|
1015
|
+
fixable: undefined,
|
|
1016
|
+
schema: [],
|
|
1017
|
+
messages: {
|
|
1018
|
+
InvalidCompositionId,
|
|
1019
|
+
InvalidFolderName
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1022
|
+
defaultOptions: [],
|
|
1023
|
+
create: (context) => {
|
|
1024
|
+
return {
|
|
1025
|
+
JSXAttribute: (node) => {
|
|
1026
|
+
if (node.type !== "JSXAttribute") {
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
if (node.name.type !== "JSXIdentifier") {
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
const parent = node.parent;
|
|
1033
|
+
if (!parent || parent.type !== "JSXOpeningElement") {
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
const elementName = getJsxElementName(parent.name);
|
|
1037
|
+
if (elementName === null) {
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
const propName = node.name.name;
|
|
1041
|
+
const value = getStringValue(node.value);
|
|
1042
|
+
if (value === null || validNameRegex.test(value)) {
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
if ((elementName === "Composition" || elementName === "Still") && propName === "id") {
|
|
1046
|
+
context.report({
|
|
1047
|
+
messageId: "InvalidCompositionId",
|
|
1048
|
+
node
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
if (elementName === "Folder" && propName === "name") {
|
|
1052
|
+
context.report({
|
|
1053
|
+
messageId: "InvalidFolderName",
|
|
1054
|
+
node
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
// src/rules/volume-callback.ts
|
|
1064
|
+
import { ESLintUtils as ESLintUtils15 } from "@typescript-eslint/utils";
|
|
1065
|
+
var createRule15, VolumeCallback = "Prefer a callback function for setting the volume: `volume={(f) => interpolate(...)}`. See https://www.remotion.dev/docs/audio/volume", volume_callback_default;
|
|
1066
|
+
var init_volume_callback = __esm(() => {
|
|
1067
|
+
createRule15 = ESLintUtils15.RuleCreator(() => {
|
|
1068
|
+
return `https://github.com/remotion-dev/remotion`;
|
|
1069
|
+
});
|
|
1070
|
+
volume_callback_default = createRule15({
|
|
984
1071
|
name: "volume-callback",
|
|
985
1072
|
meta: {
|
|
986
1073
|
type: "problem",
|
|
@@ -1049,13 +1136,13 @@ var init_volume_callback = __esm(() => {
|
|
|
1049
1136
|
});
|
|
1050
1137
|
|
|
1051
1138
|
// src/rules/warn-native-media-tag.ts
|
|
1052
|
-
import { ESLintUtils as
|
|
1053
|
-
var
|
|
1139
|
+
import { ESLintUtils as ESLintUtils16 } from "@typescript-eslint/utils";
|
|
1140
|
+
var createRule16, NoNativeImgTag = "Prefer the <Img /> tag from 'remotion' package, because it will wait until the image is loaded when you are rendering your video.", NoNativeIFrameTag = "Prefer the <IFrame /> tag from 'remotion' package, because it will wait until the iframe is loaded when you are rendering your video.", NoNativeAudioTag = "Use the <Audio /> tag from '@remotion/media' package, because it will synchronize with the Remotion timeline.", NoNativeVideoTag = "Use the <Video /> tag from '@remotion/media' package, because it will synchronize with the Remotion timeline.", warn_native_media_tag_default;
|
|
1054
1141
|
var init_warn_native_media_tag = __esm(() => {
|
|
1055
|
-
|
|
1142
|
+
createRule16 = ESLintUtils16.RuleCreator(() => {
|
|
1056
1143
|
return `https://github.com/remotion-dev/remotion`;
|
|
1057
1144
|
});
|
|
1058
|
-
warn_native_media_tag_default =
|
|
1145
|
+
warn_native_media_tag_default = createRule16({
|
|
1059
1146
|
name: "warn-native-media-tag",
|
|
1060
1147
|
meta: {
|
|
1061
1148
|
type: "problem",
|
|
@@ -1159,6 +1246,7 @@ var require_src = __commonJS((exports, module) => {
|
|
|
1159
1246
|
init_staticfile_no_remote();
|
|
1160
1247
|
init_use_gif_component();
|
|
1161
1248
|
init_v4_import();
|
|
1249
|
+
init_valid_composition_and_folder_name();
|
|
1162
1250
|
init_volume_callback();
|
|
1163
1251
|
init_warn_native_media_tag();
|
|
1164
1252
|
var rules = {
|
|
@@ -1176,7 +1264,8 @@ var require_src = __commonJS((exports, module) => {
|
|
|
1176
1264
|
"non-pure-animation": non_pure_animation_default,
|
|
1177
1265
|
"slow-css-property": slow_css_property_default,
|
|
1178
1266
|
"v4-config-import": v4_import_default,
|
|
1179
|
-
"no-object-fit-on-media-video": no_object_fit_on_media_video_default
|
|
1267
|
+
"no-object-fit-on-media-video": no_object_fit_on_media_video_default,
|
|
1268
|
+
"valid-composition-and-folder-name": valid_composition_and_folder_name_default
|
|
1180
1269
|
};
|
|
1181
1270
|
var recommendedRuleConfig = {
|
|
1182
1271
|
"@remotion/warn-native-media-tag": "error",
|
|
@@ -1192,7 +1281,8 @@ var require_src = __commonJS((exports, module) => {
|
|
|
1192
1281
|
"@remotion/no-background-image": "error",
|
|
1193
1282
|
"@remotion/non-pure-animation": "warn",
|
|
1194
1283
|
"@remotion/v4-config-import": "error",
|
|
1195
|
-
"@remotion/no-object-fit-on-media-video": "warn"
|
|
1284
|
+
"@remotion/no-object-fit-on-media-video": "warn",
|
|
1285
|
+
"@remotion/valid-composition-and-folder-name": "error"
|
|
1196
1286
|
};
|
|
1197
1287
|
var configs = {
|
|
1198
1288
|
recommended: {
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
readonly '@remotion/non-pure-animation': "warn";
|
|
17
17
|
readonly '@remotion/v4-config-import': "error";
|
|
18
18
|
readonly '@remotion/no-object-fit-on-media-video': "warn";
|
|
19
|
+
readonly '@remotion/valid-composition-and-folder-name': "error";
|
|
19
20
|
};
|
|
20
21
|
readonly plugins: readonly ["@remotion"];
|
|
21
22
|
};
|
|
@@ -36,6 +37,7 @@ declare const _default: {
|
|
|
36
37
|
'slow-css-property': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"SlowCssProperty", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
37
38
|
'v4-config-import': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"ImportConfig", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
38
39
|
'no-object-fit-on-media-video': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoObjectFitInClassName" | "NoObjectFitInStyle", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
40
|
+
'valid-composition-and-folder-name': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"InvalidCompositionId" | "InvalidFolderName", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
39
41
|
};
|
|
40
42
|
flatPlugin: {
|
|
41
43
|
rules: {
|
|
@@ -53,6 +55,7 @@ declare const _default: {
|
|
|
53
55
|
readonly '@remotion/non-pure-animation': "warn";
|
|
54
56
|
readonly '@remotion/v4-config-import': "error";
|
|
55
57
|
readonly '@remotion/no-object-fit-on-media-video': "warn";
|
|
58
|
+
readonly '@remotion/valid-composition-and-folder-name': "error";
|
|
56
59
|
};
|
|
57
60
|
plugins: {
|
|
58
61
|
'@remotion': {
|
|
@@ -72,6 +75,7 @@ declare const _default: {
|
|
|
72
75
|
'slow-css-property': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"SlowCssProperty", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
73
76
|
'v4-config-import': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"ImportConfig", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
74
77
|
'no-object-fit-on-media-video': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoObjectFitInClassName" | "NoObjectFitInStyle", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
78
|
+
'valid-composition-and-folder-name': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"InvalidCompositionId" | "InvalidFolderName", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
75
79
|
};
|
|
76
80
|
};
|
|
77
81
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.
|
|
6
|
+
"version": "4.0.486",
|
|
7
7
|
"description": "Rules for writing Remotion code",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"test": "node src/tests/execute.mjs",
|