mirror of
https://github.com/edward-shen/MMM-pages.git
synced 2025-06-27 13:33:36 -07:00
refactor: get rid of negated-conditions and add no-negated-condition
rule to ESLint config
This commit is contained in:
parent
41958b543a
commit
7f248f5d2e
2 changed files with 8 additions and 7 deletions
14
MMM-pages.js
14
MMM-pages.js
|
@ -172,7 +172,7 @@ Module.register('MMM-pages', {
|
||||||
*/
|
*/
|
||||||
updatePages() {
|
updatePages() {
|
||||||
// Update if there's at least one page.
|
// Update if there's at least one page.
|
||||||
if (this.config.modules.length !== 0) {
|
if (this.config.modules.length > 0) {
|
||||||
this.animatePageChange();
|
this.animatePageChange();
|
||||||
if (!this.rotationPaused) {
|
if (!this.rotationPaused) {
|
||||||
this.resetTimerWithDelay(0);
|
this.resetTimerWithDelay(0);
|
||||||
|
@ -202,10 +202,10 @@ Module.register('MMM-pages', {
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
let modulesToShow;
|
let modulesToShow;
|
||||||
if (typeof targetPageName !== 'undefined') {
|
if (typeof targetPageName === 'undefined') {
|
||||||
modulesToShow = this.config.hiddenPages[targetPageName];
|
|
||||||
} else {
|
|
||||||
modulesToShow = this.config.fixed.concat(this.config.modules[this.curPage]);
|
modulesToShow = this.config.fixed.concat(this.config.modules[this.curPage]);
|
||||||
|
} else {
|
||||||
|
modulesToShow = this.config.hiddenPages[targetPageName];
|
||||||
}
|
}
|
||||||
const animationTime = self.config.animationTime / 2;
|
const animationTime = self.config.animationTime / 2;
|
||||||
|
|
||||||
|
@ -280,11 +280,11 @@ Module.register('MMM-pages', {
|
||||||
Log.warn(`[MMM-pages] was asked to ${stateBaseString}e but rotation is already ${stateBaseString}ed!`);
|
Log.warn(`[MMM-pages] was asked to ${stateBaseString}e but rotation is already ${stateBaseString}ed!`);
|
||||||
} else {
|
} else {
|
||||||
Log.log(`[MMM-pages] ${stateBaseString}ing rotation`);
|
Log.log(`[MMM-pages] ${stateBaseString}ing rotation`);
|
||||||
if (!isRotating) {
|
if (isRotating) {
|
||||||
|
this.resetTimerWithDelay(this.rotationDelay);
|
||||||
|
} else {
|
||||||
clearInterval(this.timer);
|
clearInterval(this.timer);
|
||||||
clearInterval(this.delayTimer);
|
clearInterval(this.delayTimer);
|
||||||
} else {
|
|
||||||
this.resetTimerWithDelay(this.rotationDelay);
|
|
||||||
}
|
}
|
||||||
this.rotationPaused = isRotating;
|
this.rotationPaused = isRotating;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ export default defineConfig([
|
||||||
'@stylistic/comma-dangle': ['error', 'only-multiline'],
|
'@stylistic/comma-dangle': ['error', 'only-multiline'],
|
||||||
'@stylistic/max-statements-per-line': ['error', { max: 2 }],
|
'@stylistic/max-statements-per-line': ['error', { max: 2 }],
|
||||||
'@stylistic/semi': ['error', 'always'],
|
'@stylistic/semi': ['error', 'always'],
|
||||||
|
'no-negated-condition': 'error'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue