41 Commits

Author SHA1 Message Date
Kristjan ESPERANTO
0b70274a1a
Replace prettier by stylistic to lint JavaScript (#3303)
In the latest versions of ESLint, more and more formatting rules were
removed or declared deprecated. These rules have been integrated into
the new Stylistic package (https://eslint.style/guide/why) and expanded.

Stylistic acts as a better formatter  for JavaScript as Prettier.

With this PR there are many changes that make the code more uniform, but
it may be difficult to review due to the large amount. Even if I have no
worries about the changes, perhaps this would be something for the
release after next.

Let me know what you think.
2023-12-25 08:17:11 +01:00
Karsten Hassel
a41aa48dd1
add .gitattributes and fix prettier/js warnings (#3094)
see title, as discussed in
https://github.com/MichMich/MagicMirror/pull/3093
2023-04-22 09:29:51 +02:00
Veeck
7e58b38ddf
Add no-param-reassign from eslint (#3089)
While waiting for the easterbunny I cleaned up some bad coding practice
:-)

Very open for comments especially regarding the places I commented
myself...

---------

Co-authored-by: veeck <michael@veeck.de>
2023-04-16 17:38:39 +02:00
Kristjan ESPERANTO
d276a7ddb9
Use template literals instead of string concatenation (#3066)
We have used it inconsistently till now. Template literals are more
modern and easier to maintain in my opinion.

Because that's a large amount of changes, here's a way to reproduce it:
I added the rule `"prefer-template": "error"` to the `.eslintrc.json`
and did an autofix. Since this caused a new problem in line 409 of
`newsfeed.js`, I reversed it in that line and also removed the rule from
the eslint config file.

The rule is described here:
https://eslint.org/docs/latest/rules/prefer-template

Note: I've played around with some other linter rules as well, and some
seem to point to some specific, non-cosmetic, issues. But before I dive
even deeper and then introduce even bigger and hardly understandable
changes at once, I thought I'd start with this simple cosmetic rule.
2023-03-19 14:32:23 +01:00
Veeck
2b792cdbb8
Convert translator callbacks to async/await (#3048)
Co-authored-by: veeck <michael@veeck.de>
2023-02-21 22:58:18 +01:00
Kristjan ESPERANTO
e234d2379b
Fix log output
Before:
```
MMM-OlympicGames - Load translationfalse: translations/de.json
translator.js:107 MMM-OlympicGames - Load translation  fallback: translations/en.json
```

After:
```
MMM-OlympicGames - Load translation: translations/de.json
translator.js:107 MMM-OlympicGames - Load translation fallback: translations/en.json
```
2022-02-20 02:24:22 +01:00
Kristjan SCHMIDT
a5668b1b99 Magic Mirror -> MagicMirror²
Consistent spelling
2022-01-26 23:09:26 +01:00
rejas
6b17f6aa28 Final var conversions 2021-07-14 15:06:23 +02:00
rejas
2619f92d09 More var -> let/const conversions 2021-07-14 10:41:29 +02:00
rejas
670a760404 Use some es6 notation 2021-03-25 17:29:27 +01:00
rejas
221eadcc20 Make function callbacks and returns more readable 2021-02-06 22:55:59 +01:00
Felix Wiedenbach
308774c2a6 remove callback hell 2021-01-29 22:34:12 +01:00
Mike Bishop
9ea7de8b44 Permit substituting a falsy value in translator variables 2020-12-31 10:10:01 -05:00
Sam Detweiler
69efca0bdb use Log.error instead of console.log for error message, shows in output 2020-10-05 10:45:07 -05:00
Sam Detweiler
8fa96c2836 add error handler to json parsing of translation files 2020-10-04 12:13:08 -05:00
rejas
05659820d0 Minor cleanups 2020-08-01 17:06:56 +02:00
rejas
522f7644a3 Add typedef for Module, use it in other jsdocs 2020-08-01 16:31:42 +02:00
rejas
79f9331073 Cleanup translator jsdoc 2020-07-27 21:37:08 +02:00
rejas
43bcf4ab98 Run eslint over files, see what gets fixed automatically and clean up 2020-07-27 14:25:43 +02:00
rejas
dc089d7db9 Remove stripCommentsFromJson code and test
Since we dont allow comments in the json anymore anyway
2020-07-09 20:30:26 +02:00
Veeck
abb5dc5739 Run prettier over ALL files once
No other changes done in this commit
2020-05-11 22:22:32 +02:00
rejas
c04fa496bf Second round of undef fixes 2020-05-03 18:59:26 +02:00
rejas
e7fc4ef1e7 Replace unsecure links with https ones 2020-04-28 23:05:28 +02:00
rejas
d08bd4e866 Fix lots of warnings 2020-04-21 12:23:50 +02:00
rejas
98a84c031e Better fix for translator comparison 2019-06-05 08:55:17 +02:00
rejas
ea1715384e Revert "Revert "Fix some == with ===""
This reverts commit d9a4ee4f658171e4a7854ef856adba5f904fbfbe.
2019-06-05 08:48:22 +02:00
rejas
d9a4ee4f65 Revert "Fix some == with ==="
This reverts commit 5d39d8521575c30b203380d977a71e7590a524ba.
2019-06-04 11:04:47 +02:00
rejas
5d39d85215 Fix some == with === 2019-06-04 09:51:51 +02:00
rejas
99b4c43fd5 Fix typos and some whitespaces 2019-06-04 09:33:53 +02:00
Michael Teeuw
d0eeb55999
Merge pull request #1186 from BonySimon/patch-1
Fix exception on translation of objects
2018-03-25 14:55:52 +02:00
Michael Teeuw
08c0d39b23
Update translator.js 2018-03-25 14:55:42 +02:00
Steelskin3
0388f5787a
Fix exception on translation of objects
Sometimes, the content of translations[module.name][key] is not a string but an entire object. It cause a crash on template.replace(...) of createStringFromTemplate(...). It is currently the case of MMM-Voice-Control and the previous commit have broked this module (10 month ago... I am surprised to be the first founded it)
2018-02-23 11:51:59 +01:00
fewieden
d709a44960 strip comments unit test 2018-02-13 07:17:46 +01:00
fewieden
85528761eb only load core callback if there is one available 2018-02-11 09:07:41 +01:00
fewieden
daa0755920 add missing parameter in documentation 2018-02-10 12:38:55 +01:00
Mikko Tapionlinna
ee88897b18 Add better support for translations with backwards compatibility 2017-04-25 23:15:34 +03:00
Michael Teeuw
7a067a0f6e Finish translation system. #191 2016-05-11 12:38:41 +02:00
Nicholas Hubbard
15887994fe
JSCS Says Goodbye 2016-05-03 19:13:46 -04:00
Michael Teeuw
52a9caa96e Fix for #222 2016-04-23 16:57:03 +02:00
Christopher
920f720699 fix indent 2016-04-21 08:47:07 +02:00
Christopher
4529675ca6 add l18n ability
fixes #191
2016-04-21 01:03:26 +02:00