@remotion/eslint-plugin 4.0.255 → 4.0.257

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.255",
6
+ "version": "4.0.257",
7
7
  "description": "Rules for writing Remotion code",
8
8
  "main": "dist/index.js",
9
9
  "bugs": {
@@ -11,9 +11,7 @@
11
11
  },
12
12
  "author": "Jonny Burger <jonny@remotion.dev>",
13
13
  "license": "ISC",
14
- "dependencies": {
15
- "@typescript-eslint/utils": "5.19.0"
16
- },
14
+ "dependencies": {},
17
15
  "keywords": [
18
16
  "eslint",
19
17
  "eslintplugin"
@@ -22,12 +20,22 @@
22
20
  "eslint": ">=7.0.0"
23
21
  },
24
22
  "devDependencies": {
23
+ "@typescript-eslint/utils": "5.19.0",
25
24
  "vitest": "0.31.1"
26
25
  },
26
+ "exports": {
27
+ ".": {
28
+ "import": "./dist/esm/index.mjs",
29
+ "module": "./dist/esm/index.mjs",
30
+ "require": "./dist/cjs/index.js",
31
+ "types": "./dist/index.d.ts"
32
+ },
33
+ "./package.json": "./package.json"
34
+ },
27
35
  "private": false,
28
36
  "homepage": "https://www.remotion.dev/docs/brownfield#install-the-eslint-plugin",
29
37
  "scripts": {
30
38
  "test": "vitest --run",
31
- "make": "tsc -d"
39
+ "make": "tsc -d && bun --env-file=../.env.bundle bundle.ts"
32
40
  }
33
41
  }
@@ -1,24 +0,0 @@
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;
@@ -1,165 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- declare const rule: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"NoMP4Import", [], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
2
- export default rule;
@@ -1,61 +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 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
- const rule = createRule({
9
- name: 'no-mp4-import',
10
- meta: {
11
- type: 'problem',
12
- docs: {
13
- description: NoMP4Import,
14
- recommended: 'warn',
15
- },
16
- fixable: undefined,
17
- schema: [],
18
- messages: {
19
- NoMP4Import,
20
- },
21
- },
22
- defaultOptions: [],
23
- create: (context) => {
24
- return {
25
- ImportDeclaration: (node) => {
26
- if (node.source.raw.includes('.mp4')) {
27
- context.report({
28
- messageId: 'NoMP4Import',
29
- node,
30
- });
31
- }
32
- },
33
- CallExpression: (node) => {
34
- var _a, _b, _c, _d;
35
- // @ts-expect-error
36
- if (node.callee.name !== 'require') {
37
- return;
38
- }
39
- // @ts-expect-error
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
- if (!firstArgument) {
42
- const sourceCode = context.getSourceCode().getText(node);
43
- if (sourceCode.includes('.mp4')) {
44
- context.report({
45
- messageId: 'NoMP4Import',
46
- node,
47
- });
48
- }
49
- return;
50
- }
51
- if (firstArgument.includes('.mp4')) {
52
- context.report({
53
- messageId: 'NoMP4Import',
54
- node,
55
- });
56
- }
57
- },
58
- };
59
- },
60
- });
61
- exports.default = rule;