Console Log Sage 9 eslint

I have tried this: Enable console.log with eslint

But still receive error: unexpected console statement no-console

Copy of .eslintrc:
{
“root”: false,
“rules”: {
“no-console”: off,
“import/no-extraneous-dependencies”: 0,
“prefer-rest-params”: 0,
“comma-dangle”: [“error”, {
“arrays”: “always-multiline”,
“objects”: “always-multiline”,
“imports”: “always-multiline”,
“exports”: “always-multiline”,
“functions”: “ignore”
}]
}
}

I’ve restarted the build with yarn build and yarn start many times. Still throws a no console error.

On sage 9 beta 3.

Any help appreciated. Cheers.

Put this in your rules:

"rules": {
      "comma-dangle": [
        "error",
        {
          "arrays": "always-multiline",
          "objects": "always-multiline",
          "imports": "always-multiline",
          "exports": "always-multiline",
          "functions": "ignore"
        }
      ],
      "no-console": "warn"
    }

Or if you want to completely turn it off, set it to "off" as a string

No dice. I still get the same error.

I’ve been adding: /* eslint-disable */ to the top of my pages to get around it for development. No idea why “no-console” rule isn’t working.

Both settings work for me without any issue.
If you’re using the latest version of sage remember to put these settings in your package.json

2 Likes

first setting didn’t work for me. However, adding it to the package.json did the trick. Thanks mate!

1 Like

@Nicolo, or anyone, are we saying that the sage\resources\assets\build\.eslintrc file is not used by Sage 9?

Can someone update* the repo to remove that, to prevent users from repetitively failing to grok why their changes are being ignored??

*I honestly don’t know how to pull request, if there’s a 101 I can do I’ll delete it myself.

+1

Took some time today to find out why additions to .eslintrc weren’t working. Perhaps it should be removed.

Thanks, done: https://github.com/roots/sage/commit/80a00245ab78c0ad61404c4858e3b35f4cc3268f