@remotion/eslint-plugin 4.0.0-oops.3 → 4.0.0-prefetch.7

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
@@ -7,6 +7,9 @@ declare const _default: {
7
7
  "even-dimensions": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"EvenDimensions", [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
8
8
  "duration-in-frames": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"DurationInFrames", [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
9
9
  "volume-callback": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"VolumeCallback", [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
10
+ "use-gif-component": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"UseGifComponent", [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
11
+ "staticfile-no-relative": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"RelativePathStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
12
+ "staticfile-no-remote": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"RelativePathStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
10
13
  };
11
14
  configs: {
12
15
  recommended: {
@@ -18,6 +21,9 @@ declare const _default: {
18
21
  "@remotion/even-dimensions": string;
19
22
  "@remotion/duration-in-frames": string;
20
23
  "@remotion/volume-callback": string;
24
+ "@remotion/use-gif-component": string;
25
+ "@remotion/staticfile-no-relative": string;
26
+ "@remotion/staticfile-no-remote": string;
21
27
  };
22
28
  };
23
29
  };
package/dist/index.js CHANGED
@@ -4,11 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  const deterministic_randomness_1 = __importDefault(require("./rules/deterministic-randomness"));
6
6
  const even_dimensions_1 = __importDefault(require("./rules/even-dimensions"));
7
+ const no_duration_frames_infinity_1 = __importDefault(require("./rules/no-duration-frames-infinity"));
7
8
  const no_mp4_import_1 = __importDefault(require("./rules/no-mp4-import"));
8
9
  const no_string_assets_1 = __importDefault(require("./rules/no-string-assets"));
9
- const warn_native_media_tag_1 = __importDefault(require("./rules/warn-native-media-tag"));
10
- const no_duration_frames_infinity_1 = __importDefault(require("./rules/no-duration-frames-infinity"));
10
+ const staticfile_no_relative_1 = __importDefault(require("./rules/staticfile-no-relative"));
11
+ const staticfile_no_remote_1 = __importDefault(require("./rules/staticfile-no-remote"));
12
+ const use_gif_component_1 = __importDefault(require("./rules/use-gif-component"));
11
13
  const volume_callback_1 = __importDefault(require("./rules/volume-callback"));
14
+ const warn_native_media_tag_1 = __importDefault(require("./rules/warn-native-media-tag"));
12
15
  const rules = {
13
16
  "no-mp4-import": no_mp4_import_1.default,
14
17
  "warn-native-media-tag": warn_native_media_tag_1.default,
@@ -17,6 +20,9 @@ const rules = {
17
20
  "even-dimensions": even_dimensions_1.default,
18
21
  "duration-in-frames": no_duration_frames_infinity_1.default,
19
22
  "volume-callback": volume_callback_1.default,
23
+ "use-gif-component": use_gif_component_1.default,
24
+ "staticfile-no-relative": staticfile_no_relative_1.default,
25
+ "staticfile-no-remote": staticfile_no_remote_1.default,
20
26
  };
21
27
  module.exports = {
22
28
  rules,
@@ -30,6 +36,9 @@ module.exports = {
30
36
  "@remotion/even-dimensions": "error",
31
37
  "@remotion/duration-in-frames": "error",
32
38
  "@remotion/volume-callback": "error",
39
+ "@remotion/use-gif-component": "error",
40
+ "@remotion/staticfile-no-relative": "error",
41
+ "@remotion/staticfile-no-remote": "error",
33
42
  },
34
43
  },
35
44
  },
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("@typescript-eslint/utils");
4
- const createRule = utils_1.ESLintUtils.RuleCreator((name) => {
4
+ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
5
5
  return `https://github.com/remotion-dev/remotion`;
6
6
  });
7
7
  const DeterministicRandomness = [
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("@typescript-eslint/utils");
4
- const createRule = utils_1.ESLintUtils.RuleCreator((name) => {
4
+ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
5
5
  return `https://github.com/remotion-dev/remotion`;
6
6
  });
7
7
  const EvenDimensions = "Videos rendered in H264/H265 codec do not support dimensions that are not divisible by 2. Make the number even to resolve this warning. Ignore this warning if you don't plan on rendering this video with a H264 or H265 codec.";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("@typescript-eslint/utils");
4
- const createRule = utils_1.ESLintUtils.RuleCreator((name) => {
4
+ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
5
5
  return `https://github.com/remotion-dev/remotion`;
6
6
  });
7
7
  const DurationInFrames = "Infinity is now the default, so you can remove the prop.";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("@typescript-eslint/utils");
4
- const createRule = utils_1.ESLintUtils.RuleCreator((name) => {
4
+ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
5
5
  return `https://github.com/remotion-dev/remotion`;
6
6
  });
7
7
  const NoMP4Import = "Importing MP4 will work while you are previewing the video, but will not work while rendering since Puppeteer does not include the codecs necessary for MP4 videos. Convert the video to WebM first.";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("@typescript-eslint/utils");
4
- const createRule = utils_1.ESLintUtils.RuleCreator((name) => {
4
+ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
5
5
  return `https://github.com/remotion-dev/remotion`;
6
6
  });
7
7
  const NoStringAssets = [
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"RelativePathStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
2
+ export default _default;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@typescript-eslint/utils");
4
+ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
5
+ return `https://remotion.dev/docs/staticfile-relative-paths`;
6
+ });
7
+ const RelativePathStaticFile = [
8
+ "Don't pass a relative path to staticFile().",
9
+ "See: https://remotion.dev/docs/staticfile-relative-paths",
10
+ ].join("\n");
11
+ exports.default = createRule({
12
+ name: "staticfile-no-relative",
13
+ meta: {
14
+ type: "problem",
15
+ docs: {
16
+ description: RelativePathStaticFile,
17
+ recommended: "warn",
18
+ },
19
+ fixable: undefined,
20
+ schema: [],
21
+ messages: {
22
+ RelativePathStaticFile: RelativePathStaticFile,
23
+ },
24
+ },
25
+ defaultOptions: [],
26
+ create: (context) => {
27
+ return {
28
+ CallExpression: (node) => {
29
+ const value = node;
30
+ // src={"some string"}
31
+ if (!value) {
32
+ return;
33
+ }
34
+ if (node.type === "CallExpression" &&
35
+ node.callee.type === "Identifier" &&
36
+ node.callee.name === "staticFile") {
37
+ const args = node.arguments;
38
+ if (args.length === 0) {
39
+ return;
40
+ }
41
+ const firstArg = args[0];
42
+ if (firstArg.type === "Literal") {
43
+ const value = firstArg.value;
44
+ if (typeof value !== "string") {
45
+ return;
46
+ }
47
+ if (value.startsWith("./")) {
48
+ context.report({
49
+ messageId: "RelativePathStaticFile",
50
+ node,
51
+ });
52
+ }
53
+ if (value.startsWith("../")) {
54
+ context.report({
55
+ messageId: "RelativePathStaticFile",
56
+ node,
57
+ });
58
+ }
59
+ }
60
+ }
61
+ },
62
+ };
63
+ },
64
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"RelativePathStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
2
+ export default _default;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@typescript-eslint/utils");
4
+ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
5
+ return `https://remotion.dev/docs/staticfile-remote-urls`;
6
+ });
7
+ const RelativePathStaticFile = [
8
+ "Don't pass a remote URL to staticFile().",
9
+ "See: https://remotion.dev/docs/staticfile-remote-urls",
10
+ ].join("\n");
11
+ exports.default = createRule({
12
+ name: "staticfile-no-remote",
13
+ meta: {
14
+ type: "problem",
15
+ docs: {
16
+ description: RelativePathStaticFile,
17
+ recommended: "warn",
18
+ },
19
+ fixable: undefined,
20
+ schema: [],
21
+ messages: {
22
+ RelativePathStaticFile: RelativePathStaticFile,
23
+ },
24
+ },
25
+ defaultOptions: [],
26
+ create: (context) => {
27
+ return {
28
+ CallExpression: (node) => {
29
+ const value = node;
30
+ // src={"some string"}
31
+ if (!value) {
32
+ return;
33
+ }
34
+ if (node.type === "CallExpression" &&
35
+ node.callee.type === "Identifier" &&
36
+ node.callee.name === "staticFile") {
37
+ const args = node.arguments;
38
+ if (args.length === 0) {
39
+ return;
40
+ }
41
+ const firstArg = args[0];
42
+ if (firstArg.type === "Literal") {
43
+ const value = firstArg.value;
44
+ if (typeof value !== "string") {
45
+ return;
46
+ }
47
+ if (value.startsWith("http://")) {
48
+ context.report({
49
+ messageId: "RelativePathStaticFile",
50
+ node,
51
+ });
52
+ }
53
+ if (value.startsWith("https://")) {
54
+ context.report({
55
+ messageId: "RelativePathStaticFile",
56
+ node,
57
+ });
58
+ }
59
+ }
60
+ }
61
+ },
62
+ };
63
+ },
64
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"UseGifComponent", [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
2
+ export default _default;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@typescript-eslint/utils");
4
+ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
5
+ return `https://github.com/remotion-dev/remotion`;
6
+ });
7
+ const UseGifComponent = [
8
+ "Use the <Gif> component for animated GIFs instead.",
9
+ ].join("\n");
10
+ exports.default = createRule({
11
+ name: "use-gif-component",
12
+ meta: {
13
+ type: "problem",
14
+ docs: {
15
+ description: UseGifComponent,
16
+ recommended: "warn",
17
+ },
18
+ fixable: undefined,
19
+ schema: [],
20
+ messages: {
21
+ UseGifComponent: UseGifComponent,
22
+ },
23
+ },
24
+ defaultOptions: [],
25
+ create: (context) => {
26
+ return {
27
+ JSXAttribute: (node) => {
28
+ if (node.type !== "JSXAttribute") {
29
+ return;
30
+ }
31
+ if (node.name.name !== "src") {
32
+ return;
33
+ }
34
+ const value = node.value;
35
+ // src={"some string"}
36
+ if (!value) {
37
+ return;
38
+ }
39
+ const stringValue = value &&
40
+ value.type === "JSXExpressionContainer" &&
41
+ value.expression.type === "Literal"
42
+ ? value.expression.value
43
+ : value.type === "Literal"
44
+ ? value.value
45
+ : null;
46
+ // src="image.gif"
47
+ if (typeof stringValue === "string") {
48
+ const parent = node.parent;
49
+ if (!parent) {
50
+ return;
51
+ }
52
+ if (parent.type !== "JSXOpeningElement") {
53
+ return;
54
+ }
55
+ const name = parent.name;
56
+ if (name.type !== "JSXIdentifier") {
57
+ return;
58
+ }
59
+ if (name.name === "Img" || name.name === "img") {
60
+ // Network and inline URLs are okay
61
+ if (stringValue.includes(".gif")) {
62
+ context.report({
63
+ messageId: "UseGifComponent",
64
+ node,
65
+ });
66
+ }
67
+ }
68
+ }
69
+ if (value.type === "JSXExpressionContainer" &&
70
+ value.expression.type === "CallExpression" &&
71
+ value.expression.callee.type === "Identifier" &&
72
+ value.expression.callee.name === "staticFile") {
73
+ const args = value.expression.arguments;
74
+ if (args.length === 0) {
75
+ return;
76
+ }
77
+ const firstArg = args[0];
78
+ if (firstArg.type === "Literal") {
79
+ const value = firstArg.value;
80
+ if (typeof value !== "string") {
81
+ return;
82
+ }
83
+ if (value.includes(".gif")) {
84
+ context.report({
85
+ messageId: "UseGifComponent",
86
+ node,
87
+ });
88
+ }
89
+ }
90
+ }
91
+ },
92
+ };
93
+ },
94
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"UseGifComponent", [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
2
+ export default _default;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@typescript-eslint/utils");
4
+ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
5
+ return `https://github.com/remotion-dev/remotion`;
6
+ });
7
+ const UseGifComponent = [
8
+ "Use the <Gif> component animated GIFs.",
9
+ "See: https://www.remotion.dev/docs/gif.",
10
+ "Ignore this message if this is a non-animated GIF.",
11
+ ].join("\n");
12
+ exports.default = createRule({
13
+ name: "use-gif-component",
14
+ meta: {
15
+ type: "problem",
16
+ docs: {
17
+ description: UseGifComponent,
18
+ recommended: "warn",
19
+ },
20
+ fixable: undefined,
21
+ schema: [],
22
+ messages: {
23
+ UseGifComponent: UseGifComponent,
24
+ },
25
+ },
26
+ defaultOptions: [],
27
+ create: (context) => {
28
+ return {
29
+ JSXAttribute: (node) => {
30
+ if (node.type !== "JSXAttribute") {
31
+ return;
32
+ }
33
+ if (node.name.name !== "src") {
34
+ return;
35
+ }
36
+ const value = node.value;
37
+ // src={"some string"}
38
+ if (!value) {
39
+ return;
40
+ }
41
+ const stringValue = value &&
42
+ value.type === "JSXExpressionContainer" &&
43
+ value.expression.type === "Literal"
44
+ ? value.expression.value
45
+ : value.type === "Literal"
46
+ ? value.value
47
+ : null;
48
+ // src="image.gif"
49
+ if (typeof stringValue === "string") {
50
+ const parent = node.parent;
51
+ if (!parent) {
52
+ return;
53
+ }
54
+ if (parent.type !== "JSXOpeningElement") {
55
+ return;
56
+ }
57
+ const name = parent.name;
58
+ if (name.type !== "JSXIdentifier") {
59
+ return;
60
+ }
61
+ if (name.name === "Img" || name.name === "img") {
62
+ // Network and inline URLs are okay
63
+ if (stringValue.includes(".gif")) {
64
+ context.report({
65
+ messageId: "UseGifComponent",
66
+ node,
67
+ });
68
+ }
69
+ }
70
+ }
71
+ if (value.type === "JSXExpressionContainer" &&
72
+ value.expression.type === "CallExpression" &&
73
+ value.expression.callee.type === "Identifier" &&
74
+ value.expression.callee.name === "staticFile") {
75
+ const args = value.expression.arguments;
76
+ if (args.length === 0) {
77
+ return;
78
+ }
79
+ const firstArg = args[0];
80
+ if (firstArg.type === "Literal") {
81
+ const value = firstArg.value;
82
+ if (typeof value !== "string") {
83
+ return;
84
+ }
85
+ if (value.includes(".gif")) {
86
+ context.report({
87
+ messageId: "UseGifComponent",
88
+ node,
89
+ });
90
+ }
91
+ }
92
+ }
93
+ },
94
+ };
95
+ },
96
+ });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("@typescript-eslint/utils");
4
- const createRule = utils_1.ESLintUtils.RuleCreator((name) => {
4
+ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
5
5
  return `https://github.com/remotion-dev/remotion`;
6
6
  });
7
7
  const VolumeCallback = "Prefer a callback function for setting the volume: `volume={(f) => interpolate(...)}`. See https://www.remotion.dev/docs/using-audio/#controlling-volume";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("@typescript-eslint/utils");
4
- const createRule = utils_1.ESLintUtils.RuleCreator((name) => {
4
+ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
5
5
  return `https://github.com/remotion-dev/remotion`;
6
6
  });
7
7
  const NoNativeImgTag = "Prefer the <Img /> tag from 'remotion' package, because it will wait until the image is loaded when you are rendering your video.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/eslint-plugin",
3
- "version": "4.0.0-oops.3+31c506229",
3
+ "version": "4.0.0-prefetch.7+47cce0679",
4
4
  "description": "A set of rules helping you avoid common pitfalls in Remotion.",
5
5
  "scripts": {
6
6
  "build": "tsc -d",
@@ -20,8 +20,8 @@
20
20
  "eslint": "8.13.0",
21
21
  "jest": "^27.2.4",
22
22
  "ts-jest": "^27.0.5",
23
- "typescript": "^4.5.5"
23
+ "typescript": "^4.7.0"
24
24
  },
25
25
  "private": false,
26
- "gitHead": "31c506229ccf43f67dee263b0edce90ebbb2e22e"
26
+ "gitHead": "47cce06799563fb244ff25b211ea4055389bd7de"
27
27
  }