@remotion/eslint-plugin 3.1.8 → 3.2.0
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 +6 -0
- package/dist/index.js +11 -2
- package/dist/rules/staticfile-no-relative.d.ts +2 -0
- package/dist/rules/staticfile-no-relative.js +64 -0
- package/dist/rules/staticfile-no-remote.d.ts +2 -0
- package/dist/rules/staticfile-no-remote.js +64 -0
- package/dist/rules/use-gif-component.d.ts +2 -0
- package/dist/rules/use-gif-component.js +96 -0
- package/package.json +2 -2
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
|
|
10
|
-
const
|
|
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
|
},
|
|
@@ -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,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,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
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/eslint-plugin",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "A set of rules helping you avoid common pitfalls in Remotion.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -d",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"typescript": "^4.7.0"
|
|
24
24
|
},
|
|
25
25
|
"private": false,
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "47b188161a9e922a247eaa998e72d37af9137707"
|
|
27
27
|
}
|