Skip to content

Commit

Permalink
add typescript support; couple of enhancements from sonarcube
Browse files Browse the repository at this point in the history
  • Loading branch information
reZach committed Jun 30, 2022
1 parent 0dd8e74 commit 4d3e72f
Show file tree
Hide file tree
Showing 12 changed files with 197 additions and 41 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
],
"presets": [
"@babel/preset-env",
"@babel/preset-react"
"@babel/preset-react",
"@babel/preset-typescript"
]
}
File renamed without changes.
6 changes: 3 additions & 3 deletions app/src/pages/motd/motd.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Motd extends React.Component {

onChangeMessage(event) {
const { value } = event.target;
this.setState((state) => ({
this.setState((_state) => ({
message: value,
}));
}
Expand All @@ -36,7 +36,7 @@ class Motd extends React.Component {
window.api.store.send(writeConfigRequest, "motd", this.state.message); // save message to store (persist)

// reset
this.setState((state) => ({
this.setState((_state) => ({
message: "",
}));
}
Expand Down Expand Up @@ -75,7 +75,7 @@ class Motd extends React.Component {
}
}

const mapStateToProps = (state, props) => ({
const mapStateToProps = (state, _props) => ({
home: state.home,
});
const mapDispatch = { changeMessage };
Expand Down
24 changes: 12 additions & 12 deletions app/src/pages/undoredo/undoredo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,47 +27,47 @@ class UndoRedo extends React.Component {
this.groupend = this.groupend.bind(this);
}

inc(event) {
inc(_event) {
this.props.increment();
}

dec(event) {
dec(_event) {
this.props.decrement();
}

add(event) {
add(_event) {
this.props.add();
}

remove(event) {
remove(_event) {
this.props.remove();
}

undo(event) {
undo(_event) {
this.props.UNDO();
}

redo(event) {
redo(_event) {
this.props.REDO();
}

undo2(event) {
undo2(_event) {
this.props.UNDO(2);
}

redo2(event) {
redo2(_event) {
this.props.REDO(2);
}

clear(event) {
clear(_event) {
this.props.CLEAR();
}

groupbegin(event) {
groupbegin(_event) {
this.props.GROUPBEGIN();
}

groupend(event) {
groupend(_event) {
this.props.GROUPEND();
}

Expand Down Expand Up @@ -188,7 +188,7 @@ class UndoRedo extends React.Component {
}
}

const mapStateToProps = (state, props) => ({
const mapStateToProps = (state, _props) => ({
counter: state.undoable.present.counter,
complex: state.undoable.present.complex,
past: state.undoable.past,
Expand Down
4 changes: 2 additions & 2 deletions app/src/redux/components/complex/complexSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const complexSlice = createSlice({
}
}],
reducers: {
add(state, action) {
add(state, _action) {
state.push({
id: state.length + 1,
food: {
Expand All @@ -32,7 +32,7 @@ const complexSlice = createSlice({
}
});
},
remove(state, action) {
remove(state, _action) {
const randIndex = Math.floor(Math.random() * state.length);
state.splice(randIndex, 1);
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/redux/components/counter/counterSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const counterSlice = createSlice({
value: 0
},
reducers: {
increment(state, action) {
increment(state, _action) {
state.value++;
},
decrement(state, action) {
decrement(state, _action) {
state.value--;
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Specifically, you can drop:
* CODE_OF_CONDUCT.md
* README.md

_Note: you should keep the LICENSE file in your project.
> Note: you should keep the LICENSE file in your project.
## How do I use Node's fs in this template?
Please check out [this guide](https://github.com/reZach/secure-electron-template/blob/master/docs/newtoelectron.md).
Expand All @@ -29,7 +29,7 @@ Yes, but you'll have to follow [a few steps](https://github.com/reZach/secure-el
Please refer to [these instructions](https://github.com/reZach/secure-electron-license-keys) first. If you have further questions, you may post a question in the appropriate repo.

## Can I use typescript with this template?
I suggest following [this pull request](https://github.com/tyler-hitzeman/secure-electron-template-ts/pull/1) to guide you what changes you'll need to make.
Yes, you can! Simply convert any of the files in the app/src directory to a Typescript extension. If you desire to convert some of the Electron-related files to Typescript, I'd suggest you pull inspiration from the [discussion here](https://github.com/reZach/secure-electron-template/issues/47).

#### Question not answered?
Please [post an issue](https://github.com/reZach/secure-electron-template/issues/new) and we will add to this page with questions that you have!
Binary file modified docs/imgs/intro.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4d3e72f

Please sign in to comment.