mirror of
https://github.com/less/less.js.git
synced 2026-01-09 15:48:08 -05:00
Fix eslint warnimg (#3709)
* fix: ESlint warning * fallback ts configuration * fix: analysis value to fix ESlint warning && fallback eslint version
This commit is contained in:
@@ -30,7 +30,7 @@ class Environment {
|
||||
if (!filename) {
|
||||
logger.warn('getFileManager called with no filename.. Please report this issue. continuing.');
|
||||
}
|
||||
if (currentDirectory == null) {
|
||||
if (currentDirectory === undefined) {
|
||||
logger.warn('getFileManager called with null directory.. Please report this issue. continuing.');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Keyword from '../tree/keyword';
|
||||
import * as utils from '../utils';
|
||||
|
||||
const defaultFunc = {
|
||||
eval: function () {
|
||||
@@ -7,7 +8,7 @@ const defaultFunc = {
|
||||
if (e) {
|
||||
throw e;
|
||||
}
|
||||
if (v != null) {
|
||||
if (!utils.isNullOrUndefined(v)) {
|
||||
return v ? Keyword.True : Keyword.False;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const MathHelper = (fn, unit, n) => {
|
||||
if (!(n instanceof Dimension)) {
|
||||
throw { type: 'Argument', message: 'argument must be a number' };
|
||||
}
|
||||
if (unit == null) {
|
||||
if (unit === null) {
|
||||
unit = n.unit;
|
||||
} else {
|
||||
n = n.unify();
|
||||
|
||||
@@ -591,7 +591,7 @@ const Parser = function Parser(context, imports, fileInfo) {
|
||||
|
||||
expectChar(')');
|
||||
|
||||
return new(tree.URL)((value.value != null ||
|
||||
return new(tree.URL)((value.value !== undefined ||
|
||||
value instanceof tree.Variable ||
|
||||
value instanceof tree.Property) ?
|
||||
value : new(tree.Anonymous)(value, index), index, fileInfo);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as utils from '../utils';
|
||||
|
||||
/**
|
||||
* The reason why Node is a class and other nodes simply do not extend
|
||||
* from Node (since we're transpiling) is due to this issue:
|
||||
@@ -125,21 +127,21 @@ class Node {
|
||||
|
||||
// Returns true if this node represents root of ast imported by reference
|
||||
blocksVisibility() {
|
||||
if (this.visibilityBlocks == null) {
|
||||
if (this.visibilityBlocks === undefined) {
|
||||
this.visibilityBlocks = 0;
|
||||
}
|
||||
return this.visibilityBlocks !== 0;
|
||||
}
|
||||
|
||||
addVisibilityBlock() {
|
||||
if (this.visibilityBlocks == null) {
|
||||
if (this.visibilityBlocks === undefined) {
|
||||
this.visibilityBlocks = 0;
|
||||
}
|
||||
this.visibilityBlocks = this.visibilityBlocks + 1;
|
||||
}
|
||||
|
||||
removeVisibilityBlock() {
|
||||
if (this.visibilityBlocks == null) {
|
||||
if (this.visibilityBlocks === undefined) {
|
||||
this.visibilityBlocks = 0;
|
||||
}
|
||||
this.visibilityBlocks = this.visibilityBlocks - 1;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import Node from './node';
|
||||
import Variable from './variable';
|
||||
import Property from './property';
|
||||
import * as utils from '../utils';
|
||||
|
||||
|
||||
const Quoted = function(str, content, escaped, index, currentFileInfo) {
|
||||
this.escaped = (escaped == null) ? true : escaped;
|
||||
this.escaped = (escaped === undefined) ? true : escaped;
|
||||
this.value = content || '';
|
||||
this.quote = str.charAt(0);
|
||||
this._index = index;
|
||||
|
||||
@@ -734,7 +734,7 @@ Ruleset.prototype = Object.assign(new Node(), {
|
||||
// non parent reference elements just get added
|
||||
if (el.value !== '&') {
|
||||
const nestedSelector = findNestedSelector(el);
|
||||
if (nestedSelector != null) {
|
||||
if (nestedSelector !== null) {
|
||||
// merge the current list of non parent selector elements
|
||||
// on to the current list of selectors to add
|
||||
mergeElementsOnToSelectors(currentElements, newSelectors);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Node from './node';
|
||||
import Element from './element';
|
||||
import LessError from '../less-error';
|
||||
import * as utils from '../utils';
|
||||
|
||||
const Selector = function(elements, extendList, condition, index, currentFileInfo, visibilityInfo) {
|
||||
this.extendList = extendList;
|
||||
@@ -33,7 +34,7 @@ Selector.prototype = Object.assign(new Node(), {
|
||||
elements = this.getElements(elements);
|
||||
const newSelector = new Selector(elements, extendList || this.extendList,
|
||||
null, this.getIndex(), this.fileInfo(), this.visibilityInfo());
|
||||
newSelector.evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition;
|
||||
newSelector.evaldCondition = (!utils.isNullOrUndefined(evaldCondition)) ? evaldCondition : this.evaldCondition;
|
||||
newSelector.mediaEmpty = this.mediaEmpty;
|
||||
return newSelector;
|
||||
},
|
||||
|
||||
@@ -119,4 +119,8 @@ export function flattenArray(arr, result = []) {
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function isNullOrUndefined(val) {
|
||||
return val === null || val === undefined
|
||||
}
|
||||
Reference in New Issue
Block a user