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

Remove _.isNil #4443

Merged
merged 1 commit into from
Nov 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/rules/function-calc-no-invalid/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const _ = require('lodash');
const declarationValueIndex = require('../../utils/declarationValueIndex');
const parseCalcExpression = require('../../utils/parseCalcExpression');
const report = require('../../utils/report');
Expand Down Expand Up @@ -156,7 +155,8 @@ function getNumber(mathExpression) {
? getNumber(right)
: null;

if (_.isNil(leftValue) || _.isNil(rightValue)) {
// eslint-disable-next-line eqeqeq
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The smart option of the eqeqeq rule can be helpful.
See https://eslint.org/docs/rules/eqeqeq#smart

/*eslint eqeqeq: ["error", "smart"]*/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but I'd rather not touch the ESLint config here since there's an upstream eslint-config-stylelint.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do note we have at least one more case like this, so it would indeed make sense to switch to smart upstream

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (leftValue == null || rightValue == null) {
return null;
}

Expand Down