-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix eslint import extension #682
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { h, Component } from 'preact'; | ||
| import { onChangeEvent } from '../../util/event'; | ||
| import { onChangeEvent } from '../../util/event.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module '../../util/event.js' import/no-unresolved |
||
|
|
||
| export default class WaitAction extends Component { | ||
| constructor() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,3 @@ | ||
| export default function computeDomain(stateObj) { | ||
| if (!stateObj._domain) { | ||
| stateObj._domain = stateObj.entity_id.substr(0, stateObj.entity_id.indexOf('.')); | ||
| } | ||
|
|
||
| return stateObj._domain; | ||
| export default function computeDomain(entityId) { | ||
| return entityId.substr(0, entityId.indexOf('.')); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| import computeDomain from './compute_domain'; | ||
| import formatDateTime from './format_date_time'; | ||
| import formatDate from './format_date'; | ||
| import formatTime from './format_time'; | ||
| import computeStateDomain from './compute_state_domain.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './compute_state_domain.js' import/no-unresolved |
||
| import formatDateTime from './format_date_time.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './format_date_time.js' import/no-unresolved |
||
| import formatDate from './format_date.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './format_date.js' import/no-unresolved |
||
| import formatTime from './format_time.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './format_time.js' import/no-unresolved |
||
|
|
||
| export default function computeStateDisplay(haLocalize, stateObj, language) { | ||
| if (!stateObj._stateDisplay) { | ||
| const domain = computeDomain(stateObj); | ||
| const domain = computeStateDomain(stateObj); | ||
| if (domain === 'binary_sensor') { | ||
| // Try device class translation, then default binary sensor translation | ||
| if (stateObj.attributes.device_class) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import computeDomain from './compute_domain.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './compute_domain.js' import/no-unresolved |
||
|
|
||
| export default function computeStateDomain(stateObj) { | ||
| if (!stateObj._domain) { | ||
| stateObj._domain = computeDomain(stateObj.entity_id); | ||
| } | ||
|
|
||
| return stateObj._domain; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { h, render } from 'preact'; | ||
| import Script from './script'; | ||
| import Script from './script.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './script.js' import/no-unresolved |
||
|
|
||
| window.ScriptEditor = function (mountEl, props, mergeEl) { | ||
| return render(h(Script, props), mountEl, mergeEl); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import { h, Component } from 'preact'; | ||
|
|
||
| import Script from '../common/component/script'; | ||
| import Script from '../common/component/script/index.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module '../common/component/script/index.js' import/no-unresolved |
||
|
|
||
| export default class ScriptEditor extends Component { | ||
| constructor() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,12 +6,12 @@ | |
| * import these functions where we need them. | ||
| */ | ||
|
|
||
| import attributeClassNames from './common/util/attribute_class_names'; | ||
| import computeDomain from './common/util/compute_domain'; | ||
| import computeStateDisplay from './common/util/compute_state_display'; | ||
| import formatDate from './common/util/format_date'; | ||
| import formatDateTime from './common/util/format_date_time'; | ||
| import formatTime from './common/util/format_time'; | ||
| import attributeClassNames from './common/util/attribute_class_names.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './common/util/attribute_class_names.js' import/no-unresolved |
||
| import computeStateDomain from './common/util/compute_state_domain.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './common/util/compute_state_domain.js' import/no-unresolved |
||
| import computeStateDisplay from './common/util/compute_state_display.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './common/util/compute_state_display.js' import/no-unresolved |
||
| import formatDate from './common/util/format_date.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './common/util/format_date.js' import/no-unresolved |
||
| import formatDateTime from './common/util/format_date_time.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './common/util/format_date_time.js' import/no-unresolved |
||
| import formatTime from './common/util/format_time.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module './common/util/format_time.js' import/no-unresolved |
||
|
|
||
| window.hassUtil = window.hassUtil || {}; | ||
|
|
||
|
|
@@ -21,7 +21,7 @@ const language = navigator.languages ? | |
| window.fecha.masks.haDateTime = window.fecha.masks.shortTime + ' ' + window.fecha.masks.mediumDate; | ||
|
|
||
| window.hassUtil.attributeClassNames = attributeClassNames; | ||
| window.hassUtil.computeDomain = computeDomain; | ||
| window.hassUtil.computeDomain = computeStateDomain; | ||
| window.hassUtil.computeStateDisplay = computeStateDisplay; | ||
| window.hassUtil.formatDate = dateObj => formatDate(dateObj, language); | ||
| window.hassUtil.formatDateTime = dateObj => formatDateTime(dateObj, language); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import computeStateDomain from '../../../js/common/util/compute_state_domain.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module '../../../js/common/util/compute_state_domain.js' import/no-unresolved |
||
|
|
||
| const assert = require('assert'); | ||
|
|
||
| describe('computeStateDomain', () => { | ||
| it('Detects sensor domain', () => { | ||
| const stateObj = { | ||
| entity_id: 'sensor.test', | ||
| }; | ||
| assert.strictEqual(computeStateDomain(stateObj), 'sensor'); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module './action_row.js' import/no-unresolved
Unexpected use of file extension "js" for "./action_row.js" import/extensions