Skip to content

Commit

Permalink
Migrate to eslint v9 and fix rollup
Browse files Browse the repository at this point in the history
- package.json and package-losck.json have been moved to project root
- eslint.config.mjs created in the project root
- lint every script
- fix rollup related scripts after the merging of #3377
  • Loading branch information
atoppi committed Jun 13, 2024
1 parent 22085e7 commit 493a97b
Show file tree
Hide file tree
Showing 24 changed files with 4,094 additions and 5,094 deletions.
37 changes: 0 additions & 37 deletions .eslintrc.js

This file was deleted.

46 changes: 46 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import globals from 'globals';
import js from '@eslint/js';
import html from 'eslint-plugin-html'

export default [
{
files: [
'**/*.html',
'**/*.js'
],
plugins: {
html
},
languageOptions: {
ecmaVersion: 'latest',
globals: {
...globals.browser,
...globals.jquery,
'adapter': 'readonly',
'bootbox': 'readonly',
'define': 'readonly',
'module': 'readonly',
'toastr': 'readonly',
}
},
rules: {
...js.configs.recommended.rules,
'no-empty': 'off',
'no-unused-vars': [
'warn',
{
'args': 'all',
'vars': 'all',
'caughtErrors': 'all',
}
],
'indent': [
'error',
'tab',
{
'SwitchCase': 1
}
],
}
}
];
12 changes: 12 additions & 0 deletions html/demos/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if(window.location.protocol === 'http:')
server = "http://" + window.location.hostname + ":7088/admin";
else
server = "https://" + window.location.hostname + ":7889/admin";

// If you don't want the page to prompt you for a password, insert it here
var secret = "janusoverlord";

Expand Down Expand Up @@ -286,6 +287,7 @@ function updateServerInfo() {
updateTokens();
}
},
// eslint-disable-next-line no-unused-vars
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + ": " + errorThrown); // FIXME
if(!prompting && !alerted) {
Expand Down Expand Up @@ -501,6 +503,7 @@ function updateSettings() {
}
}
},
// eslint-disable-next-line no-unused-vars
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + ": " + errorThrown); // FIXME
$('#update-settings').removeClass('fa-spin').click(updateSettings);
Expand Down Expand Up @@ -592,6 +595,7 @@ function sendSettingsRequest(request) {
}
updateSettings();
},
// eslint-disable-next-line no-unused-vars
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + ": " + errorThrown); // FIXME
if(!prompting && !alerted) {
Expand Down Expand Up @@ -723,6 +727,7 @@ function sendPluginMessage(plugin, message) {
}
$('#plugin-response').text(JSON.stringify(json, null, 4));
},
// eslint-disable-next-line no-unused-vars
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + ": " + errorThrown); // FIXME
if(!prompting && !alerted) {
Expand Down Expand Up @@ -854,6 +859,7 @@ function sendTransportMessage(transport, message) {
}
$('#transport-response').text(JSON.stringify(json, null, 4));
},
// eslint-disable-next-line no-unused-vars
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + ": " + errorThrown); // FIXME
if(!prompting && !alerted) {
Expand Down Expand Up @@ -959,6 +965,7 @@ function updateSessions() {
$('#update-handle').click(updateHandleInfo);
}, 1000);
},
// eslint-disable-next-line no-unused-vars
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + ": " + errorThrown); // FIXME
setTimeout(function() {
Expand Down Expand Up @@ -1064,6 +1071,7 @@ function updateHandles() {
$('#update-handle').click(updateHandleInfo);
}, 1000);
},
// eslint-disable-next-line no-unused-vars
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + ": " + errorThrown); // FIXME
$('#update-handles').removeClass('fa-spin').click(updateHandles);
Expand Down Expand Up @@ -1159,6 +1167,7 @@ function updateHandleInfo(refresh) {
}, 5000);
}
},
// eslint-disable-next-line no-unused-vars
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + ": " + errorThrown); // FIXME
$('#update-handles').removeClass('fa-spin').click(updateHandles);
Expand Down Expand Up @@ -1447,6 +1456,7 @@ function updateTokens() {
});
});
},
// eslint-disable-next-line no-unused-vars
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + ": " + errorThrown); // FIXME
$('#update-settings').removeClass('fa-spin').click(updateSettings);
Expand Down Expand Up @@ -1498,6 +1508,7 @@ function sendTokenRequest(request) {
}
updateTokens();
},
// eslint-disable-next-line no-unused-vars
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + ": " + errorThrown); // FIXME
if(!prompting && !alerted) {
Expand Down Expand Up @@ -1592,6 +1603,7 @@ function captureTrafficRequest(start, text, folder, filename, truncate) {
return;
}
},
// eslint-disable-next-line no-unused-vars
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + ": " + errorThrown); // FIXME
if(!prompting && !alerted) {
Expand Down
2 changes: 1 addition & 1 deletion html/demos/audiobridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ function registerUsername() {

// Helper to parse query string
function getQueryStringValue(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
name = name.replace(/[[]/, "\\[").replace(/[\]]/, "\\]");
let regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
Expand Down
2 changes: 1 addition & 1 deletion html/demos/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ function updateCanvas() {

// Helper to parse query string
function getQueryStringValue(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
name = name.replace(/[[]/, "\\[").replace(/[\]]/, "\\]");
let regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
Expand Down
3 changes: 2 additions & 1 deletion html/demos/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ $(document).ready(function() {
if(mst)
mst.stop();
}
// eslint-disable-next-line no-unused-vars
} catch(e) {}
}
if(track.kind === "video") {
Expand Down Expand Up @@ -579,7 +580,7 @@ function sendData() {

// Helper to parse query string
function getQueryStringValue(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
name = name.replace(/[[]/, "\\[").replace(/[\]]/, "\\]");
let regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
Expand Down
3 changes: 2 additions & 1 deletion html/demos/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ $(document).ready(function() {
if(mst)
mst.stop();
}
// eslint-disable-next-line no-unused-vars
} catch(e) {}
}
if(track.kind === "video") {
Expand Down Expand Up @@ -410,7 +411,7 @@ function sendData() {

// Helper to parse query string
function getQueryStringValue(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
name = name.replace(/[[]/, "\\[").replace(/[\]]/, "\\]");
let regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
Expand Down
3 changes: 2 additions & 1 deletion html/demos/echotest.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ $(document).ready(function() {
if(mst)
mst.stop();
}
// eslint-disable-next-line no-unused-vars
} catch(e) {}
}
if(track.kind === "video") {
Expand Down Expand Up @@ -491,7 +492,7 @@ function sendData() {

// Helper to parse query string
function getQueryStringValue(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
name = name.replace(/[[]/, "\\[").replace(/[\]]/, "\\]");
let regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
Expand Down
Loading

0 comments on commit 493a97b

Please sign in to comment.