@remotion/eslint-plugin 4.0.258 → 4.0.259

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/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.258",
6
+ "version": "4.0.259",
7
7
  "description": "Rules for writing Remotion code",
8
8
  "main": "dist/index.js",
9
9
  "bugs": {
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
- });
@@ -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
- });
@@ -1,64 +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-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
- });
@@ -1,97 +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 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 parent = node.parent;
37
- if (!parent) {
38
- return;
39
- }
40
- if (parent.type !== 'JSXOpeningElement') {
41
- return;
42
- }
43
- const name = parent.name;
44
- if (name.type !== 'JSXIdentifier') {
45
- return;
46
- }
47
- if (name.name !== 'Img' && name.name !== 'img') {
48
- return;
49
- }
50
- const value = node.value;
51
- // src={"some string"}
52
- if (!value) {
53
- return;
54
- }
55
- const stringValue = value &&
56
- value.type === 'JSXExpressionContainer' &&
57
- value.expression.type === 'Literal'
58
- ? value.expression.value
59
- : value.type === 'Literal'
60
- ? value.value
61
- : null;
62
- // src="image.gif"
63
- if (typeof stringValue === 'string') {
64
- // Network and inline URLs are okay
65
- if (stringValue.includes('.gif')) {
66
- context.report({
67
- messageId: 'UseGifComponent',
68
- node,
69
- });
70
- }
71
- }
72
- if (value.type === 'JSXExpressionContainer' &&
73
- value.expression.type === 'CallExpression' &&
74
- value.expression.callee.type === 'Identifier' &&
75
- value.expression.callee.name === 'staticFile') {
76
- const args = value.expression.arguments;
77
- if (args.length === 0) {
78
- return;
79
- }
80
- const firstArg = args[0];
81
- if (firstArg.type === 'Literal') {
82
- const value = firstArg.value;
83
- if (typeof value !== 'string') {
84
- return;
85
- }
86
- if (value.includes('.gif')) {
87
- context.report({
88
- messageId: 'UseGifComponent',
89
- node,
90
- });
91
- }
92
- }
93
- }
94
- },
95
- };
96
- },
97
- });
@@ -1,40 +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://www.remotion.dev/docs/4-0-migration`;
6
- });
7
- const ImportConfig = "Update the import to the new V4 location: import {Config} from '@remotion/cli/config'";
8
- const rule = createRule({
9
- name: 'v4-config-import',
10
- meta: {
11
- type: 'problem',
12
- docs: {
13
- description: ImportConfig,
14
- recommended: 'warn',
15
- },
16
- fixable: undefined,
17
- schema: [],
18
- messages: {
19
- ImportConfig,
20
- },
21
- },
22
- defaultOptions: [],
23
- create: (context) => {
24
- return {
25
- ImportDeclaration: (node) => {
26
- if (node.source.value !== 'remotion') {
27
- return;
28
- }
29
- const config = node.specifiers.find((s) => s.type === 'ImportSpecifier' && s.imported.name === 'Config');
30
- if (config) {
31
- context.report({
32
- messageId: 'ImportConfig',
33
- node,
34
- });
35
- }
36
- },
37
- };
38
- },
39
- });
40
- exports.default = rule;
@@ -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 VolumeCallback = 'Prefer a callback function for setting the volume: `volume={(f) => interpolate(...)}`. See https://www.remotion.dev/docs/using-audio/#controlling-volume';
8
- exports.default = createRule({
9
- name: 'volume-callback',
10
- meta: {
11
- type: 'problem',
12
- docs: {
13
- description: VolumeCallback,
14
- recommended: 'warn',
15
- },
16
- fixable: undefined,
17
- schema: [],
18
- messages: {
19
- VolumeCallback,
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 !== 'volume') {
30
- return;
31
- }
32
- const value = node.value;
33
- if (!value || value.type !== 'JSXExpressionContainer') {
34
- return;
35
- }
36
- const parent = node.parent;
37
- if (!parent) {
38
- return;
39
- }
40
- if (parent.type !== 'JSXOpeningElement') {
41
- return;
42
- }
43
- const name = parent.name;
44
- if (name.type !== 'JSXIdentifier') {
45
- return;
46
- }
47
- if (name.name !== 'Video' && name.name !== 'Audio') {
48
- return;
49
- }
50
- const expression = value.expression;
51
- if (!expression) {
52
- return;
53
- }
54
- if (expression.type === 'Literal') {
55
- return;
56
- }
57
- if (expression.type === 'ArrowFunctionExpression') {
58
- return;
59
- }
60
- context.report({
61
- messageId: 'VolumeCallback',
62
- node,
63
- });
64
- },
65
- };
66
- },
67
- });
@@ -1,97 +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 NoNativeImgTag = "Prefer the <Img /> tag from 'remotion' package, because it will wait until the image is loaded when you are rendering your video.";
8
- const NoNativeIFrameTag = "Prefer the <IFrame /> tag from 'remotion' package, because it will wait until the iframe is loaded when you are rendering your video.";
9
- const NoNativeAudioTag = "Use the <Audio /> tag from 'remotion' package, because it will synchronize with the Remotion timeline.";
10
- const NoNativeVideoTag = "Use the <Video /> tag from 'remotion' package, because it will synchronize with the Remotion timeline.";
11
- exports.default = createRule({
12
- name: 'warn-native-media-tag',
13
- meta: {
14
- type: 'problem',
15
- docs: {
16
- description: NoNativeImgTag,
17
- recommended: 'warn',
18
- },
19
- fixable: undefined,
20
- schema: [],
21
- messages: {
22
- NoNativeImgTag,
23
- NoNativeIFrameTag,
24
- NoNativeAudioTag,
25
- NoNativeVideoTag,
26
- },
27
- },
28
- defaultOptions: [],
29
- create: (context) => {
30
- return {
31
- JSXOpeningElement: (node) => {
32
- if (node.name.type === 'JSXIdentifier' && node.name.name === 'img') {
33
- context.report({
34
- messageId: 'NoNativeImgTag',
35
- node,
36
- });
37
- }
38
- if (node.name.type === 'JSXIdentifier' && node.name.name === 'iframe') {
39
- context.report({
40
- messageId: 'NoNativeIFrameTag',
41
- node,
42
- });
43
- }
44
- if (node.name.type === 'JSXIdentifier' && node.name.name === 'video') {
45
- context.report({
46
- messageId: 'NoNativeVideoTag',
47
- node,
48
- });
49
- }
50
- if (node.name.type === 'JSXIdentifier' && node.name.name === 'audio') {
51
- context.report({
52
- messageId: 'NoNativeAudioTag',
53
- node,
54
- });
55
- }
56
- },
57
- TaggedTemplateExpression: (node) => {
58
- if (node.tag.type !== 'MemberExpression') {
59
- return;
60
- }
61
- if (node.tag.object.type !== 'Identifier') {
62
- return;
63
- }
64
- if (node.tag.object.name !== 'styled') {
65
- return;
66
- }
67
- if (node.tag.property.type !== 'Identifier') {
68
- return;
69
- }
70
- if (node.tag.property.name === 'img') {
71
- context.report({
72
- messageId: 'NoNativeImgTag',
73
- node,
74
- });
75
- }
76
- if (node.tag.property.name === 'iframe') {
77
- context.report({
78
- messageId: 'NoNativeIFrameTag',
79
- node,
80
- });
81
- }
82
- if (node.tag.property.name === 'audio') {
83
- context.report({
84
- messageId: 'NoNativeAudioTag',
85
- node,
86
- });
87
- }
88
- if (node.tag.property.name === 'video') {
89
- context.report({
90
- messageId: 'NoNativeVideoTag',
91
- node,
92
- });
93
- }
94
- },
95
- };
96
- },
97
- });