mirror of
https://github.com/edward-shen/MMM-pages.git
synced 2025-06-27 05:23: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() {
|
||||
// Update if there's at least one page.
|
||||
if (this.config.modules.length !== 0) {
|
||||
if (this.config.modules.length > 0) {
|
||||
this.animatePageChange();
|
||||
if (!this.rotationPaused) {
|
||||
this.resetTimerWithDelay(0);
|
||||
|
@ -202,10 +202,10 @@ Module.register('MMM-pages', {
|
|||
|
||||
const self = this;
|
||||
let modulesToShow;
|
||||
if (typeof targetPageName !== 'undefined') {
|
||||
modulesToShow = this.config.hiddenPages[targetPageName];
|
||||
} else {
|
||||
if (typeof targetPageName === 'undefined') {
|
||||
modulesToShow = this.config.fixed.concat(this.config.modules[this.curPage]);
|
||||
} else {
|
||||
modulesToShow = this.config.hiddenPages[targetPageName];
|
||||
}
|
||||
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!`);
|
||||
} else {
|
||||
Log.log(`[MMM-pages] ${stateBaseString}ing rotation`);
|
||||
if (!isRotating) {
|
||||
if (isRotating) {
|
||||
this.resetTimerWithDelay(this.rotationDelay);
|
||||
} else {
|
||||
clearInterval(this.timer);
|
||||
clearInterval(this.delayTimer);
|
||||
} else {
|
||||
this.resetTimerWithDelay(this.rotationDelay);
|
||||
}
|
||||
this.rotationPaused = isRotating;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ export default defineConfig([
|
|||
'@stylistic/comma-dangle': ['error', 'only-multiline'],
|
||||
'@stylistic/max-statements-per-line': ['error', { max: 2 }],
|
||||
'@stylistic/semi': ['error', 'always'],
|
||||
'no-negated-condition': 'error'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue