Skip to content

Commit 965e935

Browse files
[linter] Review linter setup (#3783)
- [2b395b9] Fix command to lint markdown in `CONTRIBUTING.md` - [fed4c86] Re-activate JSDoc ESLint plugin and fix linting issues (As far as I remember, we deactivated it when we upgraded to ESLint 9 because it was not compatible with it. But its now.) - [a3d2064] Refactor ESLint config to use `defineConfig` and `globalIgnores` ([these are like new defaults](https://eslint.org/blog/2025/03/flat-config-extends-define-config-global-ignores/)) - [a3d2064] Replace `eslint-plugin-import` with `eslint-plugin-import-x` (https://github.com/es-tooling/module-replacements/blob/main/docs/modules/eslint-plugin-import.md) - [86a185b] Switch Stylelint config to flat format and simplify Stylelint scripts (like we already did for ESLint and prettier) - [f5a2c54] Fix some typos
1 parent 2422e84 commit 965e935

13 files changed

Lines changed: 495 additions & 393 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ To run ESLint, use `node --run lint:js`.
1818

1919
### CSS: Run StyleLint
2020

21-
We use [StyleLint](https://stylelint.io) to lint our CSS. The configuration is in our `.stylelintrc.json` file.
21+
We use [StyleLint](https://stylelint.io) to lint our CSS. The configuration is in our `stylelint.config.mjs` file.
2222

2323
To run StyleLint, use `node --run lint:css`.
2424

2525
### Markdown: Run markdownlint
2626

2727
We use [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) to lint our markdown files. The configuration is in our `.markdownlint.json` file.
2828

29-
To run markdownlint, use `node --run markdownlint:css`.
29+
To run markdownlint, use `node --run lint:markdown`.
3030

3131
## Testing
3232

.stylelintrc.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,33 @@ planned for 2025-07-01
1313

1414
### Added
1515

16-
- [config] Allow to change module order for final renderer (or dynamicaly with CSS): Feature `order` in config. (#3762)
16+
- [config] Allow to change module order for final renderer (or dynamically with CSS): Feature `order` in config (#3762)
1717
- [clock] Added option 'disableNextEvent' to hide next sun event (#3769)
1818

1919
### Changed
2020

2121
- [refactor] Simplify module loading process (#3766)
22-
- Use `node --run` instead of `npm run` (#3764) and adapt `start:dev` script.
23-
- [workflow] Run linter und spellcheck with LTS node version (#3767)
22+
- Use `node --run` instead of `npm run` (#3764) and adapt `start:dev` script (#3773)
23+
- [workflow] Run linter and spellcheck with LTS node version (#3767)
2424
- [workflow] Split "Run test" step into two steps for more clarity (#3767)
25+
- [linter] Review linter setup (#3783)
26+
- Fix command to lint markdown in `CONTRIBUTING.md`
27+
- Re-activate JSDoc linting and fix linting issues
28+
- Refactor ESLint config to use `defineConfig` and `globalIgnores`
29+
- Replace `eslint-plugin-import` with `eslint-plugin-import-x`
30+
- Switch Stylelint config to flat format and simplify Stylelint scripts
31+
32+
### Fixed
33+
34+
- [fix] Handle spellcheck issues (#3783)
2535

2636
### Fixed
2737

2838
- [calendar] fix fullday event rrule until with timezone offset (#3781)
2939

3040
### Updated
3141

32-
- [core] Update dependencies
42+
- [core] Update dependencies (#3774)
3343

3444
## [2.31.0] - 2025-04-01
3545

@@ -40,7 +50,7 @@ Thanks to: @Developer-Incoming, @eltociear, @geraki, @khassel, @KristjanESPERANT
4050
### Added
4151

4252
- Add CSS support to the digital clock hour/minute/second through the use of the classes `clock-hour-digital`, `clock-minute-digital`, and `clock-second-digital`.
43-
- Add Arabic (#3719) and Esperanto translation.
53+
- Add Arabic (#3719) and Esperanto translation (#3740)
4454
- Mark option `secondsColor` as deprecated in clock module.
4555
- Add Greek translation to Alerts module.
4656
- [newsfeed] Add specific ignoreOlderThan value (override) per feed (#3360)
@@ -50,7 +60,7 @@ Thanks to: @Developer-Incoming, @eltociear, @geraki, @khassel, @KristjanESPERANT
5060

5161
### Changed
5262

53-
- [core] Starting clientonly now checks for needed env var `WAYLAND_DISPLAY` or `DISPLAY` and starts electron with needed parameters (if both are set wayland is used) (#3677)
63+
- [core] Starting clientonly now checks for needed env var `WAYLAND_DISPLAY` or `DISPLAY` and starts electron with needed parameters (if both are set Wayland is used) (#3677)
5464
- [core] Optimize systeminformation calls and output (#3689)
5565
- [core] Add issue templates for feature requests and bug reports (#3695)
5666
- [core] Adapt `start:x11:dev` script
@@ -88,7 +98,7 @@ Thanks to: @xsorifc28, @HeikoGr, @bugsounet, @khassel, @KristjanESPERANTO, @reja
8898
8999
### Added
90100

91-
- [core] Add wayland and windows start options to `package.json` (#3594)
101+
- [core] Add Wayland and Windows start options to `package.json` (#3594)
92102
- [docs] Add step for npm publishing in release process (#3595)
93103
- [core] Add GitHub workflow to run spellcheck a few days before each release (#3623)
94104
- [core] Add test flag to `index.html` to pass to module js for test mode detection (needed by #3630)

cspell.config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"Edgardos",
6060
"Ekristoffe",
6161
"elec",
62+
"eltociear",
6263
"envcanada",
6364
"envsub",
6465
"envsubst",
@@ -82,6 +83,7 @@
8283
"fulldate",
8384
"fullday",
8485
"fullscreen",
86+
"geraki",
8587
"Gevoelstemperatuur",
8688
"GHSA",
8789
"ghsas",
@@ -143,6 +145,7 @@
143145
"Midori",
144146
"mirontoli",
145147
"MISSINGLANG",
148+
"mixasgr",
146149
"MMPM",
147150
"modernizr",
148151
"modulename",
@@ -183,6 +186,7 @@
183186
"rohitdharavath",
184187
"Rosso",
185188
"rrule",
189+
"savvadam",
186190
"sdetweil",
187191
"sendheaders",
188192
"serveronly",

eslint.config.mjs

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
import eslintPluginImport from "eslint-plugin-import";
2-
import eslintPluginJest from "eslint-plugin-jest";
3-
import eslintPluginJs from "@eslint/js";
4-
import eslintPluginPackageJson from "eslint-plugin-package-json";
5-
import eslintPluginStylistic from "@stylistic/eslint-plugin";
1+
import {defineConfig, globalIgnores} from "eslint/config";
62
import globals from "globals";
3+
import {flatConfigs as importX} from "eslint-plugin-import-x";
4+
import jest from "eslint-plugin-jest";
5+
import js from "@eslint/js";
6+
import jsdoc from "eslint-plugin-jsdoc";
7+
import packageJson from "eslint-plugin-package-json";
8+
import stylistic from "@stylistic/eslint-plugin";
79

8-
const config = [
9-
eslintPluginImport.flatConfigs.recommended,
10-
eslintPluginJest.configs["flat/recommended"],
11-
eslintPluginJs.configs.recommended,
12-
eslintPluginPackageJson.configs.recommended,
13-
eslintPluginStylistic.configs.all,
10+
export default defineConfig([
11+
globalIgnores(["config/**", "modules/**/*", "!modules/default/**", "js/positions.js"]),
1412
{
1513
files: ["**/*.js"],
1614
languageOptions: {
1715
ecmaVersion: "latest",
1816
globals: {
1917
...globals.browser,
2018
...globals.node,
21-
...globals.jest,
2219
Log: "readonly",
2320
MM: "readonly",
2421
Module: "readonly",
2522
config: "readonly",
2623
moment: "readonly"
2724
}
2825
},
26+
plugins: {js, jsdoc, stylistic},
27+
extends: [importX.recommended, jest.configs["flat/recommended"], "js/recommended", jsdoc.configs["flat/recommended"], "stylistic/all"],
2928
rules: {
3029
"@stylistic/array-element-newline": ["error", "consistent"],
3130
"@stylistic/arrow-parens": ["error", "always"],
@@ -54,9 +53,9 @@ const config = [
5453
"dot-notation": "error",
5554
eqeqeq: "error",
5655
"id-length": "off",
57-
"import/extensions": "error",
58-
"import/newline-after-import": "error",
59-
"import/order": "error",
56+
"import-x/extensions": "error",
57+
"import-x/newline-after-import": "error",
58+
"import-x/order": "error",
6059
"init-declarations": "off",
6160
"jest/consistent-test-it": "warn",
6261
"jest/no-done-callback": "warn",
@@ -81,11 +80,15 @@ const config = [
8180
"no-warning-comments": "off",
8281
"object-shorthand": ["error", "methods"],
8382
"one-var": "off",
84-
"prefer-destructuring": "off",
8583
"prefer-template": "error",
8684
"sort-keys": "off"
8785
}
8886
},
87+
{
88+
files: ["**/package.json"],
89+
plugins: {packageJson},
90+
extends: ["packageJson/recommended"]
91+
},
8992
{
9093
files: ["**/*.mjs"],
9194
languageOptions: {
@@ -95,30 +98,25 @@ const config = [
9598
},
9699
sourceType: "module"
97100
},
101+
plugins: {js, stylistic},
102+
extends: [importX.recommended, "js/all", "stylistic/all"],
98103
rules: {
99104
"@stylistic/array-element-newline": "off",
100105
"@stylistic/indent": ["error", "tab"],
106+
"@stylistic/object-property-newline": ["error", {allowAllPropertiesOnSameLine: true}],
101107
"@stylistic/padded-blocks": ["error", "never"],
102108
"@stylistic/quote-props": ["error", "as-needed"],
103-
"func-style": "off",
104-
"import/namespace": "off",
105-
"import/no-unresolved": "off",
109+
"import-x/no-unresolved": ["error", {ignore: ["eslint/config"]}],
106110
"max-lines-per-function": ["error", 100],
107111
"no-magic-numbers": "off",
108-
"one-var": "off",
109-
"prefer-destructuring": "off",
110-
"sort-keys": "error"
112+
"one-var": ["error", "never"],
113+
"sort-keys": "off"
111114
}
112115
},
113116
{
114117
files: ["tests/configs/modules/weather/*.js"],
115118
rules: {
116119
"@stylistic/quotes": "off"
117120
}
118-
},
119-
{
120-
ignores: ["config/**", "modules/**/*", "!modules/default/**", "js/positions.js"]
121121
}
122-
];
123-
124-
export default config;
122+
]);

js/check_config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ function checkConfigFile () {
7272
}
7373
}
7474

75+
/**
76+
*
77+
* @param {string} configFileName - The path and filename of the configuration file to validate.
78+
*/
7579
function validateModulePositions (configFileName) {
7680
Log.info("Checking modules structure configuration ...");
7781

modules/default/calendar/calendarfetcherutils.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,10 @@ const CalendarFetcherUtils = {
509509
},
510510

511511
/**
512-
* fixup thew event fields that have dates to use local time
513-
* BEFORE calling rrule.between
514-
* @param the event being processed
515-
* @returns nothing
512+
* Fixes the event fields that have dates to use local time
513+
* before calling rrule.between.
514+
* @param {object} event - The event being processed.
515+
* @returns {void}
516516
*/
517517
fixEventtoLocal (event) {
518518
// if there are excluded dates, their date is incorrect and possibly key as well.
@@ -549,9 +549,9 @@ const CalendarFetcherUtils = {
549549
/**
550550
* convert a UTC date to local time
551551
* BEFORE calling rrule.between
552-
* @param date ti conert
553-
* tz event is currently in
554-
* @returns updated date object
552+
* @param {Date} date The date to convert
553+
* @param {string} tz The timezone string to convert the date to.
554+
* @returns {Date} updated date object
555555
*/
556556
convertDateToLocalTime (date, tz) {
557557
let delta_tz_offset = 0;
@@ -592,8 +592,8 @@ const CalendarFetcherUtils = {
592592
/**
593593
* get the exdate/recurrence hash key from the date object
594594
* BEFORE calling rrule.between
595-
* @param the date of the event
596-
* @returns string date key YYYY-MM-DD
595+
* @param {Date} date The date of the event
596+
* @returns {string} date key in the format YYYY-MM-DD
597597
*/
598598
getDateKeyFromDate (date) {
599599
// get our runtime timezone offset
@@ -618,9 +618,8 @@ const CalendarFetcherUtils = {
618618

619619
/**
620620
* get the timezone offset from the timezone string
621-
*
622-
* @param the timezone string
623-
* @returns the numerical offset
621+
* @param {string} timeZone The timezone string
622+
* @returns {number} The numerical offset in minutes from UTC.
624623
*/
625624
getTimezoneOffsetFromTimezone (timeZone) {
626625
const str = new Date().toLocaleString("en", { timeZone, timeZoneName: "longOffset" });
@@ -631,10 +630,10 @@ const CalendarFetcherUtils = {
631630

632631
/**
633632
* fixup the date start moment after rrule.between returns date array
634-
*
635-
* @param date object from rrule.between results
633+
* @param {Date} date object from rrule.between results
636634
* the event object it came from
637-
* @returns moment object
635+
* @param {object} event - The event object it came from.
636+
* @returns {Moment} moment object
638637
*/
639638
getAdjustedStartMoment (date, event) {
640639

modules/default/newsfeed/newsfeed.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ Module.register("newsfeed", {
181181
* Gets a feed property by name
182182
* @param {object} feed A feed object.
183183
* @param {string} property The name of the property.
184+
* @returns {*} The value of the specified property for the feed.
184185
*/
185186
getFeedProperty (feed, property) {
186187
let res = this.config[property];

modules/default/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @param {boolean} useCorsProxy A flag to indicate
66
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
77
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
8-
* @param {string} basePath, default /
8+
* @param {string} basePath The base path, default is "/"
99
* @returns {Promise} resolved when the fetch is done. The response headers is placed in a headers-property (provided the response does not already contain a headers-property).
1010
*/
1111
async function performWebRequest (url, type = "json", useCorsProxy = false, requestHeaders = undefined, expectedResponseHeaders = undefined, basePath = "/") {
@@ -38,7 +38,7 @@ async function performWebRequest (url, type = "json", useCorsProxy = false, requ
3838
* @param {string} url the url to fetch from
3939
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
4040
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
41-
* @param {string} basePath, default /
41+
* @param {string} basePath The base path, default is "/"
4242
* @returns {string} to be used as URL when calling CORS-method on server.
4343
*/
4444
const getCorsUrl = function (url, requestHeaders, expectedResponseHeaders, basePath = "/") {

0 commit comments

Comments
 (0)