Upgrade eslint (#3175)

* chore: 🤖 Upgrade eslint config for admin ui

* chore: 🤖 Fix eslint issues for admin

* chore: 🤖 Upgrade eslint config for desktop

* chore: 🤖 Fix linting errors in desktop

* chore: 🤖 Upgrade eslint for api addon

* chore: 🤖 Fix eslint issues in api addon

* chore: 🤖 Upgrade eslint for auth addon

* chore: 🤖 Fix eslint issues in auth addon

* chore: 🤖 Upgrade core eslint config

* chore: 🤖 Fix eslint issue for core addon

* chore: 🤖 Upgrade eslint config for rose addon

* chore: 🤖 Fix eslint issue for rose addon

* chore: 🤖 Upgrade e2e eslint config

* chore: 🤖 Fix eslint issues in e2e

* chore: 🤖 Fix CI linting issues

* chore: 🤖 Add back linting server files for the future

* chore: 🤖 Update qunit rules to use extends
This commit is contained in:
Zhihe Li authored and GitHub committed 2026-02-27 13:32:27 -05:00
1 parent d6e8e58ca1
commit 999c21c66a
73 files changed
+1081 -922

No files matched your search

-17
View File
@@ -1,17 +0,0 @@
# unconventional js
/blueprints/*/files/
# compiled output
/declarations/
/dist/
# misc
/coverage/
!.*
.*/
# ember-electron
/electron-app/
# ember-try
/.node_modules.ember-try/
-71
View File
@@ -1,71 +0,0 @@
/**
* Copyright IBM Corp. 2021, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
'use strict';
module.exports = {
root: true,
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
// This is specific babel-config. If grows consider creating a babel config file
requireConfigFile: false,
babelOptions: {
plugins: [
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],
],
},
// end of babel-config
},
plugins: ['ember'],
extends: ['eslint:recommended', 'plugin:ember/recommended', 'prettier'],
env: {
browser: true,
},
rules: {
curly: ['error', 'multi-line', 'consistent'],
'ember/no-get': 'off',
'ember/no-get-with-default': 'off',
'ember/no-computed-properties-in-native-classes': 'off',
'ember/no-assignment-of-untracked-properties-used-in-tracking-contexts':
'off',
},
overrides: [
// node files
{
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.stylelintrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./testem.js',
'./testem-electron.js',
'./playwright.config.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./lib/*/index.js',
'./server/**/*.js',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
},
extends: ['plugin:n/recommended'],
},
{
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
rules: {
'qunit/require-expect': [2, 'except-simple'],
},
},
],
};
@@ -211,7 +211,7 @@ export default class ScopesScopeProjectsTargetsIndexController extends Controlle
session = await this.store.findRecord('session', session_id, {
reload: true,
});
} catch (error) {
} catch {
/**
* if the user cannot read or fetch the session we add the important
* information returned from the connect command to allow the user
+2 -2
View File
@@ -29,7 +29,7 @@ export default class ScopesRoute extends Route {
if (scopesCheck.response_type) {
this.isPaginationSupported = true;
}
} catch (e) {
} catch {
// no op
}
}
@@ -80,7 +80,7 @@ export default class ScopesRoute extends Route {
}
if (!downloadLink) throw new Error('No build found');
} catch (e) {
} catch {
// this is a catch for any errors that may occur and shows the user
// an error alert directing them to the releases page
downloadError = true;
@@ -83,7 +83,6 @@ export default class ScopesScopeProjectsRoute extends Route {
let sessions;
// We use a while loop to poll for new sessions from the client agent.
// eslint-disable-next-line no-constant-condition
while (true) {
try {
sessions =
@@ -152,7 +151,7 @@ export default class ScopesScopeProjectsRoute extends Route {
alias.destination_id,
);
orgScope = target.scope.parent_scope_id;
} catch (e) {
} catch {
// Do nothing and default scope to global if an error occurs
}
@@ -91,7 +91,7 @@ export default class ScopesScopeProjectsSessionsSessionRoute extends Route {
try {
const host = await this.store.findRecord('host', session.host_id);
session.addHost(host);
} catch (error) {
} catch {
// no operation
}
}
@@ -61,7 +61,7 @@ export default class ScopesScopeProjectsTargetsTargetRoute extends Route {
hosts = Array.from(
new Map(allFilteredHosts.map((host) => [host.id, host])).values(),
);
} catch (error) {
} catch {
// no operation
}
}
-2
View File
@@ -4,8 +4,6 @@
*/
// Importing 'Store' from 'ember-data/store' to get default configuration automatically.
// TODO: Remove eslint-disable after upgrading to eslint-plugin-ember >= v12.2.1
// eslint-disable-next-line ember/use-ember-data-rfc-395-imports
import Store from 'ember-data/store';
import { CacheHandler } from '@ember-data/store';
import RequestManager from '@ember-data/request';
+1
View File
@@ -99,6 +99,7 @@ module.exports = {
await extract(artifactPath, artifactDestination);
} catch (e) {
console.error('ERROR: Failed setting up CLI.', e);
// eslint-disable-next-line n/no-process-exit
process.exit(1);
}
} else {
@@ -173,7 +173,7 @@ module.exports = {
*/
if (!boundaryCli.isBuiltInCli) return;
const latestVersion = await findLatestVersion(releasesUrl);
let latestVersion = await findLatestVersion(releasesUrl);
// Ensure version is in proper format
if (!semver.valid(latestVersion)) {
@@ -18,7 +18,7 @@ const netRequest = (url) =>
// request ends because: request.abort() has no effect after a request
// ends and the promise will already have been completed, so a rejection
// has no effect either.
const requestTimeout = setTimeout(() => {
setTimeout(() => {
request.abort();
reject(new Error('Request timeout'));
}, requestTimeoutSeconds * 1000);
-5
View File
@@ -3,13 +3,8 @@
* SPDX-License-Identifier: BUSL-1.1
*/
/* eslint-disable no-console */
const path = require('path');
const { net } = require('electron');
const {
default: installExtension,
EMBER_INSPECTOR,
} = require('electron-devtools-installer');
const {
session,
app,
+2 -2
View File
@@ -178,7 +178,7 @@ handle('searchCacheDaemon', async (request) =>
handle('isCacheDaemonRunning', async () => {
try {
await cacheDaemonManager.status();
} catch (e) {
} catch {
// There was likely an error connecting to the cache daemon.
return false;
}
@@ -208,7 +208,7 @@ handle('isClientAgentRunning', async () => {
}
return status.status === 'running';
} catch (e) {
} catch {
// There was likely an error connecting to client agent.
return false;
}
@@ -43,7 +43,7 @@ class RuntimeSettings {
if (result.statusCode >= 400) {
throw new Error();
}
} catch (e) {
} catch {
throw new Error(`Cluster URL ${clusterUrl} could not be validated.`);
}
}
@@ -120,6 +120,7 @@ class CacheDaemonManager {
async search(requestData) {
const start = Date.now();
// Log request data, but clean up token from log
// eslint-disable-next-line no-unused-vars
const { auth_token_id, token, ...logRequestData } = requestData;
if (isWindows()) {
@@ -3,7 +3,6 @@
* SPDX-License-Identifier: MPL-2.0
*/
const jsonify = require('./jsonify');
const log = require('electron-log/main');
// Convert to json
const generateErrorPromise = async (stderr) => {
+1 -3
View File
@@ -3,14 +3,12 @@
* SPDX-License-Identifier: BUSL-1.1
*/
const log = require('electron-log/main');
// Convert to json
const jsonify = (data) => {
if (typeof data !== 'string') data = JSON.stringify(data);
try {
return JSON.parse(data);
} catch (e) {
} catch {
// Ignore parse errors
}
};
@@ -3,8 +3,6 @@
* SPDX-License-Identifier: BUSL-1.1
*/
const { URL } = require('url');
module.exports = {
/**
* Super paranoid shell quote/escape and validation. Input must be base62.
@@ -27,7 +25,7 @@ module.exports = {
try {
const url = new URL(str);
return `${url.protocol}//${url.host}`;
} catch (e) {
} catch {
// Parse error
throw new Error(`URL ${str} could not be validated.`);
}
+4
View File
@@ -3,16 +3,20 @@
* SPDX-License-Identifier: BUSL-1.1
*/
// TODO: Is this file still needed?
const {
default: installExtension,
EMBER_INSPECTOR,
} = require('electron-devtools-installer');
const path = require('path');
const { app } = require('electron');
// eslint-disable-next-line n/no-missing-require
const handleFileUrls = require('../src/handle-file-urls');
const {
setupTestem,
openTestWindow,
// eslint-disable-next-line n/no-extraneous-require
} = require('ember-electron/lib/test-support');
const emberAppDir = path.resolve(__dirname, '..', 'ember-test');
+107
View File
@@ -0,0 +1,107 @@
/**
* Copyright IBM Corp. 2021, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
'use strict';
const { defineConfig, globalIgnores } = require('eslint/config');
const babelParser = require('@babel/eslint-parser');
const js = require('@eslint/js');
const eslintPluginEmberRecommended = require('eslint-plugin-ember/configs/recommended');
const nPlugin = require('eslint-plugin-n');
const qunitPlugin = require('eslint-plugin-qunit');
const eslintConfigPrettier = require('eslint-config-prettier/flat');
const globals = require('globals');
module.exports = defineConfig([
js.configs.recommended,
...eslintPluginEmberRecommended,
{
languageOptions: {
parser: babelParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
requireConfigFile: false,
// This is specific babel-config. If it grows consider creating a babel config file
babelOptions: {
plugins: [
[
'@babel/plugin-proposal-decorators',
{ decoratorsBeforeExport: true },
],
],
},
// end of babel-config
},
globals: {
...globals.browser,
},
},
rules: {
curly: ['error', 'multi-line', 'consistent'],
'ember/no-get': 'off',
'ember/no-get-with-default': 'off',
'ember/no-computed-properties-in-native-classes': 'off',
'ember/no-assignment-of-untracked-properties-used-in-tracking-contexts':
'off',
},
},
// Node files configuration
{
files: [
'eslint.config.js',
'.prettierrc.js',
'.stylelintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'testem.js',
'testem-electron.js',
'playwright.config.js',
'config/**/*.js',
'server/**/*.js',
'electron-app/**/*.js',
],
plugins: { n: nPlugin },
extends: [nPlugin.configs['flat/recommended-script']],
},
// These files reference config/config.js which is generated at build time
// and listed in .gitignore, so it won't exist when linting in CI unless we build first.
{
files: [
'electron-app/config/forge.config.js',
'electron-app/src/index.js',
'electron-app/src/config/menu.js',
'electron-app/src/ipc/handlers.js',
'electron-app/src/helpers/app-updater.js',
],
rules: {
'n/no-missing-require': 'off',
},
},
// Test files configuration
{
files: ['tests/**/*-test.{js,ts}'],
extends: [
{ ...qunitPlugin.configs.recommended, plugins: { qunit: qunitPlugin } },
],
rules: {
'qunit/require-expect': [2, 'except-simple'],
},
},
// Prettier should be last
eslintConfigPrettier,
globalIgnores([
'declarations/',
'dist/',
'coverage/',
'**/.*/',
'.node_modules.ember-try/',
'electron-app/out/',
'electron-app/ember-dist/',
]),
]);
+7 -5
View File
@@ -95,11 +95,13 @@
"ember-template-lint": "^6.0.0",
"ember-template-lint-plugin-prettier": "^5.0.0",
"ember-wormhole": "^0.6.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-ember": "^12.2.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-qunit": "^8.1.2",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-ember": "^12.7.5",
"eslint-plugin-n": "^17.24.0",
"eslint-plugin-qunit": "^8.2.6",
"@eslint/js": "^9.18.0",
"globals": "^17.3.0",
"js-bexpr": "hashicorp/js-bexpr#9b4a4b54d85eba67fdfc0990133d1518d890b1e1",
"loader.js": "^4.7.0",
"miragejs": "^0.1.48",