diff --git a/.babelrc b/.babelrc index ded830aa4d..dc32fa352c 100644 --- a/.babelrc +++ b/.babelrc @@ -1,11 +1,6 @@ { "presets": [ - ["@babel/preset-env", { - "targets": { - "browsers": "defaults and supports webgl2" - }, - "modules": false - }] + ["@babel/preset-typescript"] ], "plugins": [ ["module-resolver", { "root": ["./src"] } ], @@ -17,9 +12,11 @@ ".css" ] }], - ["module-extension-resolver"], - ["@babel/plugin-transform-runtime", { - "regenerator": false + ["module-extension-resolver", { + "srcExtensions": [ + ".ts", + ".js" + ] }], ["minify-replace", { "replacements": [{ diff --git a/.eslintrc.cjs b/.eslintrc.cjs index c2544517f6..7bedc41bc4 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,11 +1,16 @@ module.exports = { root: true, + plugins: [ + '@typescript-eslint', + ], + parser: '@typescript-eslint/parser', extends: [ 'eslint-config-airbnb-base', 'eslint-config-airbnb-base/rules/strict', + 'plugin:@typescript-eslint/recommended', ], parserOptions: { - ecmaVersion: 13, + ecmaVersion: 2023, sourceType: 'module', ecmaFeatures: { impliedStrict: true, @@ -13,8 +18,8 @@ module.exports = { }, settings: { 'import/resolver': { - webpack: { - config: './webpack.config.cjs', + 'babel-module': { + extensions: ['.js', '.ts'], }, }, }, @@ -25,9 +30,22 @@ module.exports = { commonjs: true, }, rules: { + 'import/extensions': [ + 'off', + ], 'no-trailing-spaces': 'warn', 'padded-blocks': 'warn', - 'no-unused-vars': 'warn', + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], + '@typescript-eslint/no-this-alias': 'off', + '@typescript-eslint/no-explicit-any': 'off', 'no-plusplus': 'off', // this option sets a specific tab width for your code // http://eslint.org/docs/rules/indent @@ -108,6 +126,18 @@ module.exports = { // change default-param-last to on, but there are several breaking changes or default params to add. 'default-param-last': 'off', }, + overrides: [ + { + files: ['*.ts'], + rules: { + 'valid-jsdoc': 'off', + '@typescript-eslint/explicit-function-return-type': [ + 'error', + { allowExpressions: true }, + ], + }, + }, + ], globals: { __DEBUG__: false, }, diff --git a/.gitignore b/.gitignore index 5ebc710462..0de7c2761b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ potree coverage .nyc_output/ /src/ThreeExtended/ +types/ diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 0000000000..001ec6fbf8 --- /dev/null +++ b/babel.config.json @@ -0,0 +1,5 @@ +{ + "babelrcRoots": [ + "." + ] +} diff --git a/examples/effects_postprocessing.html b/examples/effects_postprocessing.html index b00f52c593..41827ae382 100644 --- a/examples/effects_postprocessing.html +++ b/examples/effects_postprocessing.html @@ -1,113 +1,160 @@ -
-