@remotion/eslint-plugin 4.0.213 → 4.0.215
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 +26 -26
- package/dist/index.js +27 -27
- package/dist/rules/deterministic-randomness.d.ts +1 -1
- package/dist/rules/deterministic-randomness.js +14 -14
- package/dist/rules/even-dimensions.d.ts +1 -1
- package/dist/rules/even-dimensions.js +12 -12
- package/dist/rules/no-background-image.d.ts +1 -1
- package/dist/rules/no-background-image.js +15 -15
- package/dist/rules/no-duration-frames-infinity.d.ts +1 -1
- package/dist/rules/no-duration-frames-infinity.js +15 -15
- package/dist/rules/no-from-0.d.ts +1 -1
- package/dist/rules/no-from-0.js +13 -13
- package/dist/rules/no-mp4-import.d.ts +1 -1
- package/dist/rules/no-mp4-import.js +11 -11
- package/dist/rules/no-string-assets.d.ts +1 -1
- package/dist/rules/no-string-assets.js +27 -27
- package/dist/rules/staticfile-no-relative.d.ts +2 -2
- package/dist/rules/staticfile-no-relative.js +32 -32
- package/dist/rules/staticfile-no-remote.d.ts +1 -1
- package/dist/rules/staticfile-no-remote.js +14 -14
- package/dist/rules/use-gif-component.d.ts +1 -1
- package/dist/rules/use-gif-component.js +26 -26
- package/dist/rules/v4-import.d.ts +1 -1
- package/dist/rules/v4-import.js +6 -6
- package/dist/rules/volume-callback.d.ts +1 -1
- package/dist/rules/volume-callback.js +13 -13
- package/dist/rules/warn-native-media-tag.d.ts +2 -2
- package/dist/rules/warn-native-media-tag.js +23 -23
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
rules: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
'no-mp4-import': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoMP4Import", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
4
|
+
'warn-native-media-tag': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoNativeImgTag" | "NoNativeIFrameTag" | "NoNativeAudioTag" | "NoNativeVideoTag", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
5
|
+
'deterministic-randomness': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"DeterministicRandomness", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
6
|
+
'no-string-assets': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoStringAssets", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
7
|
+
'even-dimensions': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"EvenDimensions", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
8
|
+
'duration-in-frames': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"DurationInFrames", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
9
|
+
'from-0': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"From0", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
10
|
+
'volume-callback': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"VolumeCallback", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
11
|
+
'use-gif-component': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"UseGifComponent", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
12
|
+
'staticfile-no-relative': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"RelativePathStaticFile" | "AbsoluteStaticFile" | "PublicStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
13
|
+
'staticfile-no-remote': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"RelativePathStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
14
|
+
'no-background-image': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"BackgroundImage", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
15
|
+
'v4-config-import': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"ImportConfig", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
16
16
|
};
|
|
17
17
|
configs: {
|
|
18
18
|
recommended: {
|
|
19
19
|
rules: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
'@remotion/no-mp4-import': string;
|
|
21
|
+
'@remotion/warn-native-media-tag': string;
|
|
22
|
+
'@remotion/deterministic-randomness': string;
|
|
23
|
+
'@remotion/no-string-assets': string;
|
|
24
|
+
'@remotion/even-dimensions': string;
|
|
25
|
+
'@remotion/duration-in-frames': string;
|
|
26
|
+
'@remotion/from-0': string;
|
|
27
|
+
'@remotion/volume-callback': string;
|
|
28
|
+
'@remotion/use-gif-component': string;
|
|
29
|
+
'@remotion/staticfile-no-relative': string;
|
|
30
|
+
'@remotion/staticfile-no-remote': string;
|
|
31
|
+
'@remotion/no-background-image': string;
|
|
32
|
+
'@remotion/v4-config-import': string;
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
};
|
package/dist/index.js
CHANGED
|
@@ -12,42 +12,42 @@ const no_string_assets_1 = __importDefault(require("./rules/no-string-assets"));
|
|
|
12
12
|
const staticfile_no_relative_1 = __importDefault(require("./rules/staticfile-no-relative"));
|
|
13
13
|
const staticfile_no_remote_1 = __importDefault(require("./rules/staticfile-no-remote"));
|
|
14
14
|
const use_gif_component_1 = __importDefault(require("./rules/use-gif-component"));
|
|
15
|
+
const v4_import_1 = __importDefault(require("./rules/v4-import"));
|
|
15
16
|
const volume_callback_1 = __importDefault(require("./rules/volume-callback"));
|
|
16
17
|
const warn_native_media_tag_1 = __importDefault(require("./rules/warn-native-media-tag"));
|
|
17
|
-
const v4_import_1 = __importDefault(require("./rules/v4-import"));
|
|
18
18
|
const rules = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
'no-mp4-import': no_mp4_import_1.default,
|
|
20
|
+
'warn-native-media-tag': warn_native_media_tag_1.default,
|
|
21
|
+
'deterministic-randomness': deterministic_randomness_1.default,
|
|
22
|
+
'no-string-assets': no_string_assets_1.default,
|
|
23
|
+
'even-dimensions': even_dimensions_1.default,
|
|
24
|
+
'duration-in-frames': no_duration_frames_infinity_1.default,
|
|
25
|
+
'from-0': no_from_0_1.default,
|
|
26
|
+
'volume-callback': volume_callback_1.default,
|
|
27
|
+
'use-gif-component': use_gif_component_1.default,
|
|
28
|
+
'staticfile-no-relative': staticfile_no_relative_1.default,
|
|
29
|
+
'staticfile-no-remote': staticfile_no_remote_1.default,
|
|
30
|
+
'no-background-image': no_background_image_1.default,
|
|
31
|
+
'v4-config-import': v4_import_1.default,
|
|
32
32
|
};
|
|
33
33
|
module.exports = {
|
|
34
34
|
rules,
|
|
35
35
|
configs: {
|
|
36
36
|
recommended: {
|
|
37
37
|
rules: {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
'@remotion/no-mp4-import': 'off',
|
|
39
|
+
'@remotion/warn-native-media-tag': 'error',
|
|
40
|
+
'@remotion/deterministic-randomness': 'error',
|
|
41
|
+
'@remotion/no-string-assets': 'error',
|
|
42
|
+
'@remotion/even-dimensions': 'error',
|
|
43
|
+
'@remotion/duration-in-frames': 'error',
|
|
44
|
+
'@remotion/from-0': 'error',
|
|
45
|
+
'@remotion/volume-callback': 'error',
|
|
46
|
+
'@remotion/use-gif-component': 'error',
|
|
47
|
+
'@remotion/staticfile-no-relative': 'error',
|
|
48
|
+
'@remotion/staticfile-no-remote': 'error',
|
|
49
|
+
'@remotion/no-background-image': 'error',
|
|
50
|
+
'@remotion/v4-config-import': 'error',
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
},
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"DeterministicRandomness", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
2
|
export default _default;
|
|
@@ -5,18 +5,18 @@ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
|
5
5
|
return `https://github.com/remotion-dev/remotion`;
|
|
6
6
|
});
|
|
7
7
|
const DeterministicRandomness = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
].join(
|
|
8
|
+
'The result of Math.random() will change between frames while in rendering mode.',
|
|
9
|
+
'Use the `random()` API from Remotion to get a deterministic pseudorandom value.',
|
|
10
|
+
'If you are sure you want a true random value, use `random(null)` to hide this warning.',
|
|
11
|
+
'See: https://remotion.dev/docs/using-randomness',
|
|
12
|
+
].join('\n');
|
|
13
13
|
exports.default = createRule({
|
|
14
|
-
name:
|
|
14
|
+
name: 'deterministic-randomness',
|
|
15
15
|
meta: {
|
|
16
|
-
type:
|
|
16
|
+
type: 'problem',
|
|
17
17
|
docs: {
|
|
18
18
|
description: DeterministicRandomness,
|
|
19
|
-
recommended:
|
|
19
|
+
recommended: 'warn',
|
|
20
20
|
},
|
|
21
21
|
fixable: undefined,
|
|
22
22
|
schema: [],
|
|
@@ -29,13 +29,13 @@ exports.default = createRule({
|
|
|
29
29
|
return {
|
|
30
30
|
CallExpression: (node) => {
|
|
31
31
|
const callee = node.callee;
|
|
32
|
-
if (callee.type ===
|
|
33
|
-
if (callee.object.type ===
|
|
34
|
-
callee.object.name ===
|
|
35
|
-
if (callee.property.type ===
|
|
36
|
-
callee.property.name ===
|
|
32
|
+
if (callee.type === 'MemberExpression') {
|
|
33
|
+
if (callee.object.type === 'Identifier' &&
|
|
34
|
+
callee.object.name === 'Math') {
|
|
35
|
+
if (callee.property.type === 'Identifier' &&
|
|
36
|
+
callee.property.name === 'random') {
|
|
37
37
|
context.report({
|
|
38
|
-
messageId:
|
|
38
|
+
messageId: 'DeterministicRandomness',
|
|
39
39
|
node,
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"EvenDimensions", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
2
|
export default _default;
|
|
@@ -6,12 +6,12 @@ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
|
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.";
|
|
8
8
|
exports.default = createRule({
|
|
9
|
-
name:
|
|
9
|
+
name: 'even-dimensions',
|
|
10
10
|
meta: {
|
|
11
|
-
type:
|
|
11
|
+
type: 'problem',
|
|
12
12
|
docs: {
|
|
13
13
|
description: EvenDimensions,
|
|
14
|
-
recommended:
|
|
14
|
+
recommended: 'warn',
|
|
15
15
|
},
|
|
16
16
|
fixable: undefined,
|
|
17
17
|
schema: [],
|
|
@@ -23,41 +23,41 @@ exports.default = createRule({
|
|
|
23
23
|
create: (context) => {
|
|
24
24
|
return {
|
|
25
25
|
JSXAttribute: (node) => {
|
|
26
|
-
if (node.type !==
|
|
26
|
+
if (node.type !== 'JSXAttribute') {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
if (node.name.name !==
|
|
29
|
+
if (node.name.name !== 'width' && node.name.name !== 'height') {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
const value = node.value;
|
|
33
|
-
if (!value || value.type !==
|
|
33
|
+
if (!value || value.type !== 'JSXExpressionContainer') {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
const expression = value.expression;
|
|
37
|
-
if (!expression || expression.type !==
|
|
37
|
+
if (!expression || expression.type !== 'Literal') {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
const stringValue = expression.value;
|
|
41
|
-
if (typeof stringValue !==
|
|
41
|
+
if (typeof stringValue !== 'number') {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
const parent = node.parent;
|
|
45
45
|
if (!parent) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
if (parent.type !==
|
|
48
|
+
if (parent.type !== 'JSXOpeningElement') {
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
const name = parent.name;
|
|
52
|
-
if (name.type !==
|
|
52
|
+
if (name.type !== 'JSXIdentifier') {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
if (name.name !==
|
|
55
|
+
if (name.name !== 'Composition') {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
if (stringValue % 2 !== 0) {
|
|
59
59
|
context.report({
|
|
60
|
-
messageId:
|
|
60
|
+
messageId: 'EvenDimensions',
|
|
61
61
|
node,
|
|
62
62
|
});
|
|
63
63
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"BackgroundImage", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
2
|
export default _default;
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("@typescript-eslint/utils");
|
|
4
4
|
const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
5
|
-
return
|
|
5
|
+
return 'https://remotion.dev/docs/troubleshooting/background-image';
|
|
6
6
|
});
|
|
7
7
|
const BackgroundImage = [
|
|
8
8
|
"Don't use background-image in Remotion.",
|
|
9
|
-
|
|
10
|
-
].join(
|
|
9
|
+
'See: https://remotion.dev/docs/troubleshooting/background-image',
|
|
10
|
+
].join('\n');
|
|
11
11
|
exports.default = createRule({
|
|
12
|
-
name:
|
|
12
|
+
name: 'no-background-image',
|
|
13
13
|
meta: {
|
|
14
|
-
type:
|
|
14
|
+
type: 'problem',
|
|
15
15
|
docs: {
|
|
16
16
|
description: BackgroundImage,
|
|
17
|
-
recommended:
|
|
17
|
+
recommended: 'error',
|
|
18
18
|
},
|
|
19
19
|
fixable: undefined,
|
|
20
20
|
schema: [],
|
|
@@ -26,29 +26,29 @@ exports.default = createRule({
|
|
|
26
26
|
create: (context) => {
|
|
27
27
|
return {
|
|
28
28
|
Property: (node) => {
|
|
29
|
-
if (node.key.type !==
|
|
29
|
+
if (node.key.type !== 'Identifier') {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
if (node.key.name !==
|
|
32
|
+
if (node.key.name !== 'backgroundImage') {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
if (node.value.type ===
|
|
35
|
+
if (node.value.type === 'Literal') {
|
|
36
36
|
const { value } = node.value;
|
|
37
|
-
if (typeof value ===
|
|
37
|
+
if (typeof value === 'string' && value.includes('url(')) {
|
|
38
38
|
context.report({
|
|
39
|
-
messageId:
|
|
39
|
+
messageId: 'BackgroundImage',
|
|
40
40
|
node,
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
if (node.value.type ===
|
|
44
|
+
if (node.value.type === 'TemplateLiteral') {
|
|
45
45
|
for (const element of node.value.quasis) {
|
|
46
|
-
if (element.type !==
|
|
46
|
+
if (element.type !== 'TemplateElement') {
|
|
47
47
|
continue;
|
|
48
48
|
}
|
|
49
|
-
if (element.value.raw.includes(
|
|
49
|
+
if (element.value.raw.includes('url(')) {
|
|
50
50
|
context.report({
|
|
51
|
-
messageId:
|
|
51
|
+
messageId: 'BackgroundImage',
|
|
52
52
|
node,
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"DurationInFrames", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
2
|
export default _default;
|
|
@@ -4,16 +4,16 @@ const utils_1 = require("@typescript-eslint/utils");
|
|
|
4
4
|
const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
5
5
|
return `https://github.com/remotion-dev/remotion`;
|
|
6
6
|
});
|
|
7
|
-
const DurationInFrames =
|
|
7
|
+
const DurationInFrames = 'Infinity is now the default, so you can remove the prop.';
|
|
8
8
|
exports.default = createRule({
|
|
9
|
-
name:
|
|
9
|
+
name: 'duration-in-frames',
|
|
10
10
|
meta: {
|
|
11
|
-
type:
|
|
11
|
+
type: 'problem',
|
|
12
12
|
docs: {
|
|
13
13
|
description: DurationInFrames,
|
|
14
|
-
recommended:
|
|
14
|
+
recommended: 'warn',
|
|
15
15
|
},
|
|
16
|
-
fixable:
|
|
16
|
+
fixable: 'code',
|
|
17
17
|
schema: [],
|
|
18
18
|
messages: {
|
|
19
19
|
DurationInFrames,
|
|
@@ -23,41 +23,41 @@ exports.default = createRule({
|
|
|
23
23
|
create: (context) => {
|
|
24
24
|
return {
|
|
25
25
|
JSXAttribute: (node) => {
|
|
26
|
-
if (node.type !==
|
|
26
|
+
if (node.type !== 'JSXAttribute') {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
if (node.name.name !==
|
|
29
|
+
if (node.name.name !== 'durationInFrames') {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
const value = node.value;
|
|
33
|
-
if (!value || value.type !==
|
|
33
|
+
if (!value || value.type !== 'JSXExpressionContainer') {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
const expression = value.expression;
|
|
37
|
-
if (!expression || expression.type !==
|
|
37
|
+
if (!expression || expression.type !== 'Identifier') {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
const stringValue = expression.name;
|
|
41
|
-
if (typeof stringValue !==
|
|
41
|
+
if (typeof stringValue !== 'string') {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
const parent = node.parent;
|
|
45
45
|
if (!parent) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
if (parent.type !==
|
|
48
|
+
if (parent.type !== 'JSXOpeningElement') {
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
const name = parent.name;
|
|
52
|
-
if (name.type !==
|
|
52
|
+
if (name.type !== 'JSXIdentifier') {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
if (name.name !==
|
|
55
|
+
if (name.name !== 'Sequence') {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
if (stringValue ===
|
|
58
|
+
if (stringValue === 'Infinity') {
|
|
59
59
|
context.report({
|
|
60
|
-
messageId:
|
|
60
|
+
messageId: 'DurationInFrames',
|
|
61
61
|
node,
|
|
62
62
|
fix: (fixer) => {
|
|
63
63
|
return fixer.removeRange([node.name.range[0], value.range[1]]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"From0", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
2
|
export default _default;
|
package/dist/rules/no-from-0.js
CHANGED
|
@@ -4,16 +4,16 @@ const utils_1 = require("@typescript-eslint/utils");
|
|
|
4
4
|
const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
5
5
|
return `https://github.com/remotion-dev/remotion`;
|
|
6
6
|
});
|
|
7
|
-
const From0 =
|
|
7
|
+
const From0 = '0 is now the default, so you can remove the prop.';
|
|
8
8
|
exports.default = createRule({
|
|
9
|
-
name:
|
|
9
|
+
name: 'from',
|
|
10
10
|
meta: {
|
|
11
|
-
type:
|
|
11
|
+
type: 'problem',
|
|
12
12
|
docs: {
|
|
13
13
|
description: From0,
|
|
14
|
-
recommended:
|
|
14
|
+
recommended: 'warn',
|
|
15
15
|
},
|
|
16
|
-
fixable:
|
|
16
|
+
fixable: 'code',
|
|
17
17
|
schema: [],
|
|
18
18
|
messages: {
|
|
19
19
|
From0,
|
|
@@ -23,18 +23,18 @@ exports.default = createRule({
|
|
|
23
23
|
create: (context) => {
|
|
24
24
|
return {
|
|
25
25
|
JSXAttribute: (node) => {
|
|
26
|
-
if (node.type !==
|
|
26
|
+
if (node.type !== 'JSXAttribute') {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
if (node.name.name !==
|
|
29
|
+
if (node.name.name !== 'from') {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
const value = node.value;
|
|
33
|
-
if (!value || value.type !==
|
|
33
|
+
if (!value || value.type !== 'JSXExpressionContainer') {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
const expression = value.expression;
|
|
37
|
-
if (!expression || expression.type !==
|
|
37
|
+
if (!expression || expression.type !== 'Literal') {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
const stringValue = expression.value;
|
|
@@ -45,19 +45,19 @@ exports.default = createRule({
|
|
|
45
45
|
if (!parent) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
if (parent.type !==
|
|
48
|
+
if (parent.type !== 'JSXOpeningElement') {
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
const name = parent.name;
|
|
52
|
-
if (name.type !==
|
|
52
|
+
if (name.type !== 'JSXIdentifier') {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
if (name.name !==
|
|
55
|
+
if (name.name !== 'Sequence') {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
if (stringValue === 0) {
|
|
59
59
|
context.report({
|
|
60
|
-
messageId:
|
|
60
|
+
messageId: 'From0',
|
|
61
61
|
node,
|
|
62
62
|
fix: (fixer) => {
|
|
63
63
|
return fixer.removeRange([node.name.range[0], value.range[1]]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoMP4Import", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
2
|
export default rule;
|
|
@@ -4,14 +4,14 @@ const utils_1 = require("@typescript-eslint/utils");
|
|
|
4
4
|
const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
5
5
|
return `https://github.com/remotion-dev/remotion`;
|
|
6
6
|
});
|
|
7
|
-
const NoMP4Import =
|
|
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.';
|
|
8
8
|
const rule = createRule({
|
|
9
|
-
name:
|
|
9
|
+
name: 'no-mp4-import',
|
|
10
10
|
meta: {
|
|
11
|
-
type:
|
|
11
|
+
type: 'problem',
|
|
12
12
|
docs: {
|
|
13
13
|
description: NoMP4Import,
|
|
14
|
-
recommended:
|
|
14
|
+
recommended: 'warn',
|
|
15
15
|
},
|
|
16
16
|
fixable: undefined,
|
|
17
17
|
schema: [],
|
|
@@ -23,9 +23,9 @@ const rule = createRule({
|
|
|
23
23
|
create: (context) => {
|
|
24
24
|
return {
|
|
25
25
|
ImportDeclaration: (node) => {
|
|
26
|
-
if (node.source.raw.includes(
|
|
26
|
+
if (node.source.raw.includes('.mp4')) {
|
|
27
27
|
context.report({
|
|
28
|
-
messageId:
|
|
28
|
+
messageId: 'NoMP4Import',
|
|
29
29
|
node,
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -33,24 +33,24 @@ const rule = createRule({
|
|
|
33
33
|
CallExpression: (node) => {
|
|
34
34
|
var _a, _b, _c, _d;
|
|
35
35
|
// @ts-expect-error
|
|
36
|
-
if (node.callee.name !==
|
|
36
|
+
if (node.callee.name !== 'require') {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
// @ts-expect-error
|
|
40
40
|
const firstArgument = (_d = (_c = (_b = (_a = node.callee) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.arguments) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.raw;
|
|
41
41
|
if (!firstArgument) {
|
|
42
42
|
const sourceCode = context.getSourceCode().getText(node);
|
|
43
|
-
if (sourceCode.includes(
|
|
43
|
+
if (sourceCode.includes('.mp4')) {
|
|
44
44
|
context.report({
|
|
45
|
-
messageId:
|
|
45
|
+
messageId: 'NoMP4Import',
|
|
46
46
|
node,
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
if (firstArgument.includes(
|
|
51
|
+
if (firstArgument.includes('.mp4')) {
|
|
52
52
|
context.report({
|
|
53
|
-
messageId:
|
|
53
|
+
messageId: 'NoMP4Import',
|
|
54
54
|
node,
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoStringAssets", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
2
|
export default _default;
|
|
@@ -6,15 +6,15 @@ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
|
6
6
|
});
|
|
7
7
|
const NoStringAssets = [
|
|
8
8
|
"Don't reference local assets by string, use an import statement or staticFile() instead.",
|
|
9
|
-
|
|
10
|
-
].join(
|
|
9
|
+
'See: https://www.remotion.dev/docs/assets',
|
|
10
|
+
].join('\n');
|
|
11
11
|
exports.default = createRule({
|
|
12
|
-
name:
|
|
12
|
+
name: 'no-string-assets',
|
|
13
13
|
meta: {
|
|
14
|
-
type:
|
|
14
|
+
type: 'problem',
|
|
15
15
|
docs: {
|
|
16
16
|
description: NoStringAssets,
|
|
17
|
-
recommended:
|
|
17
|
+
recommended: 'warn',
|
|
18
18
|
},
|
|
19
19
|
fixable: undefined,
|
|
20
20
|
schema: [],
|
|
@@ -26,60 +26,60 @@ exports.default = createRule({
|
|
|
26
26
|
create: (context) => {
|
|
27
27
|
return {
|
|
28
28
|
JSXAttribute: (node) => {
|
|
29
|
-
if (node.type !==
|
|
29
|
+
if (node.type !== 'JSXAttribute') {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
if (node.name.name !==
|
|
32
|
+
if (node.name.name !== 'src') {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
const value = node.value;
|
|
36
36
|
// src={"some string"}
|
|
37
37
|
const insideCurlyBraces = value &&
|
|
38
|
-
value.type ===
|
|
39
|
-
value.expression.type ===
|
|
40
|
-
if (!value || (value.type !==
|
|
38
|
+
value.type === 'JSXExpressionContainer' &&
|
|
39
|
+
value.expression.type === 'Literal';
|
|
40
|
+
if (!value || (value.type !== 'Literal' && !insideCurlyBraces)) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
const stringValue = value &&
|
|
44
|
-
value.type ===
|
|
45
|
-
value.expression.type ===
|
|
44
|
+
value.type === 'JSXExpressionContainer' &&
|
|
45
|
+
value.expression.type === 'Literal'
|
|
46
46
|
? value.expression.value
|
|
47
|
-
: value.type ===
|
|
47
|
+
: value.type === 'Literal'
|
|
48
48
|
? value.value
|
|
49
49
|
: null;
|
|
50
|
-
if (typeof stringValue !==
|
|
50
|
+
if (typeof stringValue !== 'string') {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
const parent = node.parent;
|
|
54
54
|
if (!parent) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
if (parent.type !==
|
|
57
|
+
if (parent.type !== 'JSXOpeningElement') {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
const name = parent.name;
|
|
61
|
-
if (name.type !==
|
|
61
|
+
if (name.type !== 'JSXIdentifier') {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
if (name.name ===
|
|
65
|
-
name.name ===
|
|
66
|
-
name.name ===
|
|
67
|
-
name.name ===
|
|
68
|
-
name.name ===
|
|
69
|
-
name.name ===
|
|
70
|
-
name.name ===
|
|
64
|
+
if (name.name === 'Img' ||
|
|
65
|
+
name.name === 'img' ||
|
|
66
|
+
name.name === 'Audio' ||
|
|
67
|
+
name.name === 'audio' ||
|
|
68
|
+
name.name === 'Video' ||
|
|
69
|
+
name.name === 'video' ||
|
|
70
|
+
name.name === 'source') {
|
|
71
71
|
// Network and inline URLs are okay
|
|
72
|
-
if (stringValue.startsWith(
|
|
72
|
+
if (stringValue.startsWith('http://')) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
if (stringValue.startsWith(
|
|
75
|
+
if (stringValue.startsWith('https://')) {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
if (stringValue.startsWith(
|
|
78
|
+
if (stringValue.startsWith('data:')) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
context.report({
|
|
82
|
-
messageId:
|
|
82
|
+
messageId: 'NoStringAssets',
|
|
83
83
|
node,
|
|
84
84
|
});
|
|
85
85
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
type MessageIds =
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
type MessageIds = 'RelativePathStaticFile' | 'AbsoluteStaticFile' | 'PublicStaticFile';
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<MessageIds, [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
3
3
|
export default _default;
|
|
@@ -6,23 +6,23 @@ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
|
6
6
|
});
|
|
7
7
|
const RelativePathStaticFile = [
|
|
8
8
|
"Don't pass a relative path to staticFile().",
|
|
9
|
-
|
|
10
|
-
].join(
|
|
9
|
+
'See: https://remotion.dev/docs/staticfile-relative-paths',
|
|
10
|
+
].join('\n');
|
|
11
11
|
const AbsoluteStaticFile = [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
].join(
|
|
12
|
+
'Do not pass an absolute path to staticFile().',
|
|
13
|
+
'See: https://remotion.dev/docs/staticfile-relative-paths',
|
|
14
|
+
].join('');
|
|
15
15
|
const PublicStaticFile = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
].join(
|
|
16
|
+
'Do not prefix your assets with public/.',
|
|
17
|
+
'See: https://remotion.dev/docs/staticfile-relative-paths',
|
|
18
|
+
].join('');
|
|
19
19
|
exports.default = createRule({
|
|
20
|
-
name:
|
|
20
|
+
name: 'staticfile-no-relative',
|
|
21
21
|
meta: {
|
|
22
|
-
type:
|
|
22
|
+
type: 'problem',
|
|
23
23
|
docs: {
|
|
24
24
|
description: RelativePathStaticFile,
|
|
25
|
-
recommended:
|
|
25
|
+
recommended: 'warn',
|
|
26
26
|
},
|
|
27
27
|
fixable: undefined,
|
|
28
28
|
schema: [],
|
|
@@ -41,48 +41,48 @@ exports.default = createRule({
|
|
|
41
41
|
if (!value) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
if (node.type ===
|
|
45
|
-
node.callee.type ===
|
|
46
|
-
node.callee.name ===
|
|
44
|
+
if (node.type === 'CallExpression' &&
|
|
45
|
+
node.callee.type === 'Identifier' &&
|
|
46
|
+
node.callee.name === 'staticFile') {
|
|
47
47
|
const args = node.arguments;
|
|
48
48
|
if (args.length === 0) {
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
const firstArg = args[0];
|
|
52
|
-
if (firstArg.type ===
|
|
52
|
+
if (firstArg.type === 'Literal') {
|
|
53
53
|
const value = firstArg.value;
|
|
54
|
-
if (typeof value !==
|
|
54
|
+
if (typeof value !== 'string') {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
if (value.startsWith(
|
|
57
|
+
if (value.startsWith('./')) {
|
|
58
58
|
context.report({
|
|
59
|
-
messageId:
|
|
59
|
+
messageId: 'RelativePathStaticFile',
|
|
60
60
|
node,
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
if (value.startsWith(
|
|
63
|
+
if (value.startsWith('../')) {
|
|
64
64
|
context.report({
|
|
65
|
-
messageId:
|
|
65
|
+
messageId: 'RelativePathStaticFile',
|
|
66
66
|
node,
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
if (value.startsWith(
|
|
69
|
+
if (value.startsWith('public/')) {
|
|
70
70
|
context.report({
|
|
71
|
-
messageId:
|
|
71
|
+
messageId: 'PublicStaticFile',
|
|
72
72
|
node,
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
if (value.startsWith(
|
|
76
|
-
value.startsWith(
|
|
77
|
-
value.startsWith(
|
|
78
|
-
value.startsWith(
|
|
79
|
-
value.startsWith(
|
|
80
|
-
value.startsWith(
|
|
81
|
-
value.startsWith(
|
|
82
|
-
value.startsWith(
|
|
83
|
-
value.startsWith(
|
|
75
|
+
if (value.startsWith('/Users') ||
|
|
76
|
+
value.startsWith('/home') ||
|
|
77
|
+
value.startsWith('/tmp') ||
|
|
78
|
+
value.startsWith('/etc') ||
|
|
79
|
+
value.startsWith('/opt') ||
|
|
80
|
+
value.startsWith('/var') ||
|
|
81
|
+
value.startsWith('C:') ||
|
|
82
|
+
value.startsWith('D:') ||
|
|
83
|
+
value.startsWith('E:')) {
|
|
84
84
|
context.report({
|
|
85
|
-
messageId:
|
|
85
|
+
messageId: 'AbsoluteStaticFile',
|
|
86
86
|
node,
|
|
87
87
|
});
|
|
88
88
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"RelativePathStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
2
|
export default _default;
|
|
@@ -6,15 +6,15 @@ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
|
6
6
|
});
|
|
7
7
|
const RelativePathStaticFile = [
|
|
8
8
|
"Don't pass a remote URL to staticFile().",
|
|
9
|
-
|
|
10
|
-
].join(
|
|
9
|
+
'See: https://remotion.dev/docs/staticfile-remote-urls',
|
|
10
|
+
].join('\n');
|
|
11
11
|
exports.default = createRule({
|
|
12
|
-
name:
|
|
12
|
+
name: 'staticfile-no-remote',
|
|
13
13
|
meta: {
|
|
14
|
-
type:
|
|
14
|
+
type: 'problem',
|
|
15
15
|
docs: {
|
|
16
16
|
description: RelativePathStaticFile,
|
|
17
|
-
recommended:
|
|
17
|
+
recommended: 'warn',
|
|
18
18
|
},
|
|
19
19
|
fixable: undefined,
|
|
20
20
|
schema: [],
|
|
@@ -31,28 +31,28 @@ exports.default = createRule({
|
|
|
31
31
|
if (!value) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
if (node.type ===
|
|
35
|
-
node.callee.type ===
|
|
36
|
-
node.callee.name ===
|
|
34
|
+
if (node.type === 'CallExpression' &&
|
|
35
|
+
node.callee.type === 'Identifier' &&
|
|
36
|
+
node.callee.name === 'staticFile') {
|
|
37
37
|
const args = node.arguments;
|
|
38
38
|
if (args.length === 0) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
const firstArg = args[0];
|
|
42
|
-
if (firstArg.type ===
|
|
42
|
+
if (firstArg.type === 'Literal') {
|
|
43
43
|
const value = firstArg.value;
|
|
44
|
-
if (typeof value !==
|
|
44
|
+
if (typeof value !== 'string') {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
if (value.startsWith(
|
|
47
|
+
if (value.startsWith('http://')) {
|
|
48
48
|
context.report({
|
|
49
|
-
messageId:
|
|
49
|
+
messageId: 'RelativePathStaticFile',
|
|
50
50
|
node,
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
if (value.startsWith(
|
|
53
|
+
if (value.startsWith('https://')) {
|
|
54
54
|
context.report({
|
|
55
|
-
messageId:
|
|
55
|
+
messageId: 'RelativePathStaticFile',
|
|
56
56
|
node,
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"UseGifComponent", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
2
|
export default _default;
|
|
@@ -5,17 +5,17 @@ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
|
5
5
|
return `https://github.com/remotion-dev/remotion`;
|
|
6
6
|
});
|
|
7
7
|
const UseGifComponent = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
].join(
|
|
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
12
|
exports.default = createRule({
|
|
13
|
-
name:
|
|
13
|
+
name: 'use-gif-component',
|
|
14
14
|
meta: {
|
|
15
|
-
type:
|
|
15
|
+
type: 'problem',
|
|
16
16
|
docs: {
|
|
17
17
|
description: UseGifComponent,
|
|
18
|
-
recommended:
|
|
18
|
+
recommended: 'warn',
|
|
19
19
|
},
|
|
20
20
|
fixable: undefined,
|
|
21
21
|
schema: [],
|
|
@@ -27,24 +27,24 @@ exports.default = createRule({
|
|
|
27
27
|
create: (context) => {
|
|
28
28
|
return {
|
|
29
29
|
JSXAttribute: (node) => {
|
|
30
|
-
if (node.type !==
|
|
30
|
+
if (node.type !== 'JSXAttribute') {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
if (node.name.name !==
|
|
33
|
+
if (node.name.name !== 'src') {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
const parent = node.parent;
|
|
37
37
|
if (!parent) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
if (parent.type !==
|
|
40
|
+
if (parent.type !== 'JSXOpeningElement') {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
const name = parent.name;
|
|
44
|
-
if (name.type !==
|
|
44
|
+
if (name.type !== 'JSXIdentifier') {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
if (name.name !==
|
|
47
|
+
if (name.name !== 'Img' && name.name !== 'img') {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
const value = node.value;
|
|
@@ -53,39 +53,39 @@ exports.default = createRule({
|
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
const stringValue = value &&
|
|
56
|
-
value.type ===
|
|
57
|
-
value.expression.type ===
|
|
56
|
+
value.type === 'JSXExpressionContainer' &&
|
|
57
|
+
value.expression.type === 'Literal'
|
|
58
58
|
? value.expression.value
|
|
59
|
-
: value.type ===
|
|
59
|
+
: value.type === 'Literal'
|
|
60
60
|
? value.value
|
|
61
61
|
: null;
|
|
62
62
|
// src="image.gif"
|
|
63
|
-
if (typeof stringValue ===
|
|
63
|
+
if (typeof stringValue === 'string') {
|
|
64
64
|
// Network and inline URLs are okay
|
|
65
|
-
if (stringValue.includes(
|
|
65
|
+
if (stringValue.includes('.gif')) {
|
|
66
66
|
context.report({
|
|
67
|
-
messageId:
|
|
67
|
+
messageId: 'UseGifComponent',
|
|
68
68
|
node,
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
if (value.type ===
|
|
73
|
-
value.expression.type ===
|
|
74
|
-
value.expression.callee.type ===
|
|
75
|
-
value.expression.callee.name ===
|
|
72
|
+
if (value.type === 'JSXExpressionContainer' &&
|
|
73
|
+
value.expression.type === 'CallExpression' &&
|
|
74
|
+
value.expression.callee.type === 'Identifier' &&
|
|
75
|
+
value.expression.callee.name === 'staticFile') {
|
|
76
76
|
const args = value.expression.arguments;
|
|
77
77
|
if (args.length === 0) {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
const firstArg = args[0];
|
|
81
|
-
if (firstArg.type ===
|
|
81
|
+
if (firstArg.type === 'Literal') {
|
|
82
82
|
const value = firstArg.value;
|
|
83
|
-
if (typeof value !==
|
|
83
|
+
if (typeof value !== 'string') {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
if (value.includes(
|
|
86
|
+
if (value.includes('.gif')) {
|
|
87
87
|
context.report({
|
|
88
|
-
messageId:
|
|
88
|
+
messageId: 'UseGifComponent',
|
|
89
89
|
node,
|
|
90
90
|
});
|
|
91
91
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"ImportConfig", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
2
|
export default rule;
|
package/dist/rules/v4-import.js
CHANGED
|
@@ -6,12 +6,12 @@ const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
|
6
6
|
});
|
|
7
7
|
const ImportConfig = "Update the import to the new V4 location: import {Config} from '@remotion/cli/config'";
|
|
8
8
|
const rule = createRule({
|
|
9
|
-
name:
|
|
9
|
+
name: 'v4-config-import',
|
|
10
10
|
meta: {
|
|
11
|
-
type:
|
|
11
|
+
type: 'problem',
|
|
12
12
|
docs: {
|
|
13
13
|
description: ImportConfig,
|
|
14
|
-
recommended:
|
|
14
|
+
recommended: 'warn',
|
|
15
15
|
},
|
|
16
16
|
fixable: undefined,
|
|
17
17
|
schema: [],
|
|
@@ -23,13 +23,13 @@ const rule = createRule({
|
|
|
23
23
|
create: (context) => {
|
|
24
24
|
return {
|
|
25
25
|
ImportDeclaration: (node) => {
|
|
26
|
-
if (node.source.value !==
|
|
26
|
+
if (node.source.value !== 'remotion') {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
const config = node.specifiers.find((s) => s.type ===
|
|
29
|
+
const config = node.specifiers.find((s) => s.type === 'ImportSpecifier' && s.imported.name === 'Config');
|
|
30
30
|
if (config) {
|
|
31
31
|
context.report({
|
|
32
|
-
messageId:
|
|
32
|
+
messageId: 'ImportConfig',
|
|
33
33
|
node,
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"VolumeCallback", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
2
|
export default _default;
|
|
@@ -4,14 +4,14 @@ const utils_1 = require("@typescript-eslint/utils");
|
|
|
4
4
|
const createRule = utils_1.ESLintUtils.RuleCreator(() => {
|
|
5
5
|
return `https://github.com/remotion-dev/remotion`;
|
|
6
6
|
});
|
|
7
|
-
const VolumeCallback =
|
|
7
|
+
const VolumeCallback = 'Prefer a callback function for setting the volume: `volume={(f) => interpolate(...)}`. See https://www.remotion.dev/docs/using-audio/#controlling-volume';
|
|
8
8
|
exports.default = createRule({
|
|
9
|
-
name:
|
|
9
|
+
name: 'volume-callback',
|
|
10
10
|
meta: {
|
|
11
|
-
type:
|
|
11
|
+
type: 'problem',
|
|
12
12
|
docs: {
|
|
13
13
|
description: VolumeCallback,
|
|
14
|
-
recommended:
|
|
14
|
+
recommended: 'warn',
|
|
15
15
|
},
|
|
16
16
|
fixable: undefined,
|
|
17
17
|
schema: [],
|
|
@@ -23,42 +23,42 @@ exports.default = createRule({
|
|
|
23
23
|
create: (context) => {
|
|
24
24
|
return {
|
|
25
25
|
JSXAttribute: (node) => {
|
|
26
|
-
if (node.type !==
|
|
26
|
+
if (node.type !== 'JSXAttribute') {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
if (node.name.name !==
|
|
29
|
+
if (node.name.name !== 'volume') {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
const value = node.value;
|
|
33
|
-
if (!value || value.type !==
|
|
33
|
+
if (!value || value.type !== 'JSXExpressionContainer') {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
const parent = node.parent;
|
|
37
37
|
if (!parent) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
if (parent.type !==
|
|
40
|
+
if (parent.type !== 'JSXOpeningElement') {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
const name = parent.name;
|
|
44
|
-
if (name.type !==
|
|
44
|
+
if (name.type !== 'JSXIdentifier') {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
if (name.name !==
|
|
47
|
+
if (name.name !== 'Video' && name.name !== 'Audio') {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
const expression = value.expression;
|
|
51
51
|
if (!expression) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
if (expression.type ===
|
|
54
|
+
if (expression.type === 'Literal') {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
if (expression.type ===
|
|
57
|
+
if (expression.type === 'ArrowFunctionExpression') {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
context.report({
|
|
61
|
-
messageId:
|
|
61
|
+
messageId: 'VolumeCallback',
|
|
62
62
|
node,
|
|
63
63
|
});
|
|
64
64
|
},
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
type MessageIds =
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
1
|
+
type MessageIds = 'NoNativeImgTag' | 'NoNativeIFrameTag' | 'NoNativeAudioTag' | 'NoNativeVideoTag';
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<MessageIds, [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
3
3
|
export default _default;
|
|
@@ -9,12 +9,12 @@ const NoNativeIFrameTag = "Prefer the <IFrame /> tag from 'remotion' package, be
|
|
|
9
9
|
const NoNativeAudioTag = "Use the <Audio /> tag from 'remotion' package, because it will synchronize with the Remotion timeline.";
|
|
10
10
|
const NoNativeVideoTag = "Use the <Video /> tag from 'remotion' package, because it will synchronize with the Remotion timeline.";
|
|
11
11
|
exports.default = createRule({
|
|
12
|
-
name:
|
|
12
|
+
name: 'warn-native-media-tag',
|
|
13
13
|
meta: {
|
|
14
|
-
type:
|
|
14
|
+
type: 'problem',
|
|
15
15
|
docs: {
|
|
16
16
|
description: NoNativeImgTag,
|
|
17
|
-
recommended:
|
|
17
|
+
recommended: 'warn',
|
|
18
18
|
},
|
|
19
19
|
fixable: undefined,
|
|
20
20
|
schema: [],
|
|
@@ -29,65 +29,65 @@ exports.default = createRule({
|
|
|
29
29
|
create: (context) => {
|
|
30
30
|
return {
|
|
31
31
|
JSXOpeningElement: (node) => {
|
|
32
|
-
if (node.name.type ===
|
|
32
|
+
if (node.name.type === 'JSXIdentifier' && node.name.name === 'img') {
|
|
33
33
|
context.report({
|
|
34
|
-
messageId:
|
|
34
|
+
messageId: 'NoNativeImgTag',
|
|
35
35
|
node,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
if (node.name.type ===
|
|
38
|
+
if (node.name.type === 'JSXIdentifier' && node.name.name === 'iframe') {
|
|
39
39
|
context.report({
|
|
40
|
-
messageId:
|
|
40
|
+
messageId: 'NoNativeIFrameTag',
|
|
41
41
|
node,
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
if (node.name.type ===
|
|
44
|
+
if (node.name.type === 'JSXIdentifier' && node.name.name === 'video') {
|
|
45
45
|
context.report({
|
|
46
|
-
messageId:
|
|
46
|
+
messageId: 'NoNativeVideoTag',
|
|
47
47
|
node,
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
if (node.name.type ===
|
|
50
|
+
if (node.name.type === 'JSXIdentifier' && node.name.name === 'audio') {
|
|
51
51
|
context.report({
|
|
52
|
-
messageId:
|
|
52
|
+
messageId: 'NoNativeAudioTag',
|
|
53
53
|
node,
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
TaggedTemplateExpression: (node) => {
|
|
58
|
-
if (node.tag.type !==
|
|
58
|
+
if (node.tag.type !== 'MemberExpression') {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
if (node.tag.object.type !==
|
|
61
|
+
if (node.tag.object.type !== 'Identifier') {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
if (node.tag.object.name !==
|
|
64
|
+
if (node.tag.object.name !== 'styled') {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
if (node.tag.property.type !==
|
|
67
|
+
if (node.tag.property.type !== 'Identifier') {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
if (node.tag.property.name ===
|
|
70
|
+
if (node.tag.property.name === 'img') {
|
|
71
71
|
context.report({
|
|
72
|
-
messageId:
|
|
72
|
+
messageId: 'NoNativeImgTag',
|
|
73
73
|
node,
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
if (node.tag.property.name ===
|
|
76
|
+
if (node.tag.property.name === 'iframe') {
|
|
77
77
|
context.report({
|
|
78
|
-
messageId:
|
|
78
|
+
messageId: 'NoNativeIFrameTag',
|
|
79
79
|
node,
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
if (node.tag.property.name ===
|
|
82
|
+
if (node.tag.property.name === 'audio') {
|
|
83
83
|
context.report({
|
|
84
|
-
messageId:
|
|
84
|
+
messageId: 'NoNativeAudioTag',
|
|
85
85
|
node,
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
if (node.tag.property.name ===
|
|
88
|
+
if (node.tag.property.name === 'video') {
|
|
89
89
|
context.report({
|
|
90
|
-
messageId:
|
|
90
|
+
messageId: 'NoNativeVideoTag',
|
|
91
91
|
node,
|
|
92
92
|
});
|
|
93
93
|
}
|
package/package.json
CHANGED