actor-templates
actor-templates copied to clipboard
JavaScript: eslint no-console
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'
}
}
];
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.