@remotion/eslint-plugin 4.0.251 → 4.0.253
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 +16 -18
- package/dist/index.js +0 -3
- package/dist/rules/missing-import.d.ts +24 -0
- package/dist/rules/missing-import.js +165 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
rules: {
|
|
3
|
-
'no-mp4-import': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoMP4Import", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
2
|
+
readonly rules: {
|
|
4
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>;
|
|
5
4
|
'deterministic-randomness': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"DeterministicRandomness", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
6
5
|
'no-string-assets': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoStringAssets", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
@@ -14,22 +13,21 @@ declare const _default: {
|
|
|
14
13
|
'no-background-image': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"BackgroundImage", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
15
14
|
'v4-config-import': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"ImportConfig", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
16
15
|
};
|
|
17
|
-
configs: {
|
|
18
|
-
recommended: {
|
|
19
|
-
rules: {
|
|
20
|
-
'@remotion/
|
|
21
|
-
'@remotion/
|
|
22
|
-
'@remotion/
|
|
23
|
-
'@remotion/
|
|
24
|
-
'@remotion/
|
|
25
|
-
'@remotion/
|
|
26
|
-
'@remotion/
|
|
27
|
-
'@remotion/
|
|
28
|
-
'@remotion/
|
|
29
|
-
'@remotion/staticfile-no-
|
|
30
|
-
'@remotion/
|
|
31
|
-
'@remotion/
|
|
32
|
-
'@remotion/v4-config-import': string;
|
|
16
|
+
readonly configs: {
|
|
17
|
+
readonly recommended: {
|
|
18
|
+
readonly rules: {
|
|
19
|
+
readonly '@remotion/warn-native-media-tag': "error";
|
|
20
|
+
readonly '@remotion/deterministic-randomness': "error";
|
|
21
|
+
readonly '@remotion/no-string-assets': "error";
|
|
22
|
+
readonly '@remotion/even-dimensions': "error";
|
|
23
|
+
readonly '@remotion/duration-in-frames': "error";
|
|
24
|
+
readonly '@remotion/from-0': "error";
|
|
25
|
+
readonly '@remotion/volume-callback': "error";
|
|
26
|
+
readonly '@remotion/use-gif-component': "error";
|
|
27
|
+
readonly '@remotion/staticfile-no-relative': "error";
|
|
28
|
+
readonly '@remotion/staticfile-no-remote': "error";
|
|
29
|
+
readonly '@remotion/no-background-image': "error";
|
|
30
|
+
readonly '@remotion/v4-config-import': "error";
|
|
33
31
|
};
|
|
34
32
|
};
|
|
35
33
|
};
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,6 @@ const even_dimensions_1 = __importDefault(require("./rules/even-dimensions"));
|
|
|
7
7
|
const no_background_image_1 = __importDefault(require("./rules/no-background-image"));
|
|
8
8
|
const no_duration_frames_infinity_1 = __importDefault(require("./rules/no-duration-frames-infinity"));
|
|
9
9
|
const no_from_0_1 = __importDefault(require("./rules/no-from-0"));
|
|
10
|
-
const no_mp4_import_1 = __importDefault(require("./rules/no-mp4-import"));
|
|
11
10
|
const no_string_assets_1 = __importDefault(require("./rules/no-string-assets"));
|
|
12
11
|
const staticfile_no_relative_1 = __importDefault(require("./rules/staticfile-no-relative"));
|
|
13
12
|
const staticfile_no_remote_1 = __importDefault(require("./rules/staticfile-no-remote"));
|
|
@@ -16,7 +15,6 @@ const v4_import_1 = __importDefault(require("./rules/v4-import"));
|
|
|
16
15
|
const volume_callback_1 = __importDefault(require("./rules/volume-callback"));
|
|
17
16
|
const warn_native_media_tag_1 = __importDefault(require("./rules/warn-native-media-tag"));
|
|
18
17
|
const rules = {
|
|
19
|
-
'no-mp4-import': no_mp4_import_1.default,
|
|
20
18
|
'warn-native-media-tag': warn_native_media_tag_1.default,
|
|
21
19
|
'deterministic-randomness': deterministic_randomness_1.default,
|
|
22
20
|
'no-string-assets': no_string_assets_1.default,
|
|
@@ -35,7 +33,6 @@ module.exports = {
|
|
|
35
33
|
configs: {
|
|
36
34
|
recommended: {
|
|
37
35
|
rules: {
|
|
38
|
-
'@remotion/no-mp4-import': 'off',
|
|
39
36
|
'@remotion/warn-native-media-tag': 'error',
|
|
40
37
|
'@remotion/deterministic-randomness': 'error',
|
|
41
38
|
'@remotion/no-string-assets': 'error',
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
meta: {
|
|
3
|
+
type: string;
|
|
4
|
+
fixable: boolean;
|
|
5
|
+
docs: {
|
|
6
|
+
description: string;
|
|
7
|
+
category: string;
|
|
8
|
+
recommended: boolean;
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
schema: {
|
|
12
|
+
type: string;
|
|
13
|
+
properties: {
|
|
14
|
+
imports: {
|
|
15
|
+
type: string;
|
|
16
|
+
default: {};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
additionalProperties: boolean;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
create(context: any): any;
|
|
23
|
+
};
|
|
24
|
+
export = _default;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Rule to flag references to undeclared variables.
|
|
3
|
+
* @author Mark Macdonald
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
const jsx_1 = require("../util/jsx");
|
|
7
|
+
//------------------------------------------------------------------------------
|
|
8
|
+
// Helpers
|
|
9
|
+
//------------------------------------------------------------------------------
|
|
10
|
+
/**
|
|
11
|
+
* Checks if the given node is the argument of a typeof operator.
|
|
12
|
+
* @param {ASTNode} node The AST node being checked.
|
|
13
|
+
* @returns {boolean} Whether or not the node is the argument of a typeof operator.
|
|
14
|
+
*/
|
|
15
|
+
function hasTypeOfOperator(node) {
|
|
16
|
+
const { parent } = node;
|
|
17
|
+
return parent.type === 'UnaryExpression' && parent.operator === 'typeof';
|
|
18
|
+
}
|
|
19
|
+
//------------------------------------------------------------------------------
|
|
20
|
+
// Rule Definition
|
|
21
|
+
//------------------------------------------------------------------------------
|
|
22
|
+
const allowGlobals = false;
|
|
23
|
+
module.exports = {
|
|
24
|
+
meta: {
|
|
25
|
+
type: 'problem',
|
|
26
|
+
fixable: true,
|
|
27
|
+
docs: {
|
|
28
|
+
description: 'Automatically imports stuff that you specify',
|
|
29
|
+
category: 'Variables',
|
|
30
|
+
recommended: true,
|
|
31
|
+
url: 'https://eslint.org/docs/rules/no-undef',
|
|
32
|
+
},
|
|
33
|
+
schema: [
|
|
34
|
+
{
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
imports: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
default: {},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
create(context) {
|
|
47
|
+
const options = context.options[0] || {};
|
|
48
|
+
const considerTypeOf = (options && options.typeof === true) || false;
|
|
49
|
+
const map = options.imports || {};
|
|
50
|
+
function checkIdentifierInJSX(node) {
|
|
51
|
+
let scope = context.getScope();
|
|
52
|
+
const sourceCode = context.getSourceCode();
|
|
53
|
+
const { sourceType } = sourceCode.ast;
|
|
54
|
+
let { variables } = scope;
|
|
55
|
+
let scopeType = 'global';
|
|
56
|
+
let i;
|
|
57
|
+
let len;
|
|
58
|
+
// Ignore 'this' keyword (also maked as JSXIdentifier when used in JSX)
|
|
59
|
+
if (node.name === 'this') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!allowGlobals && sourceType === 'module') {
|
|
63
|
+
scopeType = 'module';
|
|
64
|
+
}
|
|
65
|
+
while (scope.type !== scopeType) {
|
|
66
|
+
scope = scope.upper;
|
|
67
|
+
variables = scope.variables.concat(variables);
|
|
68
|
+
}
|
|
69
|
+
if (scope.childScopes.length) {
|
|
70
|
+
variables = scope.childScopes[0].variables.concat(variables);
|
|
71
|
+
// Temporary fix for babel-eslint
|
|
72
|
+
if (scope.childScopes[0].childScopes.length) {
|
|
73
|
+
variables =
|
|
74
|
+
scope.childScopes[0].childScopes[0].variables.concat(variables);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
for (i = 0, len = variables.length; i < len; i++) {
|
|
78
|
+
if (variables[i].name === node.name) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const fixable = Boolean(map[node.name]);
|
|
83
|
+
if (fixable) {
|
|
84
|
+
context.report({
|
|
85
|
+
node,
|
|
86
|
+
message: [
|
|
87
|
+
`'${node.name}' is not defined.`,
|
|
88
|
+
`Run --fix to add \`${map[node.name]}\``,
|
|
89
|
+
]
|
|
90
|
+
.filter(Boolean)
|
|
91
|
+
.join(' '),
|
|
92
|
+
...(map[node.name]
|
|
93
|
+
? {
|
|
94
|
+
fix: (fixer) => {
|
|
95
|
+
return fixer.insertTextBefore(sourceCode.ast, map[node.name] + '\n');
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
: {}),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
JSXOpeningElement(node) {
|
|
104
|
+
switch (node.name.type) {
|
|
105
|
+
case 'JSXIdentifier':
|
|
106
|
+
if ((0, jsx_1.isDOMComponent)(node)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
node = node.name;
|
|
110
|
+
break;
|
|
111
|
+
case 'JSXMemberExpression':
|
|
112
|
+
node = node.name;
|
|
113
|
+
do {
|
|
114
|
+
node = node.object;
|
|
115
|
+
} while (node && node.type !== 'JSXIdentifier');
|
|
116
|
+
break;
|
|
117
|
+
case 'JSXNamespacedName':
|
|
118
|
+
node = node.name.namespace;
|
|
119
|
+
break;
|
|
120
|
+
default:
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
checkIdentifierInJSX(node);
|
|
124
|
+
},
|
|
125
|
+
'Program:exit'( /* node */) {
|
|
126
|
+
const globalScope = context.getScope();
|
|
127
|
+
const sourceCode = context.getSourceCode();
|
|
128
|
+
if (Object.keys(map).length === 0) {
|
|
129
|
+
context.report({
|
|
130
|
+
node: sourceCode.ast,
|
|
131
|
+
data: sourceCode.ast,
|
|
132
|
+
message: 'Rule tenx/auto-import is enabled but there are no replacements specified. Get started by specifying an object as an option to the ESLint rule: ["error", {imports: {sortBy: `import sortBy from "lodash/sortBy"`}}]',
|
|
133
|
+
});
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
globalScope.through.forEach((ref) => {
|
|
137
|
+
const { identifier } = ref;
|
|
138
|
+
if (!considerTypeOf && hasTypeOfOperator(identifier)) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const fixable = Boolean(map[identifier.name]);
|
|
142
|
+
if (fixable) {
|
|
143
|
+
context.report({
|
|
144
|
+
node: identifier,
|
|
145
|
+
data: identifier,
|
|
146
|
+
message: [
|
|
147
|
+
`'${identifier.name}' is not defined.`,
|
|
148
|
+
`Run --fix to add \`${map[identifier.name]}\``,
|
|
149
|
+
]
|
|
150
|
+
.filter(Boolean)
|
|
151
|
+
.join(' '),
|
|
152
|
+
...(fixable
|
|
153
|
+
? {
|
|
154
|
+
fix: (fixer) => {
|
|
155
|
+
return fixer.insertTextBefore(sourceCode.ast, map[identifier.name] + '\n');
|
|
156
|
+
},
|
|
157
|
+
}
|
|
158
|
+
: {}),
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
};
|
package/package.json
CHANGED