actor-templates icon indicating copy to clipboard operation
actor-templates copied to clipboard

JavaScript: eslint no-console

Open LouisDeconinck opened this issue 2 months ago • 1 comments

When building a JavaScript Apify actor, I believe using console.log() is valid.

The empty template contains this code:

// eslint-disable-next-line no-console
console.log('Hello from the Actor!');

Wouldn't it be better to just disable the no-console eslint rule?

I propose to change the eslint.config.mjs default contents to:

import prettier from 'eslint-config-prettier';

import apify from '@apify/eslint-config/js.js';

export default [
    { ignores: ['**/dist'] },   
    ...apify,
    prettier,
    {
        rules: {
            'no-console': 'off',
            'import/no-default-export': 'off'
        }
    }
];

LouisDeconinck avatar Oct 21 '25 17:10 LouisDeconinck

I'd disagree with that, for Actors you should be using the logger we provide as part of both crawlee and the SDK (log export), not console.log directly. I would personally consider console.log as a debugging thing, that's why we disallow it through the linter.

B4nan avatar Oct 21 '25 18:10 B4nan