Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean eslint default parameter order warning #1720

Merged
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
6 changes: 3 additions & 3 deletions server/services/zigbee2mqtt/utils/features/buildFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { completeFeature } = require('./completeFeature');
*
* @example buildByParentType({ switch: {}, light: {}}, 'light');
*/
function buildByParentType(types = {}, parentType) {
function buildByParentType(types, parentType) {
return types[parentType];
}

Expand All @@ -24,7 +24,7 @@ function buildByParentType(types = {}, parentType) {
*
* @example buildByName({ state: {}}, 'state', 'light');
*/
function buildByName(names = {}, name, parentType) {
function buildByName(names, name, parentType) {
const { types = {}, feature } = names[name] || {};
const byType = buildByParentType(types, parentType);

Expand All @@ -44,7 +44,7 @@ function buildByName(names = {}, name, parentType) {
*
* @example buildFeature('MyDevice', {}, 'light');
*/
function buildFeatures(deviceName, expose = {}, parentType) {
function buildFeatures(deviceName, expose, parentType) {
const { type, name, property, access, value_min: minValue, value_max: maxValue, unit: deviceUnit, values } = expose;
const { names = {}, feature, getFeatureIndexes = () => [''] } = exposesMap[type] || {};
const byName = buildByName(names, name, parentType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const {

describe('zigbee2mqtt buildByParentType', () => {
it(`no type map`, () => {
const result = buildByParentType(undefined, undefined);
const result = buildByParentType({}, undefined);
expect(result).eq(undefined);
});

Expand All @@ -31,7 +31,7 @@ describe('zigbee2mqtt buildByParentType', () => {

describe('zigbee2mqtt buildByName', () => {
it(`all empty`, () => {
const result = buildByName(undefined, 'binary', 'light');
const result = buildByName({}, 'binary', 'light');
expect(result).eq(undefined);
});

Expand Down Expand Up @@ -71,7 +71,7 @@ describe('zigbee2mqtt buildByName', () => {

describe('zigbee2mqtt buildFeature', () => {
it(`no data`, () => {
const result = buildFeatures('deviceName', undefined, undefined);
const result = buildFeatures('deviceName', {}, undefined);
expect(result).deep.eq([]);
});

Expand Down