Tools: Apply eslint rules "no-console" and "id-denylist"

pull/7784/head
Laurent Cozic 2023-02-16 10:55:24 +00:00
parent 625689dbb1
commit 7fa1459dc3
77 changed files with 183 additions and 79 deletions

View File

@ -77,6 +77,7 @@ module.exports = {
'no-array-constructor': ['error'], 'no-array-constructor': ['error'],
'radix': ['error'], 'radix': ['error'],
'eqeqeq': ['error', 'always'], 'eqeqeq': ['error', 'always'],
'no-console': ['error', { 'allow': ['warn', 'error'] }],
// Warn only for now because fixing everything would take too much // Warn only for now because fixing everything would take too much
// refactoring, but new code should try to stick to it. // refactoring, but new code should try to stick to it.
@ -135,6 +136,13 @@ module.exports = {
'spaced-comment': ['error', 'always'], 'spaced-comment': ['error', 'always'],
'keyword-spacing': ['error', { 'before': true, 'after': true }], 'keyword-spacing': ['error', { 'before': true, 'after': true }],
'no-multi-spaces': ['error'], 'no-multi-spaces': ['error'],
// Regarding the keyword blacklist:
// - err: We generally avoid using too many abbreviations, so it should
// be "error", not "err"
// - notebook: In code, it should always be "folder" (not "notebook").
// In user-facing text, it should be "notebook".
'id-denylist': ['error', 'err', 'notebook', 'notebooks'],
}, },
'plugins': [ 'plugins': [
'react', 'react',
@ -147,6 +155,16 @@ module.exports = {
'promise', 'promise',
], ],
'overrides': [ 'overrides': [
{
'files': [
'packages/tools/**',
'packages/app-mobile/tools/**',
'packages/app-desktop/tools/**',
],
'rules': {
'no-console': 'off',
},
},
{ {
// enable the rule specifically for TypeScript files // enable the rule specifically for TypeScript files
'files': ['*.ts', '*.tsx'], 'files': ['*.ts', '*.tsx'],

View File

@ -246,6 +246,7 @@ class Application extends BaseApplication {
showConsole: () => {}, showConsole: () => {},
maximizeConsole: () => {}, maximizeConsole: () => {},
stdout: text => { stdout: text => {
// eslint-disable-next-line no-console
console.info(text); console.info(text);
}, },
fullScreen: () => {}, fullScreen: () => {},
@ -407,6 +408,7 @@ class Application extends BaseApplication {
if (this.showStackTraces_) { if (this.showStackTraces_) {
console.error(error); console.error(error);
} else { } else {
// eslint-disable-next-line no-console
console.info(error.message); console.info(error.message);
} }
process.exit(1); process.exit(1);

View File

@ -131,6 +131,7 @@ async function main() {
const commandsText = commandBlocks.join('\n\n'); const commandsText = commandBlocks.join('\n\n');
const footerText = getFooter(); const footerText = getFooter();
// eslint-disable-next-line no-console
console.info(`${headerText}\n\n` + 'USAGE' + `\n\n${commandsText}\n\n${footerText}`); console.info(`${headerText}\n\n` + 'USAGE' + `\n\n${commandsText}\n\n${footerText}`);
} }

View File

@ -1,5 +1,7 @@
'use strict'; 'use strict';
/* eslint-disable no-console */
const fs = require('fs-extra'); const fs = require('fs-extra');
const Logger = require('@joplin/lib/Logger').default; const Logger = require('@joplin/lib/Logger').default;
const { dirname } = require('@joplin/lib/path-utils'); const { dirname } = require('@joplin/lib/path-utils');

View File

@ -39,9 +39,9 @@ class Command extends BaseCommand {
let settingsObj; let settingsObj;
try { try {
settingsObj = JSON.parse(json); settingsObj = JSON.parse(json);
} catch (err) { } catch (error) {
isSettled = true; isSettled = true;
return reject(new Error(`Invalid JSON passed to config --import: \n${err.message}.`)); return reject(new Error(`Invalid JSON passed to config --import: \n${error.message}.`));
} }
if (settingsObj) { if (settingsObj) {
Object.entries(settingsObj) Object.entries(settingsObj)

View File

@ -118,6 +118,7 @@ class Command extends BaseCommand {
} }
await Promise.all(promises); await Promise.all(promises);
// eslint-disable-next-line no-console
console.info(await api.exec('GET', 'api/items/root:/testing:')); console.info(await api.exec('GET', 'api/items/root:/testing:'));
} }

View File

@ -80,9 +80,9 @@ if (process.platform === 'win32') {
}); });
} }
process.stdout.on('error', function(err) { process.stdout.on('error', function(error) {
// https://stackoverflow.com/questions/12329816/error-write-epipe-when-piping-node-output-to-head#15884508 // https://stackoverflow.com/questions/12329816/error-write-epipe-when-piping-node-output-to-head#15884508
if (err.code === 'EPIPE') { if (error.code === 'EPIPE') {
process.exit(0); process.exit(0);
} }
}); });

View File

@ -11,6 +11,7 @@ function createConsoleWrapper(pluginId: string) {
const wrapper: any = {}; const wrapper: any = {};
for (const n in console) { for (const n in console) {
// eslint-disable-next-line no-console
if (!console.hasOwnProperty(n)) continue; if (!console.hasOwnProperty(n)) continue;
wrapper[n] = (...args: any[]) => { wrapper[n] = (...args: any[]) => {
const newArgs = args.slice(); const newArgs = args.slice();

View File

@ -49,6 +49,7 @@ describe('HtmlToHtml', function() {
} }
if (actualHtml !== expectedHtml) { if (actualHtml !== expectedHtml) {
/* eslint-disable no-console */
console.info(''); console.info('');
console.info(`Error converting file: ${htmlSourceFilename}`); console.info(`Error converting file: ${htmlSourceFilename}`);
console.info('--------------------------------- Got:'); console.info('--------------------------------- Got:');
@ -59,6 +60,7 @@ describe('HtmlToHtml', function() {
console.info(expectedHtml.split('\n')); console.info(expectedHtml.split('\n'));
console.info('--------------------------------------------'); console.info('--------------------------------------------');
console.info(''); console.info('');
/* eslint-enable */
expect(false).toBe(true); expect(false).toBe(true);
// return; // return;

View File

@ -57,6 +57,7 @@ describe('HtmlToMd', function() {
result.push('--------------------------------------------'); result.push('--------------------------------------------');
result.push(''); result.push('');
// eslint-disable-next-line no-console
console.info(result.join('\n')); console.info(result.join('\n'));
// console.info(''); // console.info('');

View File

@ -72,6 +72,7 @@ describe('MdToHtml', function() {
'', '',
]; ];
// eslint-disable-next-line no-console
console.info(msg.join('\n')); console.info(msg.join('\n'));
expect(false).toBe(true); expect(false).toBe(true);

View File

@ -1,3 +1,5 @@
/* eslint-disable no-console */
// This script can be used to simulate a running production environment, by // This script can be used to simulate a running production environment, by
// having multiple users in parallel changing notes and synchronising. // having multiple users in parallel changing notes and synchronising.
// //

View File

@ -1,3 +1,5 @@
/* eslint-disable no-console */
(function() { (function() {
if (window.jopext_hasRun) return; if (window.jopext_hasRun) return;

View File

@ -1,5 +1,7 @@
'use strict'; 'use strict';
/* eslint-disable no-console */
// Do this as the first thing so that any code reading it knows the right env. // Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development'; process.env.BABEL_ENV = 'development';
process.env.NODE_ENV = 'development'; process.env.NODE_ENV = 'development';
@ -104,9 +106,9 @@ checkBrowsers(paths.appPath, isInteractive)
); );
const devServer = new WebpackDevServer(compiler, serverConfig); const devServer = new WebpackDevServer(compiler, serverConfig);
// Launch WebpackDevServer. // Launch WebpackDevServer.
devServer.listen(port, HOST, err => { devServer.listen(port, HOST, error => {
if (err) { if (error) {
return console.log(err); return console.log(error);
} }
if (isInteractive) { if (isInteractive) {
clearConsole(); clearConsole();
@ -135,9 +137,9 @@ checkBrowsers(paths.appPath, isInteractive)
}); });
}); });
}) })
.catch(err => { .catch(error => {
if (err && err.message) { if (error && error.message) {
console.log(err.message); console.log(error.message);
} }
process.exit(1); process.exit(1);
}); });

View File

@ -1,3 +1,5 @@
/* eslint-disable no-console */
const { randomClipperPort } = require('./randomClipperPort'); const { randomClipperPort } = require('./randomClipperPort');
function msleep(ms) { function msleep(ms) {

View File

@ -1,3 +1,5 @@
/* eslint-disable no-console */
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import App from './App'; import App from './App';

View File

@ -40,6 +40,7 @@ export default class InteropServiceHelper {
const service = InteropService.instance(); const service = InteropService.instance();
const result = await service.export(fullExportOptions); const result = await service.export(fullExportOptions);
// eslint-disable-next-line no-console
console.info('Export HTML result: ', result); console.info('Export HTML result: ', result);
return tempFile; return tempFile;
} }
@ -190,6 +191,7 @@ export default class InteropServiceHelper {
try { try {
const result = await service.export(exportOptions); const result = await service.export(exportOptions);
// eslint-disable-next-line no-console
console.info('Export result: ', result); console.info('Export result: ', result);
} catch (error) { } catch (error) {
console.error(error); console.error(error);

View File

@ -61,8 +61,8 @@ export const KeymapConfigScreen = ({ themeId }: KeymapConfigScreenProps) => {
try { try {
const keymapFile = await shim.fsDriver().readFile(actualFilePath, 'utf-8'); const keymapFile = await shim.fsDriver().readFile(actualFilePath, 'utf-8');
overrideKeymapItems(JSON.parse(keymapFile)); overrideKeymapItems(JSON.parse(keymapFile));
} catch (err) { } catch (error) {
bridge().showErrorMessageBox(_('Error: %s', err.message)); bridge().showErrorMessageBox(_('Error: %s', error.message));
} }
} }
}; };
@ -77,8 +77,8 @@ export const KeymapConfigScreen = ({ themeId }: KeymapConfigScreenProps) => {
try { try {
// KeymapService is already synchronized with the in-state keymap // KeymapService is already synchronized with the in-state keymap
await keymapService.saveCustomKeymap(filePath); await keymapService.saveCustomKeymap(filePath);
} catch (err) { } catch (error) {
bridge().showErrorMessageBox(err.message); bridge().showerrororMessageBox(error.message);
} }
} }
}; };

View File

@ -62,11 +62,11 @@ const useKeymap = (): [
// Then, update the state with the data from KeymapService // Then, update the state with the data from KeymapService
// Side-effect: Changes will also be saved to the disk // Side-effect: Changes will also be saved to the disk
setKeymapItems(keymapService.getKeymapItems()); setKeymapItems(keymapService.getKeymapItems());
} catch (err) { } catch (error) {
// oldKeymapItems includes even the unchanged keymap items // oldKeymapItems includes even the unchanged keymap items
// However, it is not an issue because the logic accounts for such scenarios // However, it is not an issue because the logic accounts for such scenarios
keymapService.overrideKeymap(oldKeymapItems); keymapService.overrideKeymap(oldKeymapItems);
throw err; throw error;
} }
}; };
@ -80,8 +80,8 @@ const useKeymap = (): [
keymapService.overrideKeymap(keymapItems); keymapService.overrideKeymap(keymapItems);
await keymapService.saveCustomKeymap(); await keymapService.saveCustomKeymap();
setKeymapError(null); setKeymapError(null);
} catch (err) { } catch (error) {
const error = new Error(`Could not save file: ${err.message}`); error.message = `Could not save file: ${error.message}`;
setKeymapError(error); setKeymapError(error);
} }
} }

