Skip to content

Commit 7c422f7

Browse files
committedSep 26, 2023
Migrated to typescript
1 parent c6d21e7 commit 7c422f7

27 files changed

+12270
-258
lines changed
 

‎.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
max_line_length = 250
11+
trim_trailing_whitespace = true
12+
13+
[*.{js,json}]
14+
indent_size = 4
15+
indent_style = tab

‎.eslintignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
build/
2+
dist/
3+
lib/
4+
output/
5+
storybook-static/
6+
node_helper.js
7+
MMM-GoogleTasks.js
8+
**/ModuleTypes.d.ts

‎.eslintrc.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"extends": ["eslint:recommended", "prettier", "plugin:@typescript-eslint/recommended", "plugin:sonarjs/recommended"],
3+
"plugins": ["@typescript-eslint", "sonarjs"],
4+
"root": true,
5+
"env": {
6+
"browser": true,
7+
"es6": true,
8+
"mocha": true,
9+
"node": true
10+
},
11+
"globals": {
12+
"config": true,
13+
"Log": true,
14+
"MM": true,
15+
"Module": true,
16+
"moment": true
17+
},
18+
"parser": "@typescript-eslint/parser",
19+
"parserOptions": {
20+
"sourceType": "module",
21+
"ecmaVersion": 2017,
22+
"ecmaFeatures": {
23+
"globalReturn": true
24+
}
25+
},
26+
"rules": {}
27+
}

‎.gitignore

+84
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,87 @@
11
credentials.json
22
token.json
33

