Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

2 changes: 1 addition & 1 deletion cli/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ export async function checkJDKMajorVersion(): Promise<number> {
} else {
return -1;
}
} catch (e) {
} catch {
return -1;
}
}
Expand Down
7 changes: 4 additions & 3 deletions cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async function loadExtConfigTS(
);
}

const ts = require(tsPath); // eslint-disable-line @typescript-eslint/no-var-requires
const ts = require(tsPath); // eslint-disable-line @typescript-eslint/no-require-imports
const extConfigObject = (await requireTS(ts, extConfigFilePath)) as any;
const extConfig = extConfigObject.default ? await extConfigObject.default : extConfigObject;

Expand Down Expand Up @@ -143,6 +143,7 @@ async function loadExtConfigJS(
extConfigType: 'js',
extConfigName,
extConfigFilePath: extConfigFilePath,
// eslint-disable-next-line @typescript-eslint/no-require-imports
extConfig: await require(extConfigFilePath),
};
} catch (e: any) {
Expand Down Expand Up @@ -360,7 +361,7 @@ async function determineIOSWebDirAbs(

return resolve(nativeProjectDirAbs, 'public');
}
} catch (e) {
} catch {
// ignore
}

Expand Down Expand Up @@ -458,7 +459,7 @@ async function determinePackageManager(
if (output != null) {
gemfilePath = resolve(output, 'Gemfile');
}
} catch (e: any) {
} catch {
// Nothing
}
}
Expand Down
2 changes: 1 addition & 1 deletion cli/src/ios/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function execBundler() {
try {
const bundleOutput = execSync('bundle &> /dev/null ; echo $?');
return parseInt(bundleOutput.toString());
} catch (e: any) {
} catch {
return -1;
}
}
Expand Down
2 changes: 1 addition & 1 deletion cli/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function resolvePlugin(config: Config, name: string): Promise<Plugi
repository: meta.repository,
xml: xmlMeta.plugin,
};
} catch (e) {
} catch {
// ignore
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/tasks/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function listCommand(config: Config, selectedPlatformName: string):

export async function list(config: Config, platform: string): Promise<void> {
const allPlugins = await getPlugins(config, platform);
let plugins: Plugin[] = [];
let plugins: Plugin[];
if (platform === config.ios.name) {
plugins = await getIOSPlugins(allPlugins);
} else if (platform === config.android.name) {
Expand Down
3 changes: 1 addition & 2 deletions cli/src/tasks/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { extractTemplate } from '../util/template';

import { migrateToUIScene } from './migrate-uiscene';

// eslint-disable-next-line prefer-const
let allDependencies: { [key: string]: any } = {};
const libs = ['@capacitor/core', '@capacitor/cli', '@capacitor/ios', '@capacitor/android'];
const plugins = [
Expand Down Expand Up @@ -156,7 +155,7 @@ export async function migrateCommand(config: Config, noprompt: boolean, packagem
await runTask(`Installing Latest Modules using ${installerType}.`, () => {
return installLatestLibs(installerType, runNpmInstall, config);
});
} catch (ex) {
} catch {
logger.error(
`${installerType} install failed. Try deleting node_modules folder and running ${c.input(
`${installerType} install --force`,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/util/js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function formatJSObject(o: { [key: string]: any }): string {
try {
o = JSON.parse(JSON.stringify(o));
} catch (e: any) {
throw new Error(`Cannot parse object as JSON: ${e.stack ? e.stack : e}`);
throw new Error(`Cannot parse object as JSON: ${e.stack ? e.stack : e}`, { cause: e });
}

return util.inspect(o, {
Expand Down
4 changes: 2 additions & 2 deletions cli/src/util/monorepotools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function isMonorepo(currentPath: string): boolean {
try {
findMonorepoRoot(currentPath);
return true;
} catch (error) {
} catch {
return false;
}
}
Expand All @@ -104,7 +104,7 @@ export function isNXMonorepo(currentPath: string): boolean {
try {
findNXMonorepoRoot(currentPath);
return true;
} catch (error) {
} catch {
return false;
}
}
5 changes: 3 additions & 2 deletions cli/src/util/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const requireTS = async (ts: typeof typescript, p: string): Promise<unkno
`Your installed version of TypeScript (${ts.version}) no longer provides the compiler API Capacitor previously used to load .ts config files, ` +
`and your Node.js runtime (${process.version}) doesn't support loading them natively either.\n` +
'Upgrade to Node.js 22.6+ (running with --experimental-strip-types), or Node.js 23.6+, to continue using capacitor.config.ts.',
{ cause: e },
);
}
throw e;
Expand Down Expand Up @@ -78,7 +79,7 @@ export const requireTS = async (ts: typeof typescript, p: string): Promise<unkno
module._compile?.(sourceText, fileName);
};

const m = require(id); // eslint-disable-line @typescript-eslint/no-var-requires
const m = require(id); // eslint-disable-line @typescript-eslint/no-require-imports

delete require.extensions['.ts'];

Expand All @@ -88,7 +89,7 @@ export const requireTS = async (ts: typeof typescript, p: string): Promise<unkno
export function resolveNode(root: string, ...pathSegments: string[]): string | null {
try {
return require.resolve(pathSegments.join('/'), { paths: [root] });
} catch (e) {
} catch {
const path = [root, 'node_modules', ...pathSegments].join('/');
if (existsSync(path)) {
return path;
Expand Down
4 changes: 2 additions & 2 deletions cli/src/util/subprocess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ export async function getCommandOutput(
): Promise<string | null> {
try {
return (await runCommand(command, args, options)).trim();
} catch (e) {
} catch {
return null;
}
}

export async function isInstalled(command: string): Promise<boolean> {
try {
await which(command);
} catch (e) {
} catch {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion cli/src/util/xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function readXML(path: string): Promise<any> {
} catch (e: any) {
throw `Error parsing: ${path}, ${e.stack ?? e}`;
}
} catch (e) {
} catch {
throw `Unable to read: ${path}`;
}
}
Expand Down
2 changes: 1 addition & 1 deletion cli/test/capacitor-package.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jest.mock('../src/common', () => ({
getCapacitorPackageVersion: jest.fn(),
}));

// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { getCapacitorPackageVersion } = require('../src/common');

const SPM_DIR = '/app/ios/App/CapApp-SPM';
Expand Down
5 changes: 2 additions & 3 deletions core/native-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const convertBody = async (
if (contentType === 'application/json') {
try {
data = JSON.parse(data);
} catch (ignored) {
} catch {
// ignore
}
type = 'json';
Expand Down Expand Up @@ -370,7 +370,7 @@ const initBridge = (w: any): void => {
msg = JSON.stringify(msg);
}
return String(msg);
} catch (e) {
} catch {
return '';
}
};
Expand Down Expand Up @@ -1123,7 +1123,6 @@ const initBridge = (w: any): void => {
});
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
cap.withPlugin = (_pluginId, _fn) => dummy;

cap.Exception = CapacitorException;
Expand Down
1 change: 0 additions & 1 deletion core/src/tests/bridge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ describe('bridge', () => {
initBridge(win);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-empty-function
window.prompt = () => {};
});

Expand Down
17 changes: 17 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const ionic = require('@ionic/eslint-config/recommended');

module.exports = [
{
ignores: [
'**/build/**',
'cli/assets/**',
'**/dist/**',
'**/types/**',
// lint TypeScript only
'**/*.js',
'**/*.mjs',
'**/*.cjs',
],
},
...ionic,
];
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,17 @@
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
"prettier": "prettier \"**/*.{css,html,java,js,mjs,ts}\" --plugin=prettier-plugin-java",
"eslint": "eslint . --ext ts",
"eslint": "eslint .",
"swiftlint": "node-swiftlint",
"version": "npm run sync-peer-dependencies"
},
"prettier": "@ionic/prettier-config",
"eslintConfig": {
"extends": "@ionic/eslint-config/recommended"
},
"devDependencies": {
"@ionic/eslint-config": "^0.4.0",
"@ionic/eslint-config": "^0.5.0",
"@ionic/prettier-config": "^4.0.0",
"@ionic/swiftlint-config": "^2.0.0",
"@types/node": "18.18.6",
"eslint": "^8.57.0",
"eslint": "^10.0.0",
"lerna": "^7.1.3",
"prettier": "^3.3.0",
"prettier-plugin-java": "^2.6.4",
Expand Down