View File

@ -172,7 +172,6 @@ class MainScreenComponent extends React.Component<Props, State> {
} }
private openCallbackUrl(url: string) { private openCallbackUrl(url: string) {
console.log(`openUrl ${url}`);
const { command, params } = parseCallbackUrl(url); const { command, params } = parseCallbackUrl(url);
void CommandService.instance().execute(command.toString(), params.id); void CommandService.instance().execute(command.toString(), params.id);
} }
@ -393,6 +392,7 @@ class MainScreenComponent extends React.Component<Props, State> {
async waitForNoteToSaved(noteId: string) { async waitForNoteToSaved(noteId: string) {
while (noteId && this.props.editorNoteStatuses[noteId] === 'saving') { while (noteId && this.props.editorNoteStatuses[noteId] === 'saving') {
// eslint-disable-next-line no-console
console.info('Waiting for note to be saved...', this.props.editorNoteStatuses); console.info('Waiting for note to be saved...', this.props.editorNoteStatuses);
await time.msleep(100); await time.msleep(100);
} }
@ -401,6 +401,7 @@ class MainScreenComponent extends React.Component<Props, State> {
async printTo_(target: string, options: any) { async printTo_(target: string, options: any) {
// Concurrent print calls are disallowed to avoid incorrect settings being restored upon completion // Concurrent print calls are disallowed to avoid incorrect settings being restored upon completion
if (this.isPrinting_) { if (this.isPrinting_) {
// eslint-disable-next-line no-console
console.info(`Printing ${options.path} to ${target} disallowed, already printing.`); console.info(`Printing ${options.path} to ${target} disallowed, already printing.`);
return; return;
} }

View File

@ -14,7 +14,6 @@ export const runtime = (): CommandRuntime => {
const resource = await Resource.load(resourceId); const resource = await Resource.load(resourceId);
if (!resource) throw new Error(`No such resource: ${resourceId}`); if (!resource) throw new Error(`No such resource: ${resourceId}`);
if (resource.mime !== 'application/pdf') throw new Error(`Not a PDF: ${resource.mime}`); if (resource.mime !== 'application/pdf') throw new Error(`Not a PDF: ${resource.mime}`);
console.log('Opening PDF', resource);
context.dispatch({ context.dispatch({
type: 'DIALOG_OPEN', type: 'DIALOG_OPEN',
name: 'pdfViewer', name: 'pdfViewer',

View File

@ -271,6 +271,7 @@ function useMenu(props: Props) {
const service = InteropService.instance(); const service = InteropService.instance();
try { try {
const result = await service.import(importOptions); const result = await service.import(importOptions);
// eslint-disable-next-line no-console
console.info('Import result: ', result); console.info('Import result: ', result);
} catch (error) { } catch (error) {
bridge().showErrorMessageBox(error.message); bridge().showErrorMessageBox(error.message);

View File

@ -351,6 +351,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
continue; continue;
} }
// eslint-disable-next-line no-console
console.info('Loading script', s.src); console.info('Loading script', s.src);
await loadScript(s); await loadScript(s);

View File

@ -107,8 +107,8 @@ export const svgUriToPng = (document: Document, svg: string, width: number, heig
canvas.remove(); canvas.remove();
img.remove(); img.remove();
resolve(buff); resolve(buff);
} catch (err) { } catch (error) {
cleanUpAndReject(err); cleanUpAndReject(error);
} }
}; };
img.onerror = function(e) { img.onerror = function(e) {

View File

@ -13,6 +13,7 @@ export default function useMessageHandler(scrollWhenReady: any, setScrollWhenRea
const args = event.args; const args = event.args;
const arg0 = args && args.length >= 1 ? args[0] : null; const arg0 = args && args.length >= 1 ? args[0] : null;
// eslint-disable-next-line no-console
if (msg !== 'percentScroll') console.info(`Got ipc-message: ${msg}`, arg0); if (msg !== 'percentScroll') console.info(`Got ipc-message: ${msg}`, arg0);
if (msg.indexOf('error:') === 0) { if (msg.indexOf('error:') === 0) {

View File

@ -68,8 +68,6 @@ function styles_(props: Props) {
} }
export function ShareNoteDialog(props: Props) { export function ShareNoteDialog(props: Props) {
console.info('Render ShareNoteDialog');
const [notes, setNotes] = useState<NoteEntity[]>([]); const [notes, setNotes] = useState<NoteEntity[]>([]);
const [recursiveShare, setRecursiveShare] = useState<boolean>(false); const [recursiveShare, setRecursiveShare] = useState<boolean>(false);
const [sharesState, setSharesState] = useState<string>('unknown'); const [sharesState, setSharesState] = useState<string>('unknown');

View File

@ -20,6 +20,7 @@ export default function useEffectDebugger(effectHook: any, dependencies: any, de
}, {}); }, {});
if (Object.keys(changedDeps).length) { if (Object.keys(changedDeps).length) {
// eslint-disable-next-line no-console
console.log('[use-effet-debugger] ', changedDeps); console.log('[use-effet-debugger] ', changedDeps);
} }

View File

@ -20,6 +20,7 @@ export default function useImperativeHandleDebugger(ref: any, effectHook: any, d
}, {}); }, {});
if (Object.keys(changedDeps).length) { if (Object.keys(changedDeps).length) {
// eslint-disable-next-line no-console
console.log('[use-imperativeHandler-debugger] ', changedDeps); console.log('[use-imperativeHandler-debugger] ', changedDeps);
} }

View File

@ -10,6 +10,7 @@ export interface Script {
export const loadScript = async (script: Script) => { export const loadScript = async (script: Script) => {
return new Promise((resolve) => { return new Promise((resolve) => {
// eslint-disable-next-line no-console
console.info('Loading script:', script); console.info('Loading script:', script);
let element: any = document.getElementById(script.id); let element: any = document.getElementById(script.id);

View File

@ -56,6 +56,7 @@ if (bridge().env() === 'dev') {
window.console = newConsole; window.console = newConsole;
} }
// eslint-disable-next-line no-console
console.info(`Environment: ${bridge().env()}`); console.info(`Environment: ${bridge().env()}`);
const fsDriver = new FsDriverNode(); const fsDriver = new FsDriverNode();
@ -77,7 +78,9 @@ BaseItem.loadClass('Revision', Revision);
Setting.setConstant('appId', `net.cozic.joplin${bridge().env() === 'dev' ? 'dev' : ''}-desktop`); Setting.setConstant('appId', `net.cozic.joplin${bridge().env() === 'dev' ? 'dev' : ''}-desktop`);
Setting.setConstant('appType', 'desktop'); Setting.setConstant('appType', 'desktop');
// eslint-disable-next-line no-console
console.info(`appId: ${Setting.value('appId')}`); console.info(`appId: ${Setting.value('appId')}`);
// eslint-disable-next-line no-console
console.info(`appType: ${Setting.value('appType')}`); console.info(`appType: ${Setting.value('appType')}`);
let keytar; let keytar;

View File

@ -87,6 +87,7 @@ const webviewApi = {
// console.debug('UserWebviewIndex: setting html to', args.html); // console.debug('UserWebviewIndex: setting html to', args.html);
window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {
// eslint-disable-next-line no-console
console.debug('UserWebviewIndex: setting html callback', args.hash); console.debug('UserWebviewIndex: setting html callback', args.hash);
window.postMessage({ target: 'UserWebview', message: 'htmlIsSet', hash: args.hash }, '*'); window.postMessage({ target: 'UserWebview', message: 'htmlIsSet', hash: args.hash }, '*');
}); });
@ -155,6 +156,7 @@ const webviewApi = {
if (!ipc[callName]) { if (!ipc[callName]) {
console.warn('Missing IPC function:', event.data); console.warn('Missing IPC function:', event.data);
} else { } else {
// eslint-disable-next-line no-console
console.debug('UserWebviewIndex: Got message', callName, args); console.debug('UserWebviewIndex: Got message', callName, args);
ipc[callName](args); ipc[callName](args);
} }
@ -166,6 +168,7 @@ const webviewApi = {
// Need to send it with a delay to make sure all listeners are // Need to send it with a delay to make sure all listeners are
// ready when the message is sent. // ready when the message is sent.
window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {
// eslint-disable-next-line no-console
console.debug('UserWebViewIndex: calling isReady'); console.debug('UserWebViewIndex: calling isReady');
window.postMessage({ target: 'UserWebview', message: 'ready' }, '*'); window.postMessage({ target: 'UserWebview', message: 'ready' }, '*');
}); });

View File

@ -16,6 +16,7 @@ export default function(frameWindow: any, isReady: boolean, postMessage: Functio
if (!data || data.target !== 'UserWebview') return; if (!data || data.target !== 'UserWebview') return;
// eslint-disable-next-line no-console
console.info('useHtmlLoader: message', data); console.info('useHtmlLoader: message', data);
// We only update if the HTML that was loaded is the same as // We only update if the HTML that was loaded is the same as
@ -35,10 +36,12 @@ export default function(frameWindow: any, isReady: boolean, postMessage: Functio
}, [frameWindow, htmlHash]); }, [frameWindow, htmlHash]);
useEffect(() => { useEffect(() => {
// eslint-disable-next-line no-console
console.info('useHtmlLoader: isReady', isReady); console.info('useHtmlLoader: isReady', isReady);
if (!isReady) return; if (!isReady) return;
// eslint-disable-next-line no-console
console.info('useHtmlLoader: setHtml', htmlHash); console.info('useHtmlLoader: setHtml', htmlHash);
postMessage('setHtml', { postMessage('setHtml', {

View File

@ -9,9 +9,11 @@ export default function useViewIsReady(viewRef: any) {
const [iframeContentReady, setIFrameContentReady] = useState(false); const [iframeContentReady, setIFrameContentReady] = useState(false);
useEffect(() => { useEffect(() => {
// eslint-disable-next-line no-console
console.debug('useViewIsReady ============== Setup Listeners'); console.debug('useViewIsReady ============== Setup Listeners');
function onIFrameReady() { function onIFrameReady() {
// eslint-disable-next-line no-console
console.debug('useViewIsReady: onIFrameReady'); console.debug('useViewIsReady: onIFrameReady');
setIFrameReady(true); setIFrameReady(true);
} }
@ -21,6 +23,7 @@ export default function useViewIsReady(viewRef: any) {
if (!data || data.target !== 'UserWebview') return; if (!data || data.target !== 'UserWebview') return;
// eslint-disable-next-line no-console
console.debug('useViewIsReady: message', data); console.debug('useViewIsReady: message', data);
if (data.message === 'ready') { if (data.message === 'ready') {
@ -30,6 +33,7 @@ export default function useViewIsReady(viewRef: any) {
const iframeDocument = viewRef.current.contentWindow.document; const iframeDocument = viewRef.current.contentWindow.document;
// eslint-disable-next-line no-console
console.debug('useViewIsReady readyState', iframeDocument.readyState); console.debug('useViewIsReady readyState', iframeDocument.readyState);
if (iframeDocument.readyState === 'complete') { if (iframeDocument.readyState === 'complete') {

View File

@ -28,7 +28,7 @@ module.exports = async function() {
branch = execSync('git rev-parse --abbrev-ref HEAD', { stdio: 'pipe' }).toString().trim(); branch = execSync('git rev-parse --abbrev-ref HEAD', { stdio: 'pipe' }).toString().trim();
hash = execSync('git log --pretty="%h" -1', { stdio: 'pipe' }).toString().trim(); hash = execSync('git log --pretty="%h" -1', { stdio: 'pipe' }).toString().trim();
// The builds in CI are done from a 'detached HEAD' state, thus the branch name will be 'HEAD' for CI builds. // The builds in CI are done from a 'detached HEAD' state, thus the branch name will be 'HEAD' for CI builds.
} catch (err) { } catch (error) {
// Don't display error object as it's a "fatal" error, but // Don't display error object as it's a "fatal" error, but
// not for us, since is it not critical information // not for us, since is it not critical information
// https://github.com/laurent22/joplin/issues/2256 // https://github.com/laurent22/joplin/issues/2256

View File

@ -10,6 +10,7 @@ import Setting from '@joplin/lib/models/Setting';
// We need this to suppress the useless warning // We need this to suppress the useless warning
// https://github.com/oblador/react-native-vector-icons/issues/1465 // https://github.com/oblador/react-native-vector-icons/issues/1465
// eslint-disable-next-line no-console
Icon.loadFont().catch((error: any) => { console.info(error); }); Icon.loadFont().catch((error: any) => { console.info(error); });
class CameraView extends Component { class CameraView extends Component {

View File

@ -11,6 +11,7 @@ export default function useOnMessage(onCheckboxChange: Function, noteBody: strin
// https://github.com/laurent22/joplin/issues/4494 // https://github.com/laurent22/joplin/issues/4494
const msg = event.nativeEvent.data; const msg = event.nativeEvent.data;
// eslint-disable-next-line no-console
console.info('Got IPC message: ', msg); console.info('Got IPC message: ', msg);
if (msg.indexOf('checkboxclick:') === 0) { if (msg.indexOf('checkboxclick:') === 0) {

View File

@ -315,6 +315,7 @@ function NoteEditor(props: Props, ref: any) {
const handlers: Record<string, Function> = { const handlers: Record<string, Function> = {
onLog: (event: any) => { onLog: (event: any) => {
// eslint-disable-next-line no-console
console.info('CodeMirror:', ...event.value); console.info('CodeMirror:', ...event.value);
}, },
@ -323,7 +324,6 @@ function NoteEditor(props: Props, ref: any) {
}, },
onUndoRedoDepthChange: (event: UndoRedoDepthChangeEvent) => { onUndoRedoDepthChange: (event: UndoRedoDepthChangeEvent) => {
console.info('onUndoRedoDepthChange', event);
props.onUndoRedoDepthChange(event); props.onUndoRedoDepthChange(event);
}, },
@ -355,6 +355,7 @@ function NoteEditor(props: Props, ref: any) {
if (handlers[msg.name]) { if (handlers[msg.name]) {
handlers[msg.name](msg.data); handlers[msg.name](msg.data);
} else { } else {
// eslint-disable-next-line no-console
console.info('Unsupported CodeMirror message:', msg); console.info('Unsupported CodeMirror message:', msg);
} }
}, [props.onSelectionChange, props.onUndoRedoDepthChange, props.onChange, editorControl]); }, [props.onSelectionChange, props.onUndoRedoDepthChange, props.onChange, editorControl]);

View File

@ -23,6 +23,7 @@ import CustomButton from './CustomButton';
// We need this to suppress the useless warning // We need this to suppress the useless warning
// https://github.com/oblador/react-native-vector-icons/issues/1465 // https://github.com/oblador/react-native-vector-icons/issues/1465
// eslint-disable-next-line no-console
Icon.loadFont().catch((error: any) => { console.info(error); }); Icon.loadFont().catch((error: any) => { console.info(error); });
// Rather than applying a padding to the whole bar, it is applied to each // Rather than applying a padding to the whole bar, it is applied to each

View File

@ -4,6 +4,7 @@ const { View, TouchableHighlight } = require('react-native');
const Icon = require('react-native-vector-icons/Ionicons').default; const Icon = require('react-native-vector-icons/Ionicons').default;
// We need this to suppress the useless warning // We need this to suppress the useless warning
// https://github.com/oblador/react-native-vector-icons/issues/1465 // https://github.com/oblador/react-native-vector-icons/issues/1465
// eslint-disable-next-line no-console
Icon.loadFont().catch((error) => { console.info(error); }); Icon.loadFont().catch((error) => { console.info(error); });
const styles = { const styles = {

View File

@ -542,6 +542,7 @@ class NoteScreenComponent extends BaseScreenComponent {
private async pickDocuments() { private async pickDocuments() {
const result = await shim.fsDriver().pickDocument({ multiple: true }); const result = await shim.fsDriver().pickDocument({ multiple: true });
if (!result) { if (!result) {
// eslint-disable-next-line no-console
console.info('pickDocuments: user has cancelled'); console.info('pickDocuments: user has cancelled');
} }
return result; return result;

View File

@ -11,6 +11,7 @@ const naturalCompare = require('string-natural-compare');
// We need this to suppress the useless warning // We need this to suppress the useless warning
// https://github.com/oblador/react-native-vector-icons/issues/1465 // https://github.com/oblador/react-native-vector-icons/issues/1465
// eslint-disable-next-line no-console
Icon.loadFont().catch((error) => { console.info(error); }); Icon.loadFont().catch((error) => { console.info(error); });
class NoteTagsDialogComponent extends React.Component { class NoteTagsDialogComponent extends React.Component {

View File

@ -17,6 +17,7 @@ import { AppState } from '../../utils/types';
// We need this to suppress the useless warning // We need this to suppress the useless warning
// https://github.com/oblador/react-native-vector-icons/issues/1465 // https://github.com/oblador/react-native-vector-icons/issues/1465
// eslint-disable-next-line no-console
Icon.loadFont().catch((error: any) => { console.info(error); }); Icon.loadFont().catch((error: any) => { console.info(error); });
class SearchScreenComponent extends BaseScreenComponent { class SearchScreenComponent extends BaseScreenComponent {

View File

@ -7,6 +7,7 @@ const { themeStyle } = require('./global-style.js');
// We need this to suppress the useless warning // We need this to suppress the useless warning
// https://github.com/oblador/react-native-vector-icons/issues/1465 // https://github.com/oblador/react-native-vector-icons/issues/1465
// eslint-disable-next-line no-console
Icon.loadFont().catch((error) => { console.info(error); }); Icon.loadFont().catch((error) => { console.info(error); });
class SideMenuContentNoteComponent extends Component { class SideMenuContentNoteComponent extends Component {

View File

@ -17,6 +17,7 @@ import { ProfileConfig } from '@joplin/lib/services/profileConfig/types';
// We need this to suppress the useless warning // We need this to suppress the useless warning
// https://github.com/oblador/react-native-vector-icons/issues/1465 // https://github.com/oblador/react-native-vector-icons/issues/1465
// eslint-disable-next-line no-console
Icon.loadFont().catch((error: any) => { console.info(error); }); Icon.loadFont().catch((error: any) => { console.info(error); });
interface Props { interface Props {

View File

@ -340,7 +340,7 @@ PODS:
- RCTTypeSafety - RCTTypeSafety
- React-Core - React-Core
- ReactCommon/turbomodule/core - ReactCommon/turbomodule/core
- react-native-slider (4.4.1): - react-native-slider (4.4.2):
- React-Core - React-Core
- react-native-sqlite-storage (6.0.1): - react-native-sqlite-storage (6.0.1):
- React-Core - React-Core
@ -726,7 +726,7 @@ SPEC CHECKSUMS:
react-native-rsa-native: 12132eb627797529fdb1f0d22fd0f8f9678df64a react-native-rsa-native: 12132eb627797529fdb1f0d22fd0f8f9678df64a
react-native-saf-x: 22bcd49188a04d6d6df254ca33085f26e28879c9 react-native-saf-x: 22bcd49188a04d6d6df254ca33085f26e28879c9
react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc
react-native-slider: a0d45ce5ea1be39f149954cae4367afff44d5a32 react-native-slider: 33b8d190b59d4f67a541061bb91775d53d617d9d
react-native-sqlite-storage: f6d515e1c446d1e6d026aa5352908a25d4de3261 react-native-sqlite-storage: f6d515e1c446d1e6d026aa5352908a25d4de3261
react-native-version-info: a106f23009ac0db4ee00de39574eb546682579b9 react-native-version-info: a106f23009ac0db4ee00de39574eb546682579b9
react-native-webview: 9f111dfbcfc826084d6c507f569e5e03342ee1c1 react-native-webview: 9f111dfbcfc826084d6c507f569e5e03342ee1c1

View File

@ -108,11 +108,11 @@ class BundledFile {
await writeFile(md5Path, newMd5, 'utf8'); await writeFile(md5Path, newMd5, 'utf8');
} }
private handleErrors(err: Error | undefined | null, stats: webpack.Stats | undefined): boolean { private handleErrors(error: Error | undefined | null, stats: webpack.Stats | undefined): boolean {
let failed = false; let failed = false;
if (err) { if (error) {
console.error(`Error: ${err.name}`, err.message, err.stack); console.error(`Error: ${error.name}`, error.message, error.stack);
failed = true; failed = true;
} else if (stats?.hasErrors() || stats?.hasWarnings()) { } else if (stats?.hasErrors() || stats?.hasWarnings()) {
const data = stats.toJson(); const data = stats.toJson();
@ -153,8 +153,8 @@ class BundledFile {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
console.info(`Building bundle: ${this.bundleName}...`); console.info(`Building bundle: ${this.bundleName}...`);
compiler.run((err, stats) => { compiler.run((error, stats) => {
let failed = this.handleErrors(err, stats); let failed = this.handleErrors(error, stats);
// Clean up. // Clean up.
compiler.close(async (error) => { compiler.close(async (error) => {
@ -180,8 +180,8 @@ class BundledFile {
}; };
console.info('Watching bundle: ', this.bundleName); console.info('Watching bundle: ', this.bundleName);
compiler.watch(watchOptions, async (err, stats) => { compiler.watch(watchOptions, async (error, stats) => {
const failed = this.handleErrors(err, stats); const failed = this.handleErrors(error, stats);
if (!failed) { if (!failed) {
await this.uglify(); await this.uglify();
await this.copyToImportableFile(); await this.copyToImportableFile();

View File

@ -296,6 +296,7 @@ export default class FsDriverRN extends FsDriverBase {
} }
} catch (error) { } catch (error) {
if (DocumentPicker.isCancel(error) || error?.message?.includes('cancel')) { if (DocumentPicker.isCancel(error) || error?.message?.includes('cancel')) {
// eslint-disable-next-line no-console
console.info('pickDocuments: user has cancelled'); console.info('pickDocuments: user has cancelled');
return null; return null;
} else { } else {

View File

@ -41,6 +41,8 @@ function shimInit() {
// uses the native XMLHttpRequest which is more likely to get the proper // uses the native XMLHttpRequest which is more likely to get the proper
// response and error message. // response and error message.
/* eslint-disable no-console */
shim.debugFetch = async (url, options = null) => { shim.debugFetch = async (url, options = null) => {
options = { options = {
method: 'GET', method: 'GET',
@ -81,6 +83,8 @@ function shimInit() {
}); });
}; };
/* eslint-enable */
shim.fetch = async function(url, options = null) { shim.fetch = async function(url, options = null) {
// The native fetch() throws an uncatchable error that crashes the // The native fetch() throws an uncatchable error that crashes the
// app if calling it with an invalid URL such as '//.resource' or // app if calling it with an invalid URL such as '//.resource' or

View File

@ -2,6 +2,7 @@ import joplin from 'api';
joplin.plugins.register({ joplin.plugins.register({
onStart: async function() { onStart: async function() {
// eslint-disable-next-line no-console
console.info('Hello world. Test plugin started!'); console.info('Hello world. Test plugin started!');
}, },
}); });

View File

@ -6,6 +6,8 @@
// update, you can easily restore the functionality you've added. // update, you can easily restore the functionality you've added.
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/* eslint-disable no-console */
const path = require('path'); const path = require('path');
const crypto = require('crypto'); const crypto = require('crypto');
const fs = require('fs-extra'); const fs = require('fs-extra');

View File

@ -5,7 +5,7 @@ class Cache {
const storage = await Cache.storage(); const storage = await Cache.storage();
output = await storage.getItem(name); output = await storage.getItem(name);
} catch (error) { } catch (error) {
console.info(error); // console.info(error);
// Defaults to returning null // Defaults to returning null
} }
return output; return output;

View File

@ -111,8 +111,8 @@ class SyncTargetAmazonS3 extends BaseSyncTarget {
new HeadBucketCommand({ new HeadBucketCommand({
Bucket: options.path(), Bucket: options.path(),
}), (err, response) => { }), (error, response) => {
if (err) reject(err); if (error) reject(error);
else resolve(response); else resolve(response);
}); });
}); });

View File

@ -119,6 +119,7 @@ export default class Database {
const queryId = this.queryId_++; const queryId = this.queryId_++;
if (this.profilingEnabled_) { if (this.profilingEnabled_) {
// eslint-disable-next-line no-console
console.info(`SQL START ${queryId}`, sql, params); console.info(`SQL START ${queryId}`, sql, params);
profilingTimeoutId = shim.setInterval(() => { profilingTimeoutId = shim.setInterval(() => {
@ -132,6 +133,7 @@ export default class Database {
shim.clearInterval(profilingTimeoutId); shim.clearInterval(profilingTimeoutId);
profilingTimeoutId = null; profilingTimeoutId = null;
const elapsed = Date.now() - callStartTime; const elapsed = Date.now() - callStartTime;
// eslint-disable-next-line no-console
if (elapsed > 10) console.info(`SQL END ${queryId}`, elapsed, sql, params); if (elapsed > 10) console.info(`SQL END ${queryId}`, elapsed, sql, params);
} }

View File

@ -65,8 +65,8 @@ class FileApiDriverAmazonS3 {
Prefix: key, Prefix: key,
Delimiter: '/', Delimiter: '/',
ContinuationToken: cursor, ContinuationToken: cursor,
}), (err, response) => { }), (error, response) => {
if (err) reject(err); if (error) reject(error);
else resolve(response); else resolve(response);
}); });
}); });
@ -78,8 +78,8 @@ class FileApiDriverAmazonS3 {
this.api().send(new HeadObjectCommand({ this.api().send(new HeadObjectCommand({
Bucket: this.s3_bucket_, Bucket: this.s3_bucket_,
Key: key, Key: key,
}), (err, response) => { }), (error, response) => {
if (err) reject(err); if (error) reject(error);
else resolve(response); else resolve(response);
}); });
}); });
@ -91,8 +91,8 @@ class FileApiDriverAmazonS3 {
Bucket: this.s3_bucket_, Bucket: this.s3_bucket_,
Key: key, Key: key,
Body: body, Body: body,
}), (err, response) => { }), (error, response) => {
if (err) reject(err); if (error) reject(error);
else resolve(response); else resolve(response);
}); });
}); });
@ -108,8 +108,8 @@ class FileApiDriverAmazonS3 {
Key: key, Key: key,
Body: Buffer.from(body, 'base64'), Body: Buffer.from(body, 'base64'),
ContentLength: `${fileStat.size}`, ContentLength: `${fileStat.size}`,
}), (err, response) => { }), (error, response) => {
if (err) reject(err); if (error) reject(error);
else resolve(response); else resolve(response);
}); });
}); });
@ -121,11 +121,10 @@ class FileApiDriverAmazonS3 {
Bucket: this.s3_bucket_, Bucket: this.s3_bucket_,
Key: key, Key: key,
}), }),
(err, response) => { (error, response) => {
if (err) { if (error) {
console.log(err.code); console.error(error);
console.log(err.message); reject(error);
reject(err);
} else { resolve(response); } } else { resolve(response); }
}); });
}); });
@ -138,11 +137,10 @@ class FileApiDriverAmazonS3 {
Bucket: this.s3_bucket_, Bucket: this.s3_bucket_,
Delete: { Objects: keys }, Delete: { Objects: keys },
}), }),
(err, response) => { (error, response) => {
if (err) { if (error) {
console.log(err.code); console.error(error);
console.log(err.message); reject(error);
reject(err);
} else { resolve(response); } } else { resolve(response); }
}); });
}); });
@ -353,8 +351,8 @@ class FileApiDriverAmazonS3 {
Bucket: this.s3_bucket_, Bucket: this.s3_bucket_,
CopySource: this.makePath_(oldPath), CopySource: this.makePath_(oldPath),
Key: newPath, Key: newPath,
}), (err, response) => { }), (error, response) => {
if (err) reject(err); if (error) reject(error);
else resolve(response); else resolve(response);
}); });
}); });
@ -383,8 +381,8 @@ class FileApiDriverAmazonS3 {
return this.api().send(new ListObjectsV2Command({ return this.api().send(new ListObjectsV2Command({
Bucket: this.s3_bucket_, Bucket: this.s3_bucket_,
ContinuationToken: cursor, ContinuationToken: cursor,
}), (err, response) => { }), (error, response) => {
if (err) reject(err); if (error) reject(error);
else resolve(response); else resolve(response);
}); });
}); });

View File

@ -54,6 +54,7 @@ describe('import-enex-md-gen', function() {
result.push('--------------------------------------------'); result.push('--------------------------------------------');
result.push(''); result.push('');
// eslint-disable-next-line no-console
console.info(result.join('\n')); console.info(result.join('\n'));
expect(false).toBe(true); expect(false).toBe(true);

View File

@ -200,8 +200,8 @@ export default class KeymapService extends BaseService {
// Refresh the menu items so that the changes are reflected // Refresh the menu items so that the changes are reflected
eventManager.emit('keymapChange'); eventManager.emit('keymapChange');
} catch (err) { } catch (error) {
const message = err.message || ''; const message = error.message || '';
throw new Error(_('Error: %s', message)); throw new Error(_('Error: %s', message));
} }
} }
@ -305,9 +305,9 @@ export default class KeymapService extends BaseService {
// Validate the entire keymap for duplicates // Validate the entire keymap for duplicates
// Throws whenever there are duplicate Accelerators used in the keymap // Throws whenever there are duplicate Accelerators used in the keymap
this.validateKeymap(); this.validateKeymap();
} catch (err) { } catch (error) {
this.resetKeymap(); // Discard all the changes if there are any issues this.resetKeymap(); // Discard all the changes if there are any issues
throw err; throw error;
} }
} }

View File

@ -99,6 +99,7 @@ export default async function populateDatabase(db: any, options: Options = null)
if (!folderDepthToId[depth]) folderDepthToId[depth] = []; if (!folderDepthToId[depth]) folderDepthToId[depth] = [];
folderDepthToId[depth].push(savedFolder.id); folderDepthToId[depth].push(savedFolder.id);
// eslint-disable-next-line no-console
if (!options.silent) console.info(`Folders: ${i} / ${options.folderCount}`); if (!options.silent) console.info(`Folders: ${i} / ${options.folderCount}`);
} }
@ -108,6 +109,7 @@ export default async function populateDatabase(db: any, options: Options = null)
// eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied // eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied
tagBatch.push(Tag.save({ title: tagTitle }, { dispatchUpdateAction: false }).then((savedTag: any) => { tagBatch.push(Tag.save({ title: tagTitle }, { dispatchUpdateAction: false }).then((savedTag: any) => {
createdTagIds.push(savedTag.id); createdTagIds.push(savedTag.id);
// eslint-disable-next-line no-console
if (!options.silent) console.info(`Tags: ${i} / ${options.tagCount}`); if (!options.silent) console.info(`Tags: ${i} / ${options.tagCount}`);
})); }));
@ -131,6 +133,7 @@ export default async function populateDatabase(db: any, options: Options = null)
// eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied // eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied
noteBatch.push(Note.save(note, { dispatchUpdateAction: false }).then((savedNote: any) => { noteBatch.push(Note.save(note, { dispatchUpdateAction: false }).then((savedNote: any) => {
createdNoteIds.push(savedNote.id); createdNoteIds.push(savedNote.id);
// eslint-disable-next-line no-console
console.info(`Notes: ${i} / ${options.noteCount}`); console.info(`Notes: ${i} / ${options.noteCount}`);
})); }));

View File

@ -23,6 +23,7 @@ export async function createTestData() {
} }
export async function printTestData() { export async function printTestData() {
// eslint-disable-next-line no-console
console.info(JSON.stringify(await createTestData(), null, '\t')); console.info(JSON.stringify(await createTestData(), null, '\t'));
} }
@ -76,6 +77,7 @@ export async function checkTestData(data: TestData, options: CheckTestDataOption
if (hasError) { if (hasError) {
console.warn(msg); console.warn(msg);
} else { } else {
// eslint-disable-next-line no-console
if (!options.silent) console.info(msg); if (!options.silent) console.info(msg);
} }
} }
@ -103,6 +105,7 @@ const desktopData = {
export const runIntegrationTests = async (silent: boolean = false) => { export const runIntegrationTests = async (silent: boolean = false) => {
const log = (s: string) => { const log = (s: string) => {
if (silent) return; if (silent) return;
// eslint-disable-next-line no-console
console.info(s); console.info(s);
}; };

View File

@ -41,11 +41,11 @@ export default class ViewController {
} }
public async emitMessage(event: EmitMessageEvent): Promise<any> { public async emitMessage(event: EmitMessageEvent): Promise<any> {
console.info('Calling ViewController.emitMessage - but not implemented', event); console.warn('Calling ViewController.emitMessage - but not implemented', event);
} }
public postMessage(message: any) { public postMessage(message: any) {
console.info('Calling ViewController.postMessage - but not implemented', message); console.warn('Calling ViewController.postMessage - but not implemented', message);
} }
} }

