@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.
@@ -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
- });