@remotion/eslint-plugin 4.0.258 → 4.0.260
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/bundle.ts +8 -25
- package/dist/cjs/index.js +42 -100525
- package/dist/esm/index.mjs +68 -100547
- package/dist/index.d.ts +50 -15
- package/package.json +4 -3
- package/dist/index.js +0 -51
- package/dist/rules/deterministic-randomness.js +0 -47
- package/dist/rules/even-dimensions.js +0 -67
- package/dist/rules/no-background-image.js +0 -60
- package/dist/rules/no-duration-frames-infinity.js +0 -70
- package/dist/rules/no-from-0.js +0 -70
- package/dist/rules/no-string-assets.js +0 -89
- package/dist/rules/staticfile-no-relative.js +0 -94
- package/dist/rules/staticfile-no-remote.js +0 -64
- package/dist/rules/use-gif-component.js +0 -97
- package/dist/rules/v4-import.js +0 -40
- package/dist/rules/volume-callback.js +0 -67
- package/dist/rules/warn-native-media-tag.js +0 -97
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
|
|
3
|
-
'warn-native-media-tag': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoNativeImgTag" | "NoNativeIFrameTag" | "NoNativeAudioTag" | "NoNativeVideoTag", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
4
|
-
'deterministic-randomness': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"DeterministicRandomness", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
5
|
-
'no-string-assets': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoStringAssets", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
6
|
-
'even-dimensions': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"EvenDimensions", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
7
|
-
'duration-in-frames': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"DurationInFrames", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
8
|
-
'from-0': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"From0", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
9
|
-
'volume-callback': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"VolumeCallback", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
10
|
-
'use-gif-component': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"UseGifComponent", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
11
|
-
'staticfile-no-relative': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"RelativePathStaticFile" | "AbsoluteStaticFile" | "PublicStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
12
|
-
'staticfile-no-remote': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"RelativePathStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
13
|
-
'no-background-image': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"BackgroundImage", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
14
|
-
'v4-config-import': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"ImportConfig", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
15
|
-
};
|
|
16
|
-
readonly configs: {
|
|
2
|
+
configs: {
|
|
17
3
|
readonly recommended: {
|
|
18
4
|
readonly rules: {
|
|
19
5
|
readonly '@remotion/warn-native-media-tag': "error";
|
|
@@ -29,6 +15,55 @@ declare const _default: {
|
|
|
29
15
|
readonly '@remotion/no-background-image': "error";
|
|
30
16
|
readonly '@remotion/v4-config-import': "error";
|
|
31
17
|
};
|
|
18
|
+
readonly plugins: readonly ["@remotion"];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
rules: {
|
|
22
|
+
'warn-native-media-tag': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoNativeImgTag" | "NoNativeIFrameTag" | "NoNativeAudioTag" | "NoNativeVideoTag", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
23
|
+
'deterministic-randomness': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"DeterministicRandomness", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
24
|
+
'no-string-assets': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoStringAssets", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
25
|
+
'even-dimensions': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"EvenDimensions", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
26
|
+
'duration-in-frames': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"DurationInFrames", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
27
|
+
'from-0': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"From0", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
28
|
+
'volume-callback': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"VolumeCallback", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
29
|
+
'use-gif-component': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"UseGifComponent", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
30
|
+
'staticfile-no-relative': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"RelativePathStaticFile" | "AbsoluteStaticFile" | "PublicStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
31
|
+
'staticfile-no-remote': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"RelativePathStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
32
|
+
'no-background-image': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"BackgroundImage", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
33
|
+
'v4-config-import': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"ImportConfig", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
34
|
+
};
|
|
35
|
+
flatPlugin: {
|
|
36
|
+
rules: {
|
|
37
|
+
readonly '@remotion/warn-native-media-tag': "error";
|
|
38
|
+
readonly '@remotion/deterministic-randomness': "error";
|
|
39
|
+
readonly '@remotion/no-string-assets': "error";
|
|
40
|
+
readonly '@remotion/even-dimensions': "error";
|
|
41
|
+
readonly '@remotion/duration-in-frames': "error";
|
|
42
|
+
readonly '@remotion/from-0': "error";
|
|
43
|
+
readonly '@remotion/volume-callback': "error";
|
|
44
|
+
readonly '@remotion/use-gif-component': "error";
|
|
45
|
+
readonly '@remotion/staticfile-no-relative': "error";
|
|
46
|
+
readonly '@remotion/staticfile-no-remote': "error";
|
|
47
|
+
readonly '@remotion/no-background-image': "error";
|
|
48
|
+
readonly '@remotion/v4-config-import': "error";
|
|
49
|
+
};
|
|
50
|
+
plugins: {
|
|
51
|
+
'@remotion': {
|
|
52
|
+
rules: {
|
|
53
|
+
'warn-native-media-tag': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoNativeImgTag" | "NoNativeIFrameTag" | "NoNativeAudioTag" | "NoNativeVideoTag", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
54
|
+
'deterministic-randomness': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"DeterministicRandomness", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
55
|
+
'no-string-assets': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoStringAssets", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
56
|
+
'even-dimensions': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"EvenDimensions", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
57
|
+
'duration-in-frames': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"DurationInFrames", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
58
|
+
'from-0': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"From0", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
59
|
+
'volume-callback': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"VolumeCallback", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
60
|
+
'use-gif-component': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"UseGifComponent", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
61
|
+
'staticfile-no-relative': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"RelativePathStaticFile" | "AbsoluteStaticFile" | "PublicStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
62
|
+
'staticfile-no-remote': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"RelativePathStaticFile", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
63
|
+
'no-background-image': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"BackgroundImage", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
64
|
+
'v4-config-import': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"ImportConfig", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
32
67
|
};
|
|
33
68
|
};
|
|
34
69
|
};
|
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.260",
|
|
7
7
|
"description": "Rules for writing Remotion code",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"bugs": {
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
},
|
|
12
12
|
"author": "Jonny Burger <jonny@remotion.dev>",
|
|
13
13
|
"license": "ISC",
|
|
14
|
-
"dependencies": {
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@typescript-eslint/utils": "5.19.0"
|
|
16
|
+
},
|
|
15
17
|
"keywords": [
|
|
16
18
|
"eslint",
|
|
17
19
|
"eslintplugin"
|
|
@@ -20,7 +22,6 @@
|
|
|
20
22
|
"eslint": ">=7.0.0"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
23
|
-
"@typescript-eslint/utils": "5.19.0",
|
|
24
25
|
"vitest": "0.31.1"
|
|
25
26
|
},
|
|
26
27
|
"exports": {
|
package/dist/index.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
const deterministic_randomness_1 = __importDefault(require("./rules/deterministic-randomness"));
|
|
6
|
-
const even_dimensions_1 = __importDefault(require("./rules/even-dimensions"));
|
|
7
|
-
const no_background_image_1 = __importDefault(require("./rules/no-background-image"));
|
|
8
|
-
const no_duration_frames_infinity_1 = __importDefault(require("./rules/no-duration-frames-infinity"));
|
|
9
|
-
const no_from_0_1 = __importDefault(require("./rules/no-from-0"));
|
|
10
|
-
const no_string_assets_1 = __importDefault(require("./rules/no-string-assets"));
|
|
11
|
-
const staticfile_no_relative_1 = __importDefault(require("./rules/staticfile-no-relative"));
|
|
12
|
-
const staticfile_no_remote_1 = __importDefault(require("./rules/staticfile-no-remote"));
|
|
13
|
-
const use_gif_component_1 = __importDefault(require("./rules/use-gif-component"));
|
|
14
|
-
const v4_import_1 = __importDefault(require("./rules/v4-import"));
|
|
15
|
-
const volume_callback_1 = __importDefault(require("./rules/volume-callback"));
|
|
16
|
-
const warn_native_media_tag_1 = __importDefault(require("./rules/warn-native-media-tag"));
|
|
17
|
-
const rules = {
|
|
18
|
-
'warn-native-media-tag': warn_native_media_tag_1.default,
|
|
19
|
-
'deterministic-randomness': deterministic_randomness_1.default,
|
|
20
|
-
'no-string-assets': no_string_assets_1.default,
|
|
21
|
-
'even-dimensions': even_dimensions_1.default,
|
|
22
|
-
'duration-in-frames': no_duration_frames_infinity_1.default,
|
|
23
|
-
'from-0': no_from_0_1.default,
|
|
24
|
-
'volume-callback': volume_callback_1.default,
|
|
25
|
-
'use-gif-component': use_gif_component_1.default,
|
|
26
|
-
'staticfile-no-relative': staticfile_no_relative_1.default,
|
|
27
|
-
'staticfile-no-remote': staticfile_no_remote_1.default,
|
|
28
|
-
'no-background-image': no_background_image_1.default,
|
|
29
|
-
'v4-config-import': v4_import_1.default,
|
|
30
|
-
};
|
|
31
|
-
module.exports = {
|
|
32
|
-
rules,
|
|
33
|
-
configs: {
|
|
34
|
-
recommended: {
|
|
35
|
-
rules: {
|
|
36
|
-
'@remotion/warn-native-media-tag': 'error',
|
|
37
|
-
'@remotion/deterministic-randomness': 'error',
|
|
38
|
-
'@remotion/no-string-assets': 'error',
|
|
39
|
-
'@remotion/even-dimensions': 'error',
|
|
40
|
-
'@remotion/duration-in-frames': 'error',
|
|
41
|
-
'@remotion/from-0': 'error',
|
|
42
|
-
'@remotion/volume-callback': 'error',
|
|
43
|
-
'@remotion/use-gif-component': 'error',
|
|
44
|
-
'@remotion/staticfile-no-relative': 'error',
|
|
45
|
-
'@remotion/staticfile-no-remote': 'error',
|
|
46
|
-
'@remotion/no-background-image': 'error',
|
|
47
|
-
'@remotion/v4-config-import': 'error',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
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 DeterministicRandomness = [
|
|
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
|
-
exports.default = createRule({
|
|
14
|
-
name: 'deterministic-randomness',
|
|
15
|
-
meta: {
|
|
16
|
-
type: 'problem',
|
|
17
|
-
docs: {
|
|
18
|
-
description: DeterministicRandomness,
|
|
19
|
-
recommended: 'warn',
|
|
20
|
-
},
|
|
21
|
-
fixable: undefined,
|
|
22
|
-
schema: [],
|
|
23
|
-
messages: {
|
|
24
|
-
DeterministicRandomness: DeterministicRandomness,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
defaultOptions: [],
|
|
28
|
-
create: (context) => {
|
|
29
|
-
return {
|
|
30
|
-
CallExpression: (node) => {
|
|
31
|
-
const callee = node.callee;
|
|
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
|
-
context.report({
|
|
38
|
-
messageId: 'DeterministicRandomness',
|
|
39
|
-
node,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
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 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
|
-
exports.default = createRule({
|
|
9
|
-
name: 'even-dimensions',
|
|
10
|
-
meta: {
|
|
11
|
-
type: 'problem',
|
|
12
|
-
docs: {
|
|
13
|
-
description: EvenDimensions,
|
|
14
|
-
recommended: 'warn',
|
|
15
|
-
},
|
|
16
|
-
fixable: undefined,
|
|
17
|
-
schema: [],
|
|
18
|
-
messages: {
|
|
19
|
-
EvenDimensions,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
defaultOptions: [],
|
|
23
|
-
create: (context) => {
|
|
24
|
-
return {
|
|
25
|
-
JSXAttribute: (node) => {
|
|
26
|
-
if (node.type !== 'JSXAttribute') {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (node.name.name !== 'width' && node.name.name !== 'height') {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const value = node.value;
|
|
33
|
-
if (!value || value.type !== 'JSXExpressionContainer') {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const expression = value.expression;
|
|
37
|
-
if (!expression || expression.type !== 'Literal') {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const stringValue = expression.value;
|
|
41
|
-
if (typeof stringValue !== 'number') {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const parent = node.parent;
|
|
45
|
-
if (!parent) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (parent.type !== 'JSXOpeningElement') {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const name = parent.name;
|
|
52
|
-
if (name.type !== 'JSXIdentifier') {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (name.name !== 'Composition') {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (stringValue % 2 !== 0) {
|
|
59
|
-
context.report({
|
|
60
|
-
messageId: 'EvenDimensions',
|
|
61
|
-
node,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
},
|
|
67
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
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/troubleshooting/background-image';
|
|
6
|
-
});
|
|
7
|
-
const BackgroundImage = [
|
|
8
|
-
"Don't use background-image in Remotion.",
|
|
9
|
-
'See: https://remotion.dev/docs/troubleshooting/background-image',
|
|
10
|
-
].join('\n');
|
|
11
|
-
exports.default = createRule({
|
|
12
|
-
name: 'no-background-image',
|
|
13
|
-
meta: {
|
|
14
|
-
type: 'problem',
|
|
15
|
-
docs: {
|
|
16
|
-
description: BackgroundImage,
|
|
17
|
-
recommended: 'error',
|
|
18
|
-
},
|
|
19
|
-
fixable: undefined,
|
|
20
|
-
schema: [],
|
|
21
|
-
messages: {
|
|
22
|
-
BackgroundImage: BackgroundImage,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
defaultOptions: [],
|
|
26
|
-
create: (context) => {
|
|
27
|
-
return {
|
|
28
|
-
Property: (node) => {
|
|
29
|
-
if (node.key.type !== 'Identifier') {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (node.key.name !== 'backgroundImage') {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (node.value.type === 'Literal') {
|
|
36
|
-
const { value } = node.value;
|
|
37
|
-
if (typeof value === 'string' && value.includes('url(')) {
|
|
38
|
-
context.report({
|
|
39
|
-
messageId: 'BackgroundImage',
|
|
40
|
-
node,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (node.value.type === 'TemplateLiteral') {
|
|
45
|
-
for (const element of node.value.quasis) {
|
|
46
|
-
if (element.type !== 'TemplateElement') {
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
if (element.value.raw.includes('url(')) {
|
|
50
|
-
context.report({
|
|
51
|
-
messageId: 'BackgroundImage',
|
|
52
|
-
node,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
},
|
|
60
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
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 DurationInFrames = 'Infinity is now the default, so you can remove the prop.';
|
|
8
|
-
exports.default = createRule({
|
|
9
|
-
name: 'duration-in-frames',
|
|
10
|
-
meta: {
|
|
11
|
-
type: 'problem',
|
|
12
|
-
docs: {
|
|
13
|
-
description: DurationInFrames,
|
|
14
|
-
recommended: 'warn',
|
|
15
|
-
},
|
|
16
|
-
fixable: 'code',
|
|
17
|
-
schema: [],
|
|
18
|
-
messages: {
|
|
19
|
-
DurationInFrames,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
defaultOptions: [],
|
|
23
|
-
create: (context) => {
|
|
24
|
-
return {
|
|
25
|
-
JSXAttribute: (node) => {
|
|
26
|
-
if (node.type !== 'JSXAttribute') {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (node.name.name !== 'durationInFrames') {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const value = node.value;
|
|
33
|
-
if (!value || value.type !== 'JSXExpressionContainer') {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const expression = value.expression;
|
|
37
|
-
if (!expression || expression.type !== 'Identifier') {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const stringValue = expression.name;
|
|
41
|
-
if (typeof stringValue !== 'string') {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const parent = node.parent;
|
|
45
|
-
if (!parent) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (parent.type !== 'JSXOpeningElement') {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const name = parent.name;
|
|
52
|
-
if (name.type !== 'JSXIdentifier') {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (name.name !== 'Sequence') {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (stringValue === 'Infinity') {
|
|
59
|
-
context.report({
|
|
60
|
-
messageId: 'DurationInFrames',
|
|
61
|
-
node,
|
|
62
|
-
fix: (fixer) => {
|
|
63
|
-
return fixer.removeRange([node.name.range[0], value.range[1]]);
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
});
|
package/dist/rules/no-from-0.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
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 From0 = '0 is now the default, so you can remove the prop.';
|
|
8
|
-
exports.default = createRule({
|
|
9
|
-
name: 'from',
|
|
10
|
-
meta: {
|
|
11
|
-
type: 'problem',
|
|
12
|
-
docs: {
|
|
13
|
-
description: From0,
|
|
14
|
-
recommended: 'warn',
|
|
15
|
-
},
|
|
16
|
-
fixable: 'code',
|
|
17
|
-
schema: [],
|
|
18
|
-
messages: {
|
|
19
|
-
From0,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
defaultOptions: [],
|
|
23
|
-
create: (context) => {
|
|
24
|
-
return {
|
|
25
|
-
JSXAttribute: (node) => {
|
|
26
|
-
if (node.type !== 'JSXAttribute') {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (node.name.name !== 'from') {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const value = node.value;
|
|
33
|
-
if (!value || value.type !== 'JSXExpressionContainer') {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const expression = value.expression;
|
|
37
|
-
if (!expression || expression.type !== 'Literal') {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const stringValue = expression.value;
|
|
41
|
-
if (stringValue !== 0) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const parent = node.parent;
|
|
45
|
-
if (!parent) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (parent.type !== 'JSXOpeningElement') {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const name = parent.name;
|
|
52
|
-
if (name.type !== 'JSXIdentifier') {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (name.name !== 'Sequence') {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (stringValue === 0) {
|
|
59
|
-
context.report({
|
|
60
|
-
messageId: 'From0',
|
|
61
|
-
node,
|
|
62
|
-
fix: (fixer) => {
|
|
63
|
-
return fixer.removeRange([node.name.range[0], value.range[1]]);
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
});
|
|
@@ -1,89 +0,0 @@
|
|
|
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 NoStringAssets = [
|
|
8
|
-
"Don't reference local assets by string, use an import statement or staticFile() instead.",
|
|
9
|
-
'See: https://www.remotion.dev/docs/assets',
|
|
10
|
-
].join('\n');
|
|
11
|
-
exports.default = createRule({
|
|
12
|
-
name: 'no-string-assets',
|
|
13
|
-
meta: {
|
|
14
|
-
type: 'problem',
|
|
15
|
-
docs: {
|
|
16
|
-
description: NoStringAssets,
|
|
17
|
-
recommended: 'warn',
|
|
18
|
-
},
|
|
19
|
-
fixable: undefined,
|
|
20
|
-
schema: [],
|
|
21
|
-
messages: {
|
|
22
|
-
NoStringAssets: NoStringAssets,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
defaultOptions: [],
|
|
26
|
-
create: (context) => {
|
|
27
|
-
return {
|
|
28
|
-
JSXAttribute: (node) => {
|
|
29
|
-
if (node.type !== 'JSXAttribute') {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (node.name.name !== 'src') {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const value = node.value;
|
|
36
|
-
// src={"some string"}
|
|
37
|
-
const insideCurlyBraces = value &&
|
|
38
|
-
value.type === 'JSXExpressionContainer' &&
|
|
39
|
-
value.expression.type === 'Literal';
|
|
40
|
-
if (!value || (value.type !== 'Literal' && !insideCurlyBraces)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const stringValue = value &&
|
|
44
|
-
value.type === 'JSXExpressionContainer' &&
|
|
45
|
-
value.expression.type === 'Literal'
|
|
46
|
-
? value.expression.value
|
|
47
|
-
: value.type === 'Literal'
|
|
48
|
-
? value.value
|
|
49
|
-
: null;
|
|
50
|
-
if (typeof stringValue !== 'string') {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const parent = node.parent;
|
|
54
|
-
if (!parent) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (parent.type !== 'JSXOpeningElement') {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const name = parent.name;
|
|
61
|
-
if (name.type !== 'JSXIdentifier') {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
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
|
-
// Network and inline URLs are okay
|
|
72
|
-
if (stringValue.startsWith('http://')) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (stringValue.startsWith('https://')) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (stringValue.startsWith('data:')) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
context.report({
|
|
82
|
-
messageId: 'NoStringAssets',
|
|
83
|
-
node,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
},
|
|
89
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
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
|
-
const AbsoluteStaticFile = [
|
|
12
|
-
'Do not pass an absolute path to staticFile().',
|
|
13
|
-
'See: https://remotion.dev/docs/staticfile-relative-paths',
|
|
14
|
-
].join('');
|
|
15
|
-
const PublicStaticFile = [
|
|
16
|
-
'Do not prefix your assets with public/.',
|
|
17
|
-
'See: https://remotion.dev/docs/staticfile-relative-paths',
|
|
18
|
-
].join('');
|
|
19
|
-
exports.default = createRule({
|
|
20
|
-
name: 'staticfile-no-relative',
|
|
21
|
-
meta: {
|
|
22
|
-
type: 'problem',
|
|
23
|
-
docs: {
|
|
24
|
-
description: RelativePathStaticFile,
|
|
25
|
-
recommended: 'warn',
|
|
26
|
-
},
|
|
27
|
-
fixable: undefined,
|
|
28
|
-
schema: [],
|
|
29
|
-
messages: {
|
|
30
|
-
RelativePathStaticFile: RelativePathStaticFile,
|
|
31
|
-
PublicStaticFile: PublicStaticFile,
|
|
32
|
-
AbsoluteStaticFile: AbsoluteStaticFile,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
defaultOptions: [],
|
|
36
|
-
create: (context) => {
|
|
37
|
-
return {
|
|
38
|
-
CallExpression: (node) => {
|
|
39
|
-
const value = node;
|
|
40
|
-
// src={"some string"}
|
|
41
|
-
if (!value) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (node.type === 'CallExpression' &&
|
|
45
|
-
node.callee.type === 'Identifier' &&
|
|
46
|
-
node.callee.name === 'staticFile') {
|
|
47
|
-
const args = node.arguments;
|
|
48
|
-
if (args.length === 0) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const firstArg = args[0];
|
|
52
|
-
if (firstArg.type === 'Literal') {
|
|
53
|
-
const value = firstArg.value;
|
|
54
|
-
if (typeof value !== 'string') {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (value.startsWith('./')) {
|
|
58
|
-
context.report({
|
|
59
|
-
messageId: 'RelativePathStaticFile',
|
|
60
|
-
node,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (value.startsWith('../')) {
|
|
64
|
-
context.report({
|
|
65
|
-
messageId: 'RelativePathStaticFile',
|
|
66
|
-
node,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
if (value.startsWith('public/')) {
|
|
70
|
-
context.report({
|
|
71
|
-
messageId: 'PublicStaticFile',
|
|
72
|
-
node,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
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
|
-
context.report({
|
|
85
|
-
messageId: 'AbsoluteStaticFile',
|
|
86
|
-
node,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
},
|
|
94
|
-
});
|