Skip to content

Commit 006c128

Browse files
authored
Merge pull request #21236 from marcofugaro/eslint-class-properties-fix
Eslint: add support for class properties
2 parents 0ed7a89 + 3bef980 commit 006c128

File tree

4 files changed

+66
-36
lines changed

4 files changed

+66
-36
lines changed

package-lock.json

Lines changed: 36 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
"test": "test"
2727
},
2828
"eslintConfig": {
29+
"parser": "@babel/eslint-parser",
30+
"parserOptions": {
31+
"babelOptions": {
32+
"configFile": "./utils/build/babel.config.json"
33+
}
34+
},
2935
"root": true,
3036
"extends": "mdcs",
3137
"plugins": [
@@ -83,6 +89,7 @@
8389
"homepage": "https://threejs.org/",
8490
"devDependencies": {
8591
"@babel/core": "^7.12.10",
92+
"@babel/eslint-parser": "^7.12.13",
8693
"@babel/plugin-proposal-class-properties": "^7.12.1",
8794
"@babel/preset-env": "^7.12.11",
8895
"@rollup/plugin-babel": "^5.2.2",
@@ -107,4 +114,4 @@
107114
],
108115
"directories": {}
109116
}
110-
}
117+
}

utils/build/babel.config.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"modules": false,
7+
"targets": ">0.3%, not dead",
8+
"loose": true,
9+
"bugfixes": true
10+
}
11+
]
12+
],
13+
"plugins": [
14+
[
15+
"@babel/plugin-proposal-class-properties",
16+
{
17+
"loose": true
18+
}
19+
]
20+
]
21+
}

utils/build/rollup.config.js

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
import babel from '@rollup/plugin-babel';
22
import { nodeResolve } from '@rollup/plugin-node-resolve';
33
import { terser } from 'rollup-plugin-terser';
4-
5-
if ( String.prototype.replaceAll === undefined ) {
6-
7-
String.prototype.replaceAll = function ( find, replace ) {
8-
9-
return this.split( find ).join( replace );
10-
11-
};
12-
13-
}
4+
import babelrc from './babel.config.json';
145

156
function glconstants() {
167

@@ -294,30 +285,6 @@ function polyfills() {
294285

295286
}
296287

297-
const babelrc = {
298-
presets: [
299-
[
300-
'@babel/preset-env',
301-
{
302-
modules: false,
303-
// the supported browsers of the three.js browser bundle
304-
// https://browsersl.ist/?q=%3E0.3%25%2C+not+dead
305-
targets: '>0.3%, not dead',
306-
loose: true,
307-
bugfixes: true,
308-
},
309-
],
310-
],
311-
plugins: [
312-
[
313-
'@babel/plugin-proposal-class-properties',
314-
{
315-
loose: true
316-
}
317-
]
318-
]
319-
};
320-
321288
export default [
322289
{
323290
input: 'src/Three.js',

0 commit comments

Comments
 (0)