4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
9+
# Runtime data
10+
pids
11+
*.pid
12+
*.seed
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# node-waf configuration
27+
.lock-wscript
28+
29+
# Compiled binary addons (http://nodejs.org/api/addons.html)
30+
build/Release
31+
32+
# Dependency directories
33+
node_modules
34+
jspm_packages
35+
36+
# Optional npm cache directory
37+
.npm
38+
39+
# Optional REPL history
40+
.node_repl_history
41+
42+
# Various Windows ignoramuses.
43+
Thumbs.db
44+
ehthumbs.db
45+
Desktop.ini
46+
$RECYCLE.BIN/
47+
*.cab
48+
*.msi
49+
*.msm
50+
*.msp
51+
*.lnk
52+
53+
# Various OSX ignoramuses.
54+
.DS_Store
55+
.AppleDouble
56+
.LSOverride
57+
Icon
58+
._*
59+
.DocumentRevisions-V100
60+
.fseventsd
61+
.Spotlight-V100
62+
.TemporaryItems
63+
.Trashes
64+
.VolumeIcon.icns
65+
.AppleDB
66+
.AppleDesktop
67+
Network Trash Folder
68+
Temporary Items
69+
.apdisk
70+
71+
.eslintcache
72+
73+
# Various Linux ignoramuses.
74+
.fuse_hidden*
75+
.directory
76+
.Trash-*
77+
78+
79+
.vscode/*
80+
81+
# Ignore rollup output
82+
MMM-GoogleTasks.js
83+
node_helper.js
84+
MMM-GoogleTasks.css
85+
86+
output/*
87+
junit.xml

‎.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock.json

‎.prettierrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"trailingComma": "none"
3+
}

‎CONTRIBUTING.md

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Welcome to the MMM-PrometheusAlerts contributing guide <!-- omit in toc -->
2+
3+
Thank you for investing your time in contributing to our project!
4+
5+
This project adheres to the [Github Contributor Code of Conduct](https://github.com/github/docs/blob/main/CODE_OF_CONDUCT.md).
6+
7+
In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
8+
9+
Use the table of contents icon on the top left corner of this document to get to a specific section of this guide quickly.
10+
11+
## New contributor guide
12+
13+
To get an overview of the project, read the [README](README.md). Here are some resources to help you get started with open source contributions:
14+
15+
- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
16+
- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
17+
- [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)
18+
- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
19+
20+
## Getting started
21+
22+
To navigate our codebase with confidence, see [the introduction to working in the docs repository](/contributing/working-in-docs-repository.md) :confetti_ball:. For more information on how we write our markdown files, see [the GitHub Markdown reference](contributing/content-markup-reference.md).
23+
24+
Check to see what [types of contributions](/contributing/types-of-contributions.md) we accept before making changes. Some of them don't even require writing a single line of code :sparkles:.
25+
26+
### Issues
27+
28+
#### Create a new issue
29+
30+
If you spot a problem with the docs, [search if an issue already exists](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments). If a related issue doesn't exist, you can open a new issue using the [issue form](https://github.com/spyder007/MMM-PrometheusAlerts/issues/new/choose).
31+
32+
#### Solve an issue
33+
34+
Scan through our [existing issues](https://github.com/spyder007/MMM-PrometheusAlerts/issues) to find one that interests you. You can narrow down the search using `labels` as filters. See [Labels](/contributing/how-to-use-labels.md) for more information. If you find an issue to work on, you are welcome to open a PR with a fix.
35+
36+
### Make Changes
37+
38+
#### Make changes locally
39+
40+
1. [Install and Configure](https://docs.magicmirror.builders/getting-started/installation.html) an instance of MagicMirror for testing. It is very helpful to read and understand [Module Development](https://docs.magicmirror.builders/development/introduction.html) in Magic Mirror.
41+
42+
2. Fork the repository
43+
44+
- Using GitHub Desktop:
45+
- [Getting started with GitHub Desktop](https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop) will guide you through setting up Desktop.
46+
- Once Desktop is set up, you can use it to [fork the repo](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-and-forking-repositories-from-github-desktop)!
47+
48+
- Using the command line:
49+
- [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them.
50+
51+
3. Install or update to **Node.js v18**.
52+
53+
4. Clone your forked repository. In order to test locally, clone your repository into the `modules` folder of the MagicMirror repository.
54+
55+
5. Create a working branch and start with your changes!
56+
57+
### Commit your update
58+
59+
Commit the changes once you are happy with them. Don't forget to run the linting and test commands:
60+
61+
#### Linting Commands
62+
63+
```bash
64+
# Run ESLint on Javascript files
65+
npm run lint:js
66+
# Run Prettier on all files
67+
npm run lint:prettier
68+
69+
# run everything above - *** Recommended before commit ***
70+
npm run lint
71+
```
72+
73+
#### Test Commands
74+
75+
```bash
76+
# Run all tests (unit, prettier, and js)
77+
npm run test
78+
79+
# Run unit tests
80+
npm run test:unit
81+
82+
# Check for prettier syntax violations (does not fix)
83+
npm run test:prettier
84+
85+
# Check for ESLint JS syntax violations (does not fix)
86+
npm run test:js
87+
88+
```
89+
90+
#### Build Commands
91+
92+
This module is written and tested using Typescript and SCSS, however, to be used by MagicMirror, `rollup` must execute and create the necessary Javascript and CSS files for the module and the `node_helper`.
93+
94+
This is all encapsulated in the build command:
95+
96+
```bash
97+
# build module JS files from typescript
98+
npm run build
99+
```
100+
101+
You can use `npm run dev` to build with inline source maps, and `npm run watch` to build (and rebuild) on changes.
102+
103+
### Pull Request
104+
105+
When you're finished with the changes, create a pull request, also known as a PR.
106+
107+
- Don't forget to [link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) if you are solving one.
108+
- Enable the checkbox to [allow maintainer edits](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so the branch can be updated for a merge.
109+
Once you submit your PR, a Docs team member will review your proposal. We may ask questions or request additional information.
110+
- We may ask for changes to be made before a PR can be merged, either using [suggested changes](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request) or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch.
111+
- As you update your PR and apply changes, mark each conversation as [resolved](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#resolving-conversations).
112+
- If you run into any merge issues, checkout this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to help you resolve merge conflicts and other issues.
113+
114+
### Your PR is merged
115+
116+
Congratulations :tada::tada: We thank you for your contribution.
117+
118+
Once your PR is merged, your updates are available in MagicMirror by pulling the latest code from the `main` branch in this repository into your Magic Mirror `modules` folder and running `npm install`

‎LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Matt Gerega
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)