Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/core/questions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ export const questionGroups: QuestionGroup[] = [
name: "quotes",
label: "Quotes",
message: "Do you prefer double or single quotes?",
initial: "double",
initial: "single",
choices: ["double", "single"],
migrate: async ctx => ((await ctx.analyzeCode('"', "'")) ? "double" : "single"),
},
Expand Down
2 changes: 1 addition & 1 deletion templates/prettier.config.mjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const templateFunction: TemplateFunction = answers => {
return;
}

const quotes = answers.quotes || "double";
const quotes = answers.quotes || "single";
const useTabs = answers.indentation === "Tab";

const template = `// iobroker prettier configuration file
Expand Down
6 changes: 3 additions & 3 deletions test/baselines/TS_Prettier/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
semi: true,
trailingComma: "all",
singleQuote: false,
trailingComma: 'all',
singleQuote: true,
printWidth: 120,
useTabs: true,
tabWidth: 4,
endOfLine: "lf",
endOfLine: 'lf',
};
2 changes: 1 addition & 1 deletion test/baselines/adapter_JS_React/.create-adapter.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
],
"eslintConfig": "custom",
"indentation": "Tab",
"quotes": "double",
"quotes": "single",
"authorName": "Al Calzone",
"authorGithub": "AlCalzone",
"authorEmail": "[email protected]",
Expand Down
30 changes: 15 additions & 15 deletions test/baselines/adapter_JS_React/admin/src/app.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/no-require-imports */
import React from "react";
import { withStyles } from "@material-ui/core/styles";
import React from 'react';
import { withStyles } from '@material-ui/core/styles';

import GenericApp from "@iobroker/adapter-react/GenericApp";
import Settings from "./components/settings";
import GenericApp from '@iobroker/adapter-react/GenericApp';
import Settings from './components/settings';

/**
* @type {(_theme: import("@material-ui/core/styles").Theme) => import("@material-ui/styles").StyleRules}
Expand All @@ -18,17 +18,17 @@ class App extends GenericApp {
...props,
encryptedFields: [],
translations: {
en: require("./i18n/en.json"),
de: require("./i18n/de.json"),
ru: require("./i18n/ru.json"),
pt: require("./i18n/pt.json"),
nl: require("./i18n/nl.json"),
fr: require("./i18n/fr.json"),
it: require("./i18n/it.json"),
es: require("./i18n/es.json"),
pl: require("./i18n/pl.json"),
uk: require("./i18n/uk.json"),
"zh-cn": require("./i18n/zh-cn.json"),
en: require('./i18n/en.json'),
de: require('./i18n/de.json'),
ru: require('./i18n/ru.json'),
pt: require('./i18n/pt.json'),
nl: require('./i18n/nl.json'),
fr: require('./i18n/fr.json'),
it: require('./i18n/it.json'),
es: require('./i18n/es.json'),
pl: require('./i18n/pl.json'),
uk: require('./i18n/uk.json'),
'zh-cn': require('./i18n/zh-cn.json'),
},
};
super(props, extendedProps);
Expand Down
42 changes: 21 additions & 21 deletions test/baselines/adapter_JS_React/admin/src/components/settings.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react";
import { withStyles } from "@material-ui/core/styles";
import TextField from "@material-ui/core/TextField";
import Input from "@material-ui/core/Input";
import FormHelperText from "@material-ui/core/FormHelperText";
import FormControl from "@material-ui/core/FormControl";
import Select from "@material-ui/core/Select";
import MenuItem from "@material-ui/core/MenuItem";
import FormControlLabel from "@material-ui/core/FormControlLabel";
import Checkbox from "@material-ui/core/Checkbox";
import I18n from "@iobroker/adapter-react/i18n";
import React from 'react';
import { withStyles } from '@material-ui/core/styles';
import TextField from '@material-ui/core/TextField';
import Input from '@material-ui/core/Input';
import FormHelperText from '@material-ui/core/FormHelperText';
import FormControl from '@material-ui/core/FormControl';
import Select from '@material-ui/core/Select';
import MenuItem from '@material-ui/core/MenuItem';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Checkbox from '@material-ui/core/Checkbox';
import I18n from '@iobroker/adapter-react/i18n';

/**
* @type {() => Record<string, import("@material-ui/core/styles/withStyles").CreateCSSProperties>}
Expand All @@ -23,22 +23,22 @@ const styles = () => ({
},
card: {
maxWidth: 345,
textAlign: "center",
textAlign: 'center',
},
media: {
height: 180,
},
column: {
display: "inline-block",
verticalAlign: "top",
display: 'inline-block',
verticalAlign: 'top',
marginRight: 20,
},
columnLogo: {
width: 350,
marginRight: 0,
},
columnSettings: {
width: "calc(100% - 370px)",
width: 'calc(100% - 370px)',
},
controlElement: {
//background: "#d2d2d2",
Expand Down Expand Up @@ -78,7 +78,7 @@ class Settings extends React.Component {
label={I18n.t(title)}
className={`${this.props.classes.input} ${this.props.classes.controlElement}`}
value={this.props.native[attr]}
type={type || "text"}
type={type || 'text'}
onChange={e => this.props.onChange(attr, e.target.value)}
margin="normal"
/>
Expand All @@ -101,8 +101,8 @@ class Settings extends React.Component {
}}
>
<Select
value={this.props.native[attr] || "_"}
onChange={e => this.props.onChange(attr, e.target.value === "_" ? "" : e.target.value)}
value={this.props.native[attr] || '_'}
onChange={e => this.props.onChange(attr, e.target.value === '_' ? '' : e.target.value)}
input={
<Input
name={attr}
Expand All @@ -113,7 +113,7 @@ class Settings extends React.Component {
{options.map(item => (
<MenuItem
key={`key-${item.value}`}
value={item.value || "_"}
value={item.value || '_'}
>
{I18n.t(item.title)}
</MenuItem>
Expand Down Expand Up @@ -153,9 +153,9 @@ class Settings extends React.Component {
render() {
return (
<form className={this.props.classes.tab}>
{this.renderCheckbox("option1", "option1")}
{this.renderCheckbox('option1', 'option1')}
<br />
{this.renderInput("option2", "option2", "text")}
{this.renderInput('option2', 'option2', 'text')}
</form>
);
}
Expand Down
14 changes: 7 additions & 7 deletions test/baselines/adapter_JS_React/admin/src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import ReactDOM from "react-dom";
import { MuiThemeProvider } from "@material-ui/core/styles";
import theme from "@iobroker/adapter-react/Theme";
import Utils from "@iobroker/adapter-react/Components/Utils";
import App from "./app";
import React from 'react';
import ReactDOM from 'react-dom';
import { MuiThemeProvider } from '@material-ui/core/styles';
import theme from '@iobroker/adapter-react/Theme';
import Utils from '@iobroker/adapter-react/Components/Utils';
import App from './app';

let themeName = Utils.getThemeName();

Expand All @@ -18,7 +18,7 @@ function build() {
}}
/>
</MuiThemeProvider>,
document.getElementById("root"),
document.getElementById('root'),
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/baselines/adapter_JS_React/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default [
],
'quotes': [
'error',
'double'
'single'
],
// Strict rules to match official @iobroker/eslint-config
'prefer-template': 'error',
Expand Down
2 changes: 1 addition & 1 deletion test/baselines/adapter_JS_React/lib/adapter-config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// using the actual properties present in io-package.json
// in order to provide typings for adapter.config properties

import { native } from "../io-package.json";
import { native } from '../io-package.json';

type _AdapterConfig = typeof native;

Expand Down
56 changes: 28 additions & 28 deletions test/baselines/adapter_JS_React/main.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"use strict";
'use strict';

/*
* Created with @iobroker/create-adapter v2.6.5
*/

// The adapter-core module gives you access to the core ioBroker functions
// you need to create an adapter
const utils = require("@iobroker/adapter-core");
const utils = require('@iobroker/adapter-core');

// Load your modules here, e.g.:
// const fs = require("fs");
// const fs = require('fs');

class TestAdapter extends utils.Adapter {
/**
Expand All @@ -18,13 +18,13 @@ class TestAdapter extends utils.Adapter {
constructor(options) {
super({
...options,
name: "test-adapter",
name: 'test-adapter',
});
this.on("ready", this.onReady.bind(this));
this.on("stateChange", this.onStateChange.bind(this));
// this.on("objectChange", this.onObjectChange.bind(this));
// this.on("message", this.onMessage.bind(this));
this.on("unload", this.onUnload.bind(this));
this.on('ready', this.onReady.bind(this));
this.on('stateChange', this.onStateChange.bind(this));
// this.on('objectChange', this.onObjectChange.bind(this));
// this.on('message', this.onMessage.bind(this));
this.on('unload', this.onUnload.bind(this));
}

/**
Expand All @@ -35,52 +35,52 @@ class TestAdapter extends utils.Adapter {

// The adapters config (in the instance object everything under the attribute "native") is accessible via
// this.config:
this.log.debug("config option1: ${this.config.option1}");
this.log.debug("config option2: ${this.config.option2}");
this.log.debug('config option1: ${this.config.option1}');
this.log.debug('config option2: ${this.config.option2}');

/*
For every state in the system there has to be also an object of type state
Here a simple template for a boolean variable named "testVariable"
Because every adapter instance uses its own unique namespace variable names can't collide with other adapters variables
*/
await this.setObjectNotExistsAsync("testVariable", {
type: "state",
await this.setObjectNotExistsAsync('testVariable', {
type: 'state',
common: {
name: "testVariable",
type: "boolean",
role: "indicator",
name: 'testVariable',
type: 'boolean',
role: 'indicator',
read: true,
write: true,
},
native: {},
});

// In order to get state updates, you need to subscribe to them. The following line adds a subscription for our variable we have created above.
this.subscribeStates("testVariable");
this.subscribeStates('testVariable');
// You can also add a subscription for multiple states. The following line watches all states starting with "lights."
// this.subscribeStates("lights.*");
// this.subscribeStates('lights.*');
// Or, if you really must, you can also watch all states. Don't do this if you don't need to. Otherwise this will cause a lot of unnecessary load on the system:
// this.subscribeStates("*");
// this.subscribeStates('*');

/*
setState examples
you will notice that each setState will cause the stateChange event to fire (because of above subscribeStates cmd)
*/
// the variable testVariable is set to true as command (ack=false)
await this.setState("testVariable", true);
await this.setState('testVariable', true);

// same thing, but the value is flagged "ack"
// ack should be always set to true if the value is received from or acknowledged from the target system
await this.setState("testVariable", { val: true, ack: true });
await this.setState('testVariable', { val: true, ack: true });

// same thing, but the state is deleted after 30s (getState will return null afterwards)
await this.setState("testVariable", { val: true, ack: true, expire: 30 });
await this.setState('testVariable', { val: true, ack: true, expire: 30 });

// examples for the checkPassword/checkGroup functions
const pwdResult = await this.checkPasswordAsync("admin", "iobroker");
const pwdResult = await this.checkPasswordAsync('admin', 'iobroker');
this.log.info(`check user admin pw iobroker: ${pwdResult}`);

const groupResult = await this.checkGroupAsync("admin", "admin");
const groupResult = await this.checkGroupAsync('admin', 'admin');
this.log.info(`check group user admin group admin: ${groupResult}`);
}

Expand Down Expand Up @@ -143,13 +143,13 @@ class TestAdapter extends utils.Adapter {
// * @param {ioBroker.Message} obj
// */
// onMessage(obj) {
// if (typeof obj === "object" && obj.message) {
// if (obj.command === "send") {
// if (typeof obj === 'object' && obj.message) {
// if (obj.command === 'send') {
// // e.g. send email or pushover or whatever
// this.log.info("send command");
// this.log.info('send command');

// // Send response in callback if required
// if (obj.callback) this.sendTo(obj.from, obj.command, "Message received", obj.callback);
// if (obj.callback) this.sendTo(obj.from, obj.command, 'Message received', obj.callback);
// }
// }
// }
Expand Down
6 changes: 3 additions & 3 deletions test/baselines/adapter_JS_React/main.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use strict";
'use strict';

/**
* This is a dummy TypeScript test file using chai and mocha
Expand All @@ -9,10 +9,10 @@

// tslint:disable:no-unused-expression

const { expect } = require("chai");
const { expect } = require('chai');
// import { functionToTest } from "./moduleToTest";

describe("module to test => function to test", () => {
describe('module to test => function to test', () => {
// initializing logic
const expected = 5;

Expand Down
6 changes: 3 additions & 3 deletions test/baselines/adapter_JS_React/test/integration.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require("path");
const { tests } = require("@iobroker/testing");
const path = require('path');
const { tests } = require('@iobroker/testing');

// Run integration tests - See https://github.com/ioBroker/testing for a detailed explanation and further options
tests.integration(path.join(__dirname, ".."));
tests.integration(path.join(__dirname, '..'));
8 changes: 4 additions & 4 deletions test/baselines/adapter_JS_React/test/mocha.setup.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Don't silently swallow unhandled rejections
process.on("unhandledRejection", (e) => {
process.on('unhandledRejection', (e) => {
throw e;
});

// enable the should interface with sinon
// and load chai-as-promised and sinon-chai by default
const sinonChai = require("sinon-chai");
const chaiAsPromised = require("chai-as-promised");
const { should, use } = require("chai");
const sinonChai = require('sinon-chai');
const chaiAsPromised = require('chai-as-promised');
const { should, use } = require('chai');

should();
use(sinonChai);
Expand Down
Loading