View File

@ -1,3 +1,5 @@
/* eslint-disable id-denylist */
import time from '../../time'; import time from '../../time';
interface Term { interface Term {

View File

@ -24,7 +24,7 @@ const proxySettings = {};
function fileExists(filePath) { function fileExists(filePath) {
try { try {
return fs.statSync(filePath).isFile(); return fs.statSync(filePath).isFile();
} catch (err) { } catch (error) {
return false; return false;
} }
} }
@ -232,9 +232,9 @@ function shimInit(options = null) {
fit: 'inside', fit: 'inside',
withoutEnlargement: true, withoutEnlargement: true,
}) })
.toFile(targetPath, (err, info) => { .toFile(targetPath, (error, info) => {
if (err) { if (error) {
reject(err); reject(error);
} else { } else {
resolve(info); resolve(info);
} }

View File

@ -134,5 +134,6 @@ export async function main(syncTargetType: string) {
await fs.mkdirp(destDir); await fs.mkdirp(destDir);
await fs.copy(syncDir, destDir); await fs.copy(syncDir, destDir);
// eslint-disable-next-line no-console
console.info(`Sync target snapshot created in: ${destDir}`); console.info(`Sync target snapshot created in: ${destDir}`);
} }

View File

@ -65,7 +65,6 @@ export default function versionInfo(packageInfo: any, plugins: Plugins) {
if (gitInfo) { if (gitInfo) {
body.push(`\n${gitInfo}`); body.push(`\n${gitInfo}`);
console.info(gitInfo);
} }
const pluginList = getPluginLists(plugins); const pluginList = getPluginLists(plugins);

View File

@ -10,9 +10,9 @@ const pdfFilePath1 = resolve('config/welcome.pdf');
function loadFile(filePath: string) { function loadFile(filePath: string) {
return new Promise<Uint8Array>((resolve, reject) => { return new Promise<Uint8Array>((resolve, reject) => {
readFile(filePath, (err, data) => { readFile(filePath, (error, data) => {
if (err) { if (error) {
reject(err); reject(error);
} else { } else {
resolve(new Uint8Array((data))); resolve(new Uint8Array((data)));
} }

View File

@ -1,3 +1,5 @@
/* eslint-disable no-console */
import { githubOauthToken } from '@joplin/tools/tool-utils'; import { githubOauthToken } from '@joplin/tools/tool-utils';
import { pathExists, readdir, readFile, stat, writeFile } from 'fs-extra'; import { pathExists, readdir, readFile, stat, writeFile } from 'fs-extra';

View File

@ -1,5 +1,7 @@
#!/usr/bin/env node #!/usr/bin/env node
/* eslint-disable no-console */
require('source-map-support').install(); require('source-map-support').install();
import * as fs from 'fs-extra'; import * as fs from 'fs-extra';

View File

@ -6,6 +6,8 @@
// update, you can easily restore the functionality you've added. // update, you can easily restore the functionality you've added.
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/* eslint-disable no-console */
const path = require('path'); const path = require('path');
const crypto = require('crypto'); const crypto = require('crypto');
const fs = require('fs-extra'); const fs = require('fs-extra');

View File

@ -41,6 +41,7 @@ export async function up(db: DbConnection): Promise<any> {
if (!items.length) break; if (!items.length) break;
// eslint-disable-next-line no-console
console.info(`Processing items ${itemDone} / ${itemCount}`); console.info(`Processing items ${itemDone} / ${itemCount}`);
await db.transaction(async trx => { await db.transaction(async trx => {

View File

@ -220,6 +220,7 @@ export default abstract class BaseModel<T> {
txIndex = await this.transactionHandler_.start(name); txIndex = await this.transactionHandler_.start(name);
// eslint-disable-next-line no-console
if (debugSteps) console.info('START', name, txIndex); if (debugSteps) console.info('START', name, txIndex);
let output: T = null; let output: T = null;
@ -227,6 +228,7 @@ export default abstract class BaseModel<T> {
try { try {
output = await fn(); output = await fn();
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
if (debugSteps) console.info('ROLLBACK', name, txIndex); if (debugSteps) console.info('ROLLBACK', name, txIndex);
await this.transactionHandler_.rollback(txIndex); await this.transactionHandler_.rollback(txIndex);
@ -236,6 +238,7 @@ export default abstract class BaseModel<T> {
if (debugTimerId) clearTimeout(debugTimerId); if (debugTimerId) clearTimeout(debugTimerId);
} }
// eslint-disable-next-line no-console
if (debugSteps) console.info('COMMIT', name, txIndex); if (debugSteps) console.info('COMMIT', name, txIndex);
await this.transactionHandler_.commit(txIndex); await this.transactionHandler_.commit(txIndex);

View File

@ -1,3 +1,5 @@
/* eslint-disable no-console */
import config from '../../config'; import config from '../../config';
import { clearDatabase, createTestUsers, CreateTestUsersOptions, createUserDeletions } from '../../tools/debugTools'; import { clearDatabase, createTestUsers, CreateTestUsersOptions, createUserDeletions } from '../../tools/debugTools';
import { bodyFields } from '../../utils/requestUtils'; import { bodyFields } from '../../utils/requestUtils';

View File

@ -1,3 +1,5 @@
/* eslint-disable no-console */
import sqlts from '@rmp135/sql-ts'; import sqlts from '@rmp135/sql-ts';
require('source-map-support').install(); require('source-map-support').install();

View File

@ -35,6 +35,7 @@ export default class TransactionHandler {
private log(s: string): void { private log(s: string): void {
if (!this.logEnabled_) return; if (!this.logEnabled_) return;
// eslint-disable-next-line no-console
console.info(`TransactionHandler: ${s}`); console.info(`TransactionHandler: ${s}`);
} }

View File

@ -66,6 +66,7 @@ export default async function setupCommands(): Promise<Commands> {
if (cmdName && !selectedCommand) { if (cmdName && !selectedCommand) {
yargs.showHelp(); yargs.showHelp();
// eslint-disable-next-line no-console
console.info(''); console.info('');
throw new Error(`Invalid command: ${cmdName}`); throw new Error(`Invalid command: ${cmdName}`);
} }

View File

@ -1,3 +1,5 @@
/* eslint-disable no-console */
import * as fs from 'fs-extra'; import * as fs from 'fs-extra';
require('source-map-support').install(); require('source-map-support').install();

View File

@ -50,5 +50,6 @@ export function timerPush(name: string) {
export function timerPop() { export function timerPop() {
const t = perfTimers_.pop(); const t = perfTimers_.pop();
// eslint-disable-next-line no-console
console.info(`Time: ${t.name}: ${Date.now() - t.startTime}`); console.info(`Time: ${t.name}: ${Date.now() - t.startTime}`);
} }

View File

@ -33,7 +33,7 @@ module.exports = async function compilePackageInfo(packageInfoPath, outputPath)
branch = execSync('git rev-parse --abbrev-ref HEAD', { stdio: 'pipe' }).toString().trim(); branch = execSync('git rev-parse --abbrev-ref HEAD', { stdio: 'pipe' }).toString().trim();
hash = execSync('git log --pretty="%h" -1', { stdio: 'pipe' }).toString().trim(); hash = execSync('git log --pretty="%h" -1', { stdio: 'pipe' }).toString().trim();
// The builds in CI are done from a 'detached HEAD' state, thus the branch name will be 'HEAD' for CI builds. // The builds in CI are done from a 'detached HEAD' state, thus the branch name will be 'HEAD' for CI builds.
} catch (err) { } catch (error) {
// Don't display error object as it's a "fatal" error, but // Don't display error object as it's a "fatal" error, but
// not for us, since is it not critical information // not for us, since is it not critical information
// https://github.com/laurent22/joplin/issues/2256 // https://github.com/laurent22/joplin/issues/2256

View File

@ -299,13 +299,13 @@ export function fileExists(filePath: string) {
const fs = require('fs-extra'); const fs = require('fs-extra');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fs.stat(filePath, function(err: any) { fs.stat(filePath, function(error: any) {
if (!err) { if (!error) {
resolve(true); resolve(true);
} else if (err.code === 'ENOENT') { } else if (error.code === 'ENOENT') {
resolve(false); resolve(false);
} else { } else {
reject(err); reject(error);
} }
}); });
}); });