pfaffman
(Jay Pfaffman)
December 14, 2023, 4:00pm
1
/home/runner/work/discourse-custom-homepage-for-groups/discourse-custom-homepage-for-groups/javascripts/discourse/initializers/custom-homepage-set.js.es6
Error: 13:11 error 'settings' is not defined no-undef
Error: 14:21 error 'settings' is not defined no-undef
Error: 19:20 error 'settings' is not defined no-undef
Error: 20:21 error 'settings' is not defined no-undef
Error: 25:36 error 'settings' is not defined no-undef
Error: 26:21 error 'settings' is not defined no-undef
Error: 32:40 error 'settings' is not defined no-undef
Error: 33:26 error 'settings' is not defined no-undef
import mobile from "discourse/lib/mobile";
import { withPluginApi } from "discourse/lib/plugin-api";
import PreloadStore from "discourse/lib/preload-store";
export default {
name: "discourse-custom-homepage",
initialize() {
withPluginApi("0.11.4", (api) => {
// const router = container.lookup("router:main");
const user = api.getCurrentUser();
const { setDefaultHomepage } = require("discourse/lib/utilities");
if (settings.custom_default_homepage) {
const url = settings.custom_default_homepage.replace(/^\/+/g, '');
setDefaultHomepage(url);
PreloadStore.remove("topic_list");
}
if (!user && settings.anon_page) {
const url = settings.anon_page.replace(/^\/+/g, '');
This file has been truncated. show original
Right. I’m using settings. How do I convince eslint
that they are defined? I’ve looked at a bunch of other exemplars (like discourse-brand-header/javascripts/discourse/initializers/initialize-mobile-decorator.js at main · discourse/discourse-brand-header · GitHub ) and tney don’t seem to be defining settings.
david
(David Taylor)
December 14, 2023, 4:07pm
3
In theory this should be handled by the eslint config you’re importing from our shared lint-configs
But it seems like that’s not working for some reason…
2 Likes
merefield
(Robert)
December 14, 2023, 4:08pm
4
Yeah, make sure you read this @pfaffman if you’ve not done so already
# @discourse/lint-configs
Shareable lint configs for Discourse core, plugins, and themes
## Usage
Add `@discourse/lint-configs` to package.json, and create these three files:
### .eslintrc.cjs
```js
module.exports = require("@discourse/lint-configs/eslint");
```
or in themes/theme components:
```js
module.exports = require("@discourse/lint-configs/eslint-theme");
```
This file has been truncated. show original
CvX
(Jarek Radosz)
December 14, 2023, 4:11pm
5
Hm, maybe there’s an incompatibility between the newest eslint config and es6 files. Could you see if the errors persist after dropping the .es6 suffixes?
4 Likes
pfaffman
(Jay Pfaffman)
December 14, 2023, 5:16pm
6
Rather than reading that, I copied the stuff blindly from the theme skeleton. I think I did one time find that, which explains some of the mystery.
You are very kind to suggest that my theory was not without merit.
Aha. So is there some reason not to do a global rename of all of my es6 files everywhere?
1 Like
pfaffman
(Jay Pfaffman)
Closed
January 13, 2024, 5:17pm
7
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.