@remotion/eslint-config 4.0.176 → 4.0.178
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/README.md +18 -0
- package/dist/patch-eslint.js +44 -31
- package/package.json +8 -8
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @remotion/eslint-config
|
|
2
|
+
|
|
3
|
+
Default configuration for Remotion templates
|
|
4
|
+
|
|
5
|
+
[](https://npmcharts.com/compare/@remotion/eslint-config?minimal=true)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @remotion/eslint-config --save-exact
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
When installing a Remotion package, make sure to align the version of all `remotion` and `@remotion/*` packages to the same version.
|
|
14
|
+
Remove the `^` character from the version number to use the exact version.
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
See the [documentation](https://www.remotion.dev/docs/brownfield#install-the-eslint-plugin) for more information.
|
package/dist/patch-eslint.js
CHANGED
|
@@ -37,25 +37,27 @@ const allowESLintShareableConfig = () => {
|
|
|
37
37
|
// Probe for the ESLint >=8.0.0 layout:
|
|
38
38
|
for (let currentModule = module;;) {
|
|
39
39
|
if (!eslintrcBundlePath) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
if (currentModule.filename.endsWith('eslintrc.cjs')) {
|
|
41
|
+
// For ESLint >=8.0.0, all @eslint/eslintrc code is bundled at this path:
|
|
42
|
+
// .../@eslint/eslintrc/dist/eslintrc.cjs
|
|
43
|
+
try {
|
|
44
|
+
const eslintrcFolderPath = path_1.default.dirname(require.resolve("@eslint/eslintrc/package.json", {
|
|
45
|
+
paths: [currentModule.path],
|
|
46
|
+
}));
|
|
47
|
+
// Make sure we actually resolved the module in our call path
|
|
48
|
+
// and not some other spurious dependency.
|
|
49
|
+
const resolvedEslintrcBundlePath = path_1.default.join(eslintrcFolderPath, 'dist/eslintrc.cjs');
|
|
50
|
+
if (resolvedEslintrcBundlePath === currentModule.filename) {
|
|
51
|
+
eslintrcBundlePath = resolvedEslintrcBundlePath;
|
|
52
|
+
}
|
|
51
53
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
catch (ex) {
|
|
55
|
+
// Module resolution failures are expected, as we're walking
|
|
56
|
+
// up our require stack to look for eslint. All other errors
|
|
57
|
+
// are rethrown.
|
|
58
|
+
if (!isModuleResolutionError(ex)) {
|
|
59
|
+
throw ex;
|
|
60
|
+
}
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -68,8 +70,19 @@ const allowESLintShareableConfig = () => {
|
|
|
68
70
|
}));
|
|
69
71
|
// Make sure we actually resolved the module in our call path
|
|
70
72
|
// and not some other spurious dependency.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
// 1. VS Code's eslint extension uses eslint/use-at-your-own-risk when you
|
|
74
|
+
// turn on flat config
|
|
75
|
+
// 2. eslint's use-at-your-own-risk maps to lib/unsupported-api.js
|
|
76
|
+
// 3. lib/unsupported-api.js loads lib/cli-engine/file-enumerator.js, not
|
|
77
|
+
// lib/cli-engine/cli-engine.js
|
|
78
|
+
// 4. eslint-patch prior to this change specifically searched for
|
|
79
|
+
// lib/cli-engine/cli-engine.js in the import stack, and if it wasn't
|
|
80
|
+
// found, it would assume an older version of eslint, and that would cause
|
|
81
|
+
// an error
|
|
82
|
+
// Below change allows for any file inside the eslint package to count,
|
|
83
|
+
// allowing VS Code's eslint extension to work when you use eslint's flat
|
|
84
|
+
// config
|
|
85
|
+
if (currentModule.filename.startsWith(eslintCandidateFolder + path_1.default.sep)) {
|
|
73
86
|
eslintFolder = eslintCandidateFolder;
|
|
74
87
|
break;
|
|
75
88
|
}
|
|
@@ -89,10 +102,10 @@ const allowESLintShareableConfig = () => {
|
|
|
89
102
|
currentModule = currentModule.parent;
|
|
90
103
|
}
|
|
91
104
|
if (!eslintFolder) {
|
|
92
|
-
// Probe for the ESLint >=7.
|
|
105
|
+
// Probe for the ESLint >=7.12.0 layout:
|
|
93
106
|
for (let currentModule = module;;) {
|
|
94
107
|
if (!configArrayFactoryPath) {
|
|
95
|
-
// For ESLint >=7.
|
|
108
|
+
// For ESLint >=7.12.0, config-array-factory.js is at this path:
|
|
96
109
|
// .../@eslint/eslintrc/lib/config-array-factory.js
|
|
97
110
|
try {
|
|
98
111
|
const eslintrcFolder = path_1.default.dirname(require.resolve("@eslint/eslintrc/package.json", {
|
|
@@ -113,7 +126,7 @@ const allowESLintShareableConfig = () => {
|
|
|
113
126
|
}
|
|
114
127
|
}
|
|
115
128
|
}
|
|
116
|
-
else {
|
|
129
|
+
else if (currentModule.filename.endsWith('cli-engine.js')) {
|
|
117
130
|
// Next look for a file in ESLint's folder
|
|
118
131
|
// .../eslint/lib/cli-engine/cli-engine.js
|
|
119
132
|
try {
|
|
@@ -142,9 +155,9 @@ const allowESLintShareableConfig = () => {
|
|
|
142
155
|
}
|
|
143
156
|
}
|
|
144
157
|
if (!eslintFolder) {
|
|
145
|
-
// Probe for the <7.
|
|
158
|
+
// Probe for the <7.12.0 layout:
|
|
146
159
|
for (let currentModule = module;;) {
|
|
147
|
-
// For ESLint <7.
|
|
160
|
+
// For ESLint <7.12.0, config-array-factory.js was at this path:
|
|
148
161
|
// .../eslint/lib/cli-engine/config-array-factory.js
|
|
149
162
|
if (/[\\/]eslint[\\/]lib[\\/]cli-engine[\\/]config-array-factory\.js$/i.test(currentModule.filename)) {
|
|
150
163
|
eslintFolder = path_1.default.join(path_1.default.dirname(currentModule.filename), "../..");
|
|
@@ -156,7 +169,7 @@ const allowESLintShareableConfig = () => {
|
|
|
156
169
|
// This was tested with ESLint 6.1.0 .. 7.12.1.
|
|
157
170
|
throw new Error("Failed to patch ESLint because the calling module was not recognized.\n" +
|
|
158
171
|
"If you are using a newer ESLint version that may be unsupported, please create a GitHub issue:\n" +
|
|
159
|
-
"https://github.com/
|
|
172
|
+
"https://github.com/remotion-dev/remotion/issues");
|
|
160
173
|
}
|
|
161
174
|
currentModule = currentModule.parent;
|
|
162
175
|
}
|
|
@@ -172,14 +185,14 @@ const allowESLintShareableConfig = () => {
|
|
|
172
185
|
throw new Error("Unable to parse ESLint version: " + eslintPackageVersion);
|
|
173
186
|
}
|
|
174
187
|
const eslintMajorVersion = Number(versionMatch[1]);
|
|
175
|
-
if (!(eslintMajorVersion >= 6 && eslintMajorVersion <=
|
|
176
|
-
throw new Error("The patch-eslint.js script has only been tested with ESLint version 6.x, 7.x, and 8.x." +
|
|
188
|
+
if (!(eslintMajorVersion >= 6 && eslintMajorVersion <= 9)) {
|
|
189
|
+
throw new Error("The patch-eslint.js script has only been tested with ESLint version 6.x, 7.x, and 8.x, and 9.x." +
|
|
177
190
|
` (Your version: ${eslintPackageVersion})\n` +
|
|
178
191
|
"Consider reporting a GitHub issue:\n" +
|
|
179
|
-
"https://github.com/
|
|
192
|
+
"https://github.com/remotion-dev/remotion/issues");
|
|
180
193
|
}
|
|
181
194
|
let ConfigArrayFactory;
|
|
182
|
-
if (eslintMajorVersion
|
|
195
|
+
if (eslintMajorVersion >= 8) {
|
|
183
196
|
ConfigArrayFactory = require(eslintrcBundlePath).Legacy.ConfigArrayFactory;
|
|
184
197
|
}
|
|
185
198
|
else {
|
|
@@ -188,7 +201,7 @@ const allowESLintShareableConfig = () => {
|
|
|
188
201
|
if (!ConfigArrayFactory.__patched) {
|
|
189
202
|
ConfigArrayFactory.__patched = true;
|
|
190
203
|
let ModuleResolver;
|
|
191
|
-
if (eslintMajorVersion
|
|
204
|
+
if (eslintMajorVersion >= 8) {
|
|
192
205
|
ModuleResolver = require(eslintrcBundlePath).Legacy.ModuleResolver;
|
|
193
206
|
}
|
|
194
207
|
else {
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"repository": {
|
|
3
|
+
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/eslint-config"
|
|
4
|
+
},
|
|
2
5
|
"name": "@remotion/eslint-config",
|
|
3
|
-
"version": "4.0.
|
|
4
|
-
"description": "",
|
|
6
|
+
"version": "4.0.178",
|
|
7
|
+
"description": "Default configuration for Remotion templates",
|
|
5
8
|
"main": "dist/index.js",
|
|
6
9
|
"files": [
|
|
7
10
|
"dist"
|
|
@@ -17,15 +20,11 @@
|
|
|
17
20
|
"eslint-plugin-10x": "1.5.2",
|
|
18
21
|
"eslint-plugin-react": "7.32.2",
|
|
19
22
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
20
|
-
"@remotion/eslint-plugin": "4.0.
|
|
23
|
+
"@remotion/eslint-plugin": "4.0.178"
|
|
21
24
|
},
|
|
22
25
|
"peerDependencies": {
|
|
23
26
|
"eslint": ">=7.15.0"
|
|
24
27
|
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@types/node": "18.14.6",
|
|
27
|
-
"eslint": "8.56.0"
|
|
28
|
-
},
|
|
29
28
|
"keywords": [
|
|
30
29
|
"remotion",
|
|
31
30
|
"ffmpeg",
|
|
@@ -35,5 +34,6 @@
|
|
|
35
34
|
],
|
|
36
35
|
"publishConfig": {
|
|
37
36
|
"access": "public"
|
|
38
|
-
}
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://www.remotion.dev/docs/brownfield#install-the-eslint-plugin"
|
|
39
39
|
}
|