Upgrade to eslint 9
This commit is contained in:
parent
8e2141eac5
commit
1a89ae70eb
|
@ -74,37 +74,6 @@ repos:
|
||||||
# files: ^(doc/classes|.*/doc_classes)/.*\.xml$
|
# files: ^(doc/classes|.*/doc_classes)/.*\.xml$
|
||||||
# args: [--schema, doc/class.xsd]
|
# args: [--schema, doc/class.xsd]
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
|
||||||
rev: v8.46.0
|
|
||||||
hooks:
|
|
||||||
- id: eslint
|
|
||||||
name: eslint-engine
|
|
||||||
files: ^(platform/web/js/engine/|js/jsdoc2rst/).*\.js$
|
|
||||||
args: [--fix, --no-eslintrc, --config, platform/web/.eslintrc.engine.js]
|
|
||||||
additional_dependencies: &eslint-deps
|
|
||||||
- eslint@8.46.0
|
|
||||||
- eslint-config-airbnb-base@15.0.0
|
|
||||||
- eslint-plugin-import@2.28.0
|
|
||||||
- eslint-plugin-html@7.1.0
|
|
||||||
- '@html-eslint/eslint-plugin@0.19.1'
|
|
||||||
- '@html-eslint/parser@0.19.1'
|
|
||||||
- id: eslint
|
|
||||||
name: eslint-libs
|
|
||||||
files: ^(platform/web/js/libs/|modules/).*\.js$
|
|
||||||
args: [--fix, --no-eslintrc, --config, platform/web/.eslintrc.libs.js]
|
|
||||||
additional_dependencies: *eslint-deps
|
|
||||||
- id: eslint
|
|
||||||
name: eslint-sw
|
|
||||||
files: ^misc/dist/html/service-worker\.js$
|
|
||||||
args: [--fix, --no-eslintrc, --config, platform/web/.eslintrc.sw.js]
|
|
||||||
additional_dependencies: *eslint-deps
|
|
||||||
- id: eslint
|
|
||||||
name: eslint-html
|
|
||||||
files: ^misc/dist/html/.*\.html$
|
|
||||||
types: [html]
|
|
||||||
args: [--fix, --no-eslintrc, --config, platform/web/.eslintrc.html.js]
|
|
||||||
additional_dependencies: *eslint-deps
|
|
||||||
|
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: make-rst
|
- id: make-rst
|
||||||
|
@ -120,6 +89,22 @@ repos:
|
||||||
entry: python3 doc/tools/doc_status.py
|
entry: python3 doc/tools/doc_status.py
|
||||||
files: ^(doc/classes|.*/doc_classes)/.*\.xml$
|
files: ^(doc/classes|.*/doc_classes)/.*\.xml$
|
||||||
|
|
||||||
|
- id: eslint
|
||||||
|
name: eslint
|
||||||
|
language: node
|
||||||
|
entry: eslint
|
||||||
|
files: ^(platform/web/js/|modules/|misc/dist/html/).*\.(js|html)$
|
||||||
|
args: [--fix, --no-warn-ignored, --no-config-lookup, --config, platform/web/eslint.config.cjs]
|
||||||
|
additional_dependencies:
|
||||||
|
- '@eslint/js@^9.3.0'
|
||||||
|
- '@html-eslint/eslint-plugin@^0.24.1'
|
||||||
|
- '@html-eslint/parser@^0.24.1'
|
||||||
|
- '@stylistic/eslint-plugin@^2.1.0'
|
||||||
|
- 'eslint@^9.3.0'
|
||||||
|
- 'eslint-plugin-html@^8.1.1'
|
||||||
|
- 'globals@^15.3.0'
|
||||||
|
- 'espree@^10.0.1'
|
||||||
|
|
||||||
- id: jsdoc
|
- id: jsdoc
|
||||||
name: jsdoc
|
name: jsdoc
|
||||||
language: node
|
language: node
|
||||||
|
|
|
@ -160,8 +160,6 @@ self.addEventListener('message', (event) => {
|
||||||
caches.delete(CACHE_NAME);
|
caches.delete(CACHE_NAME);
|
||||||
} else if (msg === 'update') {
|
} else if (msg === 'update') {
|
||||||
self.skipWaiting().then(() => self.clients.claim()).then(() => self.clients.matchAll()).then((all) => all.forEach((c) => c.navigate(c.url)));
|
self.skipWaiting().then(() => self.clients.claim()).then(() => self.clients.matchAll()).then((all) => all.forEach((c) => c.navigate(c.url)));
|
||||||
} else {
|
|
||||||
onClientMessage(event);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -67,7 +67,8 @@ const GodotWebXR = {
|
||||||
GodotWebXR.orig_requestAnimationFrame = Browser.requestAnimationFrame;
|
GodotWebXR.orig_requestAnimationFrame = Browser.requestAnimationFrame;
|
||||||
}
|
}
|
||||||
Browser.requestAnimationFrame = enable
|
Browser.requestAnimationFrame = enable
|
||||||
? GodotWebXR.requestAnimationFrame : GodotWebXR.orig_requestAnimationFrame;
|
? GodotWebXR.requestAnimationFrame
|
||||||
|
: GodotWebXR.orig_requestAnimationFrame;
|
||||||
},
|
},
|
||||||
pauseResumeMainLoop: () => {
|
pauseResumeMainLoop: () => {
|
||||||
// Once both GodotWebXR.session and GodotWebXR.space are set or
|
// Once both GodotWebXR.session and GodotWebXR.space are set or
|
||||||
|
@ -76,9 +77,9 @@ const GodotWebXR = {
|
||||||
// gets picked up automatically, however, in the Oculus Browser
|
// gets picked up automatically, however, in the Oculus Browser
|
||||||
// on the Quest, we need to pause and resume the main loop.
|
// on the Quest, we need to pause and resume the main loop.
|
||||||
Browser.mainLoop.pause();
|
Browser.mainLoop.pause();
|
||||||
runtimeKeepalivePush(); // eslint-disable-line no-undef
|
runtimeKeepalivePush();
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
runtimeKeepalivePop(); // eslint-disable-line no-undef
|
runtimeKeepalivePop();
|
||||||
Browser.mainLoop.resume();
|
Browser.mainLoop.resume();
|
||||||
}, 0);
|
}, 0);
|
||||||
},
|
},
|
||||||
|
@ -287,12 +288,12 @@ const GodotWebXR = {
|
||||||
// Store onsimpleevent so we can use it later.
|
// Store onsimpleevent so we can use it later.
|
||||||
GodotWebXR.onsimpleevent = onsimpleevent;
|
GodotWebXR.onsimpleevent = onsimpleevent;
|
||||||
|
|
||||||
const gl_context_handle = _emscripten_webgl_get_current_context(); // eslint-disable-line no-undef
|
const gl_context_handle = _emscripten_webgl_get_current_context();
|
||||||
const gl = GL.getContext(gl_context_handle).GLctx;
|
const gl = GL.getContext(gl_context_handle).GLctx;
|
||||||
GodotWebXR.gl = gl;
|
GodotWebXR.gl = gl;
|
||||||
|
|
||||||
gl.makeXRCompatible().then(function () {
|
gl.makeXRCompatible().then(function () {
|
||||||
GodotWebXR.gl_binding = new XRWebGLBinding(session, gl); // eslint-disable-line no-undef
|
GodotWebXR.gl_binding = new XRWebGLBinding(session, gl);
|
||||||
|
|
||||||
// This will trigger the layer to get created.
|
// This will trigger the layer to get created.
|
||||||
GodotWebXR.getLayer();
|
GodotWebXR.getLayer();
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
"extends": [
|
|
||||||
"./.eslintrc.js",
|
|
||||||
],
|
|
||||||
"globals": {
|
|
||||||
"InternalConfig": true,
|
|
||||||
"Godot": true,
|
|
||||||
"Features": true,
|
|
||||||
"Preloader": true,
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1,21 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
"plugins": [
|
|
||||||
"html",
|
|
||||||
"@html-eslint",
|
|
||||||
],
|
|
||||||
"parser": "@html-eslint/parser",
|
|
||||||
"extends": ["plugin:@html-eslint/recommended", "./.eslintrc.js"],
|
|
||||||
"rules": {
|
|
||||||
"no-alert": "off",
|
|
||||||
"no-console": "off",
|
|
||||||
"@html-eslint/require-closing-tags": ["error", { "selfClosing": "never" }],
|
|
||||||
"@html-eslint/indent": ["error", "tab"],
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"Godot": true,
|
|
||||||
"Engine": true,
|
|
||||||
"$GODOT_CONFIG": true,
|
|
||||||
"$GODOT_THREADS_ENABLED": true,
|
|
||||||
"___GODOT_THREADS_ENABLED___": true,
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1,51 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"es2021": true,
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"airbnb-base",
|
|
||||||
],
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 12,
|
|
||||||
},
|
|
||||||
"ignorePatterns": "*.externs.js",
|
|
||||||
"rules": {
|
|
||||||
"func-names": "off",
|
|
||||||
// Use tabs for consistency with the C++ codebase.
|
|
||||||
"indent": ["error", "tab"],
|
|
||||||
"max-len": "off",
|
|
||||||
"no-else-return": ["error", {allowElseIf: true}],
|
|
||||||
"curly": ["error", "all"],
|
|
||||||
"brace-style": ["error", "1tbs", { "allowSingleLine": false }],
|
|
||||||
"no-bitwise": "off",
|
|
||||||
"no-continue": "off",
|
|
||||||
"no-self-assign": "off",
|
|
||||||
"no-tabs": "off",
|
|
||||||
"no-param-reassign": ["error", { "props": false }],
|
|
||||||
"no-plusplus": "off",
|
|
||||||
"no-unused-vars": ["error", { "args": "none" }],
|
|
||||||
"prefer-destructuring": "off",
|
|
||||||
"prefer-rest-params": "off",
|
|
||||||
"prefer-spread": "off",
|
|
||||||
"camelcase": "off",
|
|
||||||
"no-underscore-dangle": "off",
|
|
||||||
"max-classes-per-file": "off",
|
|
||||||
"prefer-arrow-callback": "off",
|
|
||||||
// Messes up with copyright headers in source files.
|
|
||||||
"spaced-comment": "off",
|
|
||||||
// Completely breaks emscripten libraries.
|
|
||||||
"object-shorthand": "off",
|
|
||||||
// Closure compiler (exported properties)
|
|
||||||
"quote-props": ["error", "consistent"],
|
|
||||||
"dot-notation": "off",
|
|
||||||
// No comma dangle for functions (it's madness, and ES2017)
|
|
||||||
"comma-dangle": ["error", {
|
|
||||||
"arrays": "always-multiline",
|
|
||||||
"objects": "always-multiline",
|
|
||||||
"imports": "always-multiline",
|
|
||||||
"exports": "always-multiline",
|
|
||||||
"functions": "never"
|
|
||||||
}],
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,26 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
"extends": [
|
|
||||||
"./.eslintrc.js",
|
|
||||||
],
|
|
||||||
"globals": {
|
|
||||||
"LibraryManager": true,
|
|
||||||
"mergeInto": true,
|
|
||||||
"autoAddDeps": true,
|
|
||||||
"HEAP8": true,
|
|
||||||
"HEAPU8": true,
|
|
||||||
"HEAP32": true,
|
|
||||||
"HEAPF32": true,
|
|
||||||
"ERRNO_CODES": true,
|
|
||||||
"FS": true,
|
|
||||||
"IDBFS": true,
|
|
||||||
"GodotOS": true,
|
|
||||||
"GodotConfig": true,
|
|
||||||
"GodotEventListeners": true,
|
|
||||||
"GodotRuntime": true,
|
|
||||||
"GodotFS": true,
|
|
||||||
"IDHandler": true,
|
|
||||||
"Browser": true,
|
|
||||||
"GL": true,
|
|
||||||
"XRWebGLLayer": true,
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1,14 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
"extends": [
|
|
||||||
"./.eslintrc.js",
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"no-restricted-globals": 0,
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"onClientMessage": true,
|
|
||||||
"___GODOT_ENSURE_CROSSORIGIN_ISOLATION_HEADERS___": true,
|
|
||||||
"___GODOT_CACHE___": true,
|
|
||||||
"___GODOT_OPT_CACHE___": true,
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -0,0 +1,204 @@
|
||||||
|
const fs = require('fs');
|
||||||
|
const globals = require('globals');
|
||||||
|
const htmlParser = require('@html-eslint/parser');
|
||||||
|
const htmlPlugin = require('@html-eslint/eslint-plugin');
|
||||||
|
const pluginJs = require('@eslint/js');
|
||||||
|
const pluginReference = require('eslint-plugin-html');
|
||||||
|
const stylistic = require('@stylistic/eslint-plugin');
|
||||||
|
|
||||||
|
if (process && process.env && process.env.npm_command && !fs.existsSync('./platform/web/eslint.config.cjs')) {
|
||||||
|
throw Error('eslint must be run from the Godot project root folder');
|
||||||
|
}
|
||||||
|
|
||||||
|
const emscriptenGlobals = {
|
||||||
|
'Browser': true,
|
||||||
|
'ERRNO_CODES': true,
|
||||||
|
'FS': true,
|
||||||
|
'GL': true,
|
||||||
|
'HEAP32': true,
|
||||||
|
'HEAP8': true,
|
||||||
|
'HEAPF32': true,
|
||||||
|
'HEAPU8': true,
|
||||||
|
'IDBFS': true,
|
||||||
|
'LibraryManager': true,
|
||||||
|
'Module': true,
|
||||||
|
'UTF8ToString': true,
|
||||||
|
'_emscripten_webgl_get_current_context': true,
|
||||||
|
'_free': true,
|
||||||
|
'_malloc': true,
|
||||||
|
'autoAddDeps': true,
|
||||||
|
'getValue': true,
|
||||||
|
'lengthBytesUTF8': true,
|
||||||
|
'mergeInto': true,
|
||||||
|
'runtimeKeepalivePop': true,
|
||||||
|
'runtimeKeepalivePush': true,
|
||||||
|
'setValue': true,
|
||||||
|
'stringToUTF8': true,
|
||||||
|
'stringToUTF8Array': true,
|
||||||
|
'wasmTable': true,
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = [
|
||||||
|
pluginJs.configs.all,
|
||||||
|
stylistic.configs.customize({ jsx: false }),
|
||||||
|
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'consistent-this': ['error', 'me'], // enforce consistent naming when capturing the current execution context
|
||||||
|
'curly': ['error', 'all'], // enforce consistent brace style for all control statements
|
||||||
|
'no-else-return': ['error', { 'allowElseIf': true }], // disallow else blocks after return statements in if statements
|
||||||
|
'no-param-reassign': ['error', { 'props': false }], // disallow reassigning function parameters
|
||||||
|
'no-unused-vars': ['error', { 'args': 'none', 'caughtErrors': 'none' }], // disallow unused variables
|
||||||
|
|
||||||
|
'@stylistic/arrow-parens': ['error', 'always'], // enforces the consistent use of parentheses in arrow functions
|
||||||
|
'@stylistic/brace-style': ['error', '1tbs', { 'allowSingleLine': false }], // describes the placement of braces relative to their control statement and body
|
||||||
|
'@stylistic/comma-dangle': ['error', {
|
||||||
|
'arrays': 'always-multiline',
|
||||||
|
'objects': 'always-multiline',
|
||||||
|
'imports': 'always-multiline',
|
||||||
|
'exports': 'always-multiline',
|
||||||
|
'functions': 'never',
|
||||||
|
}], // enforces consistent use of trailing commas in object and array literals
|
||||||
|
'@stylistic/indent': ['error', 'tab', { 'SwitchCase': 0 }], // enforces a consistent indentation style
|
||||||
|
'@stylistic/indent-binary-ops': ['error', 'tab'], // indentation for binary operators in multiline expressions
|
||||||
|
'@stylistic/multiline-ternary': ['error', 'always-multiline'], // enforces or disallows newlines between operands of a ternary expression
|
||||||
|
'@stylistic/no-tabs': ['error', { 'allowIndentationTabs': true }], // looks for tabs anywhere inside a file: code, comments or anything else
|
||||||
|
'@stylistic/quote-props': ['error', 'consistent'], // requires quotes around object literal property names
|
||||||
|
'@stylistic/quotes': ['error', 'single'], // enforces the consistent use of either backticks, double, or single quotes
|
||||||
|
'@stylistic/semi': ['error', 'always'], // enforces consistent use of semicolons
|
||||||
|
'@stylistic/spaced-comment': ['error', 'always', { 'block': { 'exceptions': ['*'] } }], // enforce consistency of spacing after the start of a comment
|
||||||
|
|
||||||
|
'camelcase': 'off', // disable: camelcase naming convention
|
||||||
|
'capitalized-comments': 'off', // disable: enforce or disallow capitalization of the first letter of a comment
|
||||||
|
'complexity': 'off', // disable: enforce a maximum cyclomatic complexity allowed in a program
|
||||||
|
'dot-notation': 'off', // disable: enforce dot notation whenever possible
|
||||||
|
'eqeqeq': 'off', // disable: require the use of === and !==
|
||||||
|
'func-name-matching': 'off', // disable: require function names to match the name of the variable or property to which they are assigned
|
||||||
|
'func-names': 'off', // disable: checking named function expressions
|
||||||
|
'func-style': 'off', // disable: consistent use of either function declarations or expressions
|
||||||
|
'id-length': 'off', // disable: enforce minimum and maximum identifier lengths
|
||||||
|
'init-declarations': 'off', // disable: require or disallow initialization in variable declarations
|
||||||
|
'line-comment-position': 'off', // disable: enforce position of line comments
|
||||||
|
'max-classes-per-file': 'off', // disable: maximum number of classes per file
|
||||||
|
'max-lines': 'off', // disable: maximum number of lines per file
|
||||||
|
'max-lines-per-function': 'off', // disable: maximum number of lines of code in a function
|
||||||
|
'max-params': 'off', // disable: enforce a maximum number of parameters in function definitions
|
||||||
|
'max-statements': 'off', // disable: maximum number of statements allowed in function blocks
|
||||||
|
'multiline-comment-style': 'off', // disable: enforce a particular style for multiline comments
|
||||||
|
'new-cap': 'off', // disable: require constructor names to begin with a capital letter
|
||||||
|
'no-bitwise': 'off', // disable: disallow bitwise operators
|
||||||
|
'no-continue': 'off', // disable: disallow continue statements
|
||||||
|
'no-empty-function': 'off', // disable: disallow empty functions
|
||||||
|
'no-eq-null': 'off', // disable: disallow null comparisons without type-checking operators
|
||||||
|
'no-implicit-coercion': 'off', // disable: disallow shorthand type conversions
|
||||||
|
'no-inline-comments': 'off', // disable: disallow inline comments after code
|
||||||
|
'no-magic-numbers': 'off', // disable: disallow magic numbers
|
||||||
|
'no-negated-condition': 'off', // disable: disallow negated conditions
|
||||||
|
'no-plusplus': 'off', // disable: disallow the unary operators ++ and --
|
||||||
|
'no-self-assign': 'off', // disable: disallow assignments where both sides are exactly the same
|
||||||
|
'no-ternary': 'off', // disable: disallow ternary operators
|
||||||
|
'no-undefined': 'off', // disable: disallow the use of undefined as an identifier
|
||||||
|
'no-underscore-dangle': 'off', // disable: disallow dangling underscores in identifiers
|
||||||
|
'no-useless-assignment': 'off', // disable: disallow variable assignments when the value is not used
|
||||||
|
'no-warning-comments': 'off', // disable: disallow specified warning terms in comments
|
||||||
|
'object-shorthand': 'off', // disable: require or disallow method and property shorthand syntax for object literals
|
||||||
|
'one-var': 'off', // disable: enforce variables to be declared either together or separately in functions
|
||||||
|
'prefer-arrow-callback': 'off', // disable: require using arrow functions for callbacks
|
||||||
|
'prefer-destructuring': 'off', // disable: require destructuring from arrays and/or objects
|
||||||
|
'prefer-named-capture-group': 'off', // disable: enforce using named capture group in regular expression
|
||||||
|
'prefer-promise-reject-errors': 'off', // disable: require using Error objects as Promise rejection reasons
|
||||||
|
'prefer-rest-params': 'off', // disable: require rest parameters instead of arguments
|
||||||
|
'prefer-spread': 'off', // disable: require spread operators instead of .apply()
|
||||||
|
'require-unicode-regexp': 'off', // disable: enforce the use of u or v flag on RegExp
|
||||||
|
'sort-keys': 'off', // disable: require object keys to be sorted
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// jsdoc2rst (node)
|
||||||
|
{
|
||||||
|
files: ['js/jsdoc2rst/**/*.js', 'platform/web/js/jsdoc2rst/**/*.js'],
|
||||||
|
languageOptions: {
|
||||||
|
globals: globals.node,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// engine files (browser)
|
||||||
|
{
|
||||||
|
files: ['js/engine/**/*.js', 'platform/web/js/engine/**/*.js'],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
'Features': true,
|
||||||
|
'Godot': true,
|
||||||
|
'InternalConfig': true,
|
||||||
|
'Preloader': true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// libraries and modules (browser)
|
||||||
|
{
|
||||||
|
files: ['js/libs/**/*.js', 'platform/web/js/libs/**/*.js', 'modules/**/*.js'],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
...emscriptenGlobals,
|
||||||
|
'GodotConfig': true,
|
||||||
|
'GodotEventListeners': true,
|
||||||
|
'GodotFS': true,
|
||||||
|
'GodotOS': true,
|
||||||
|
'GodotRuntime': true,
|
||||||
|
'IDHandler': true,
|
||||||
|
'XRWebGLLayer': true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// javascript templates (service workers)
|
||||||
|
{
|
||||||
|
files: ['misc/dist/html/**/*.js'],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
'___GODOT_CACHE___': true,
|
||||||
|
'___GODOT_ENSURE_CROSSORIGIN_ISOLATION_HEADERS___': true,
|
||||||
|
'___GODOT_OPT_CACHE___': true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// html templates
|
||||||
|
{
|
||||||
|
files: ['misc/dist/html/**/*.html'],
|
||||||
|
plugins: {
|
||||||
|
'@html-eslint': htmlPlugin,
|
||||||
|
'eslint-plugin-html': pluginReference,
|
||||||
|
},
|
||||||
|
languageOptions: {
|
||||||
|
parser: htmlParser,
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
'Engine': true,
|
||||||
|
'$GODOT_CONFIG': true,
|
||||||
|
'$GODOT_PROJECT_NAME': true,
|
||||||
|
'$GODOT_THREADS_ENABLED': true,
|
||||||
|
'___GODOT_THREADS_ENABLED___': true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...htmlPlugin.configs.recommended.rules,
|
||||||
|
'@html-eslint/indent': ['error', 'tab'],
|
||||||
|
'@html-eslint/require-closing-tags': ['error', { 'selfClosing': 'never' }],
|
||||||
|
'no-alert': 'off',
|
||||||
|
'no-console': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
'**/eslint.config.cjs',
|
||||||
|
'**/.eslintrc*.js',
|
||||||
|
'**/*.externs.js',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
|
@ -1,4 +1,4 @@
|
||||||
const Features = { // eslint-disable-line no-unused-vars
|
const Features = {
|
||||||
/**
|
/**
|
||||||
* Check whether WebGL is available. Optionally, specify a particular version of WebGL to check for.
|
* Check whether WebGL is available. Optionally, specify a particular version of WebGL to check for.
|
||||||
*
|
*
|
||||||
|
|
|
@ -279,7 +279,7 @@ const GodotDisplayScreen = {
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
_updateGL: function () {
|
_updateGL: function () {
|
||||||
const gl_context_handle = _emscripten_webgl_get_current_context(); // eslint-disable-line no-undef
|
const gl_context_handle = _emscripten_webgl_get_current_context();
|
||||||
const gl = GL.getContext(gl_context_handle);
|
const gl = GL.getContext(gl_context_handle);
|
||||||
if (gl) {
|
if (gl) {
|
||||||
GL.resizeOffscreenFramebuffer(gl);
|
GL.resizeOffscreenFramebuffer(gl);
|
||||||
|
@ -392,19 +392,19 @@ const GodotDisplay = {
|
||||||
const func = GodotRuntime.get_func(p_callback);
|
const func = GodotRuntime.get_func(p_callback);
|
||||||
|
|
||||||
function listener_end(evt) {
|
function listener_end(evt) {
|
||||||
evt.currentTarget.cb(1 /*TTS_UTTERANCE_ENDED*/, evt.currentTarget.id, 0);
|
evt.currentTarget.cb(1 /* TTS_UTTERANCE_ENDED */, evt.currentTarget.id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function listener_start(evt) {
|
function listener_start(evt) {
|
||||||
evt.currentTarget.cb(0 /*TTS_UTTERANCE_STARTED*/, evt.currentTarget.id, 0);
|
evt.currentTarget.cb(0 /* TTS_UTTERANCE_STARTED */, evt.currentTarget.id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function listener_error(evt) {
|
function listener_error(evt) {
|
||||||
evt.currentTarget.cb(2 /*TTS_UTTERANCE_CANCELED*/, evt.currentTarget.id, 0);
|
evt.currentTarget.cb(2 /* TTS_UTTERANCE_CANCELED */, evt.currentTarget.id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function listener_bound(evt) {
|
function listener_bound(evt) {
|
||||||
evt.currentTarget.cb(3 /*TTS_UTTERANCE_BOUNDARY*/, evt.currentTarget.id, evt.charIndex);
|
evt.currentTarget.cb(3 /* TTS_UTTERANCE_BOUNDARY */, evt.currentTarget.id, evt.charIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
const utterance = new SpeechSynthesisUtterance(GodotRuntime.parseString(p_text));
|
const utterance = new SpeechSynthesisUtterance(GodotRuntime.parseString(p_text));
|
||||||
|
|
|
@ -78,7 +78,7 @@ const GodotConfig = {
|
||||||
},
|
},
|
||||||
|
|
||||||
locate_file: function (file) {
|
locate_file: function (file) {
|
||||||
return Module['locateFile'](file); // eslint-disable-line no-undef
|
return Module['locateFile'](file);
|
||||||
},
|
},
|
||||||
clear: function () {
|
clear: function () {
|
||||||
GodotConfig.canvas = null;
|
GodotConfig.canvas = null;
|
||||||
|
|
|
@ -34,7 +34,7 @@ const GodotRuntime = {
|
||||||
* Functions
|
* Functions
|
||||||
*/
|
*/
|
||||||
get_func: function (ptr) {
|
get_func: function (ptr) {
|
||||||
return wasmTable.get(ptr); // eslint-disable-line no-undef
|
return wasmTable.get(ptr);
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -52,19 +52,19 @@ const GodotRuntime = {
|
||||||
* Memory
|
* Memory
|
||||||
*/
|
*/
|
||||||
malloc: function (p_size) {
|
malloc: function (p_size) {
|
||||||
return _malloc(p_size); // eslint-disable-line no-undef
|
return _malloc(p_size);
|
||||||
},
|
},
|
||||||
|
|
||||||
free: function (p_ptr) {
|
free: function (p_ptr) {
|
||||||
_free(p_ptr); // eslint-disable-line no-undef
|
_free(p_ptr);
|
||||||
},
|
},
|
||||||
|
|
||||||
getHeapValue: function (p_ptr, p_type) {
|
getHeapValue: function (p_ptr, p_type) {
|
||||||
return getValue(p_ptr, p_type); // eslint-disable-line no-undef
|
return getValue(p_ptr, p_type);
|
||||||
},
|
},
|
||||||
|
|
||||||
setHeapValue: function (p_ptr, p_value, p_type) {
|
setHeapValue: function (p_ptr, p_value, p_type) {
|
||||||
setValue(p_ptr, p_value, p_type); // eslint-disable-line no-undef
|
setValue(p_ptr, p_value, p_type);
|
||||||
},
|
},
|
||||||
|
|
||||||
heapSub: function (p_heap, p_ptr, p_len) {
|
heapSub: function (p_heap, p_ptr, p_len) {
|
||||||
|
@ -86,7 +86,7 @@ const GodotRuntime = {
|
||||||
* Strings
|
* Strings
|
||||||
*/
|
*/
|
||||||
parseString: function (p_ptr) {
|
parseString: function (p_ptr) {
|
||||||
return UTF8ToString(p_ptr); // eslint-disable-line no-undef
|
return UTF8ToString(p_ptr);
|
||||||
},
|
},
|
||||||
|
|
||||||
parseStringArray: function (p_ptr, p_size) {
|
parseStringArray: function (p_ptr, p_size) {
|
||||||
|
@ -99,13 +99,13 @@ const GodotRuntime = {
|
||||||
},
|
},
|
||||||
|
|
||||||
strlen: function (p_str) {
|
strlen: function (p_str) {
|
||||||
return lengthBytesUTF8(p_str); // eslint-disable-line no-undef
|
return lengthBytesUTF8(p_str);
|
||||||
},
|
},
|
||||||
|
|
||||||
allocString: function (p_str) {
|
allocString: function (p_str) {
|
||||||
const length = GodotRuntime.strlen(p_str) + 1;
|
const length = GodotRuntime.strlen(p_str) + 1;
|
||||||
const c_str = GodotRuntime.malloc(length);
|
const c_str = GodotRuntime.malloc(length);
|
||||||
stringToUTF8(p_str, c_str, length); // eslint-disable-line no-undef
|
stringToUTF8(p_str, c_str, length);
|
||||||
return c_str;
|
return c_str;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ const GodotRuntime = {
|
||||||
},
|
},
|
||||||
|
|
||||||
stringToHeap: function (p_str, p_ptr, p_len) {
|
stringToHeap: function (p_str, p_ptr, p_len) {
|
||||||
return stringToUTF8Array(p_str, HEAP8, p_ptr, p_len); // eslint-disable-line no-undef
|
return stringToUTF8Array(p_str, HEAP8, p_ptr, p_len);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,7 +38,7 @@ const GodotWebGL2 = {
|
||||||
godot_webgl2_glGetBufferSubData__sig: 'vippp',
|
godot_webgl2_glGetBufferSubData__sig: 'vippp',
|
||||||
godot_webgl2_glGetBufferSubData__deps: ['$GL', 'emscripten_webgl_get_current_context'],
|
godot_webgl2_glGetBufferSubData__deps: ['$GL', 'emscripten_webgl_get_current_context'],
|
||||||
godot_webgl2_glGetBufferSubData: function (target, offset, size, data) {
|
godot_webgl2_glGetBufferSubData: function (target, offset, size, data) {
|
||||||
const gl_context_handle = _emscripten_webgl_get_current_context(); // eslint-disable-line no-undef
|
const gl_context_handle = _emscripten_webgl_get_current_context();
|
||||||
const gl = GL.getContext(gl_context_handle);
|
const gl = GL.getContext(gl_context_handle);
|
||||||
if (gl) {
|
if (gl) {
|
||||||
gl.GLctx['getBufferSubData'](target, offset, HEAPU8, data, size);
|
gl.GLctx['getBufferSubData'](target, offset, HEAPU8, data, size);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,32 +3,22 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Development and linting setup for Godot's Web platform code",
|
"description": "Development and linting setup for Godot's Web platform code",
|
||||||
"scripts": {
|
|
||||||
"docs": "jsdoc --template js/jsdoc2rst/ js/engine/engine.js js/engine/config.js js/engine/features.js --destination ''",
|
|
||||||
"lint": "npm run lint:engine && npm run lint:libs && npm run lint:modules && npm run lint:tools && npm run lint:sw && npm run lint:html",
|
|
||||||
"lint:engine": "eslint \"js/engine/*.js\" --no-eslintrc -c .eslintrc.engine.js",
|
|
||||||
"lint:sw": "eslint \"../../misc/dist/html/service-worker.js\" --no-eslintrc -c .eslintrc.sw.js",
|
|
||||||
"lint:libs": "eslint \"js/libs/*.js\" --no-eslintrc -c .eslintrc.libs.js",
|
|
||||||
"lint:modules": "eslint \"../../modules/**/*.js\" --no-eslintrc -c .eslintrc.libs.js",
|
|
||||||
"lint:tools": "eslint \"js/jsdoc2rst/**/*.js\" --no-eslintrc -c .eslintrc.engine.js",
|
|
||||||
"lint:html": "eslint \"../../misc/dist/html/*.html\" --no-eslintrc -c .eslintrc.html.js",
|
|
||||||
"format": "npm run format:engine && npm run format:libs && npm run format:modules && npm run format:tools && format:sw && npm run format:html",
|
|
||||||
"format:engine": "npm run lint:engine -- --fix",
|
|
||||||
"format:libs": "npm run lint:libs -- --fix",
|
|
||||||
"format:modules": "npm run lint:modules -- --fix",
|
|
||||||
"format:tools": "npm run lint:tools -- --fix",
|
|
||||||
"format:html": "npm run lint:html -- --fix",
|
|
||||||
"format:sw": "npm run lint:sw -- --fix"
|
|
||||||
},
|
|
||||||
"author": "Godot Engine contributors",
|
"author": "Godot Engine contributors",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"docs": "jsdoc --template js/jsdoc2rst/ js/engine/engine.js js/engine/config.js js/engine/features.js --destination ''",
|
||||||
|
"lint": "cd ../.. && eslint --no-config-lookup --config ./platform/web/eslint.config.cjs ./platform/web/js ./modules ./misc/dist/html",
|
||||||
|
"format": "npm run lint -- --fix"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@html-eslint/eslint-plugin": "^0.19.1",
|
"@eslint/js": "^9.3.0",
|
||||||
"@html-eslint/parser": "^0.19.1",
|
"@html-eslint/eslint-plugin": "^0.24.1",
|
||||||
"eslint": "^8.46.0",
|
"@html-eslint/parser": "^0.24.1",
|
||||||
"eslint-config-airbnb-base": "^15.0.0",
|
"@stylistic/eslint-plugin": "^2.1.0",
|
||||||
"eslint-plugin-import": "^2.28.0",
|
"eslint": "^9.3.0",
|
||||||
"jsdoc": "^4.0.2",
|
"eslint-plugin-html": "^8.1.1",
|
||||||
"eslint-plugin-html": "^7.1.0"
|
"espree": "^10.0.1",
|
||||||
|
"globals": "^15.3.0",
|
||||||
|
"jsdoc": "^4.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue