Skip to content

Commit

Permalink
remove nullishCoalesce function and replace with nullish coalesce o…
Browse files Browse the repository at this point in the history
…perator now that node 12 has reached end of life and node 14+ support the operator
  • Loading branch information
adashrod committed Oct 16, 2023
1 parent f1b88e6 commit 5d2c543
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 32 deletions.
10 changes: 4 additions & 6 deletions src/lib/rules/logical-expression-complexity.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const { nullishCoalesce } = require("./util/misc-js.js");

/**
* @fileoverview Rule to flag overly complex logical expressions
* @author Aaron Rodriguez
Expand Down Expand Up @@ -50,10 +48,10 @@ module.exports = {
},
create(context) {
const configuration = context.options[0] || {},
maxHeight = nullishCoalesce(configuration.maxHeight, 2),
maxTerms = nullishCoalesce(configuration.maxTerms, 4),
binaryOperators = nullishCoalesce(configuration.binaryOperators, []),
includeTernary = nullishCoalesce(configuration.includeTernary, true);
maxHeight = configuration.maxHeight ?? 2,
maxTerms = configuration.maxTerms ?? 4,
binaryOperators = configuration.binaryOperators ?? [],
includeTernary = configuration.includeTernary ?? true;

const heightObserved = new Set();
const countObserved = new Set();
Expand Down
5 changes: 2 additions & 3 deletions src/lib/rules/ordered-import-members.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { findPunctuatorAfter, findPunctuatorBetween } = require("./util/ast.js");
const { nullishCoalesce } = require("./util/misc-js.js");

/**
* @fileoverview Rule to enforce ordering of import members by name
Expand Down Expand Up @@ -40,8 +39,8 @@ module.exports = {
},
create(context) {
const configuration = context.options[0] || {},
ignoreCase = nullishCoalesce(configuration.ignoreCase, false),
sortSpecifiersWithComments = nullishCoalesce(configuration.sortSpecifiersWithComments, false),
ignoreCase = configuration.ignoreCase ?? false,
sortSpecifiersWithComments = configuration.sortSpecifiersWithComments ?? false,
sourceCode = context.getSourceCode();

/**
Expand Down
10 changes: 4 additions & 6 deletions src/lib/rules/ordered-imports-by-path.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const { nullishCoalesce } = require("./util/misc-js.js");

/**
* @fileoverview Rule to enforce ordering of imports by path
* @author Aaron Rodriguez
Expand Down Expand Up @@ -52,10 +50,10 @@ module.exports = {
},
create(context) {
const configuration = context.options[0] || {},
ignoreCase = nullishCoalesce(configuration.ignoreCase, false),
allowSeparateGroups = nullishCoalesce(configuration.allowSeparateGroups, true),
sortTypeImportsFirst = nullishCoalesce(configuration.sortTypeImportsFirst, true),
sortSideEffectsFirst = nullishCoalesce(configuration.sortSideEffectsFirst, false),
ignoreCase = configuration.ignoreCase ?? false,
allowSeparateGroups = configuration.allowSeparateGroups ?? true,
sortTypeImportsFirst = configuration.sortTypeImportsFirst ?? true,
sortSideEffectsFirst = configuration.sortSideEffectsFirst ?? false,
sourceCode = context.getSourceCode();

/**
Expand Down
7 changes: 3 additions & 4 deletions src/lib/rules/strict-camel-case.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { nullishCoalesce } = require("./util/misc-js.js");
const { objectToString } = require("./util/serialization.js");

/**
Expand Down Expand Up @@ -64,11 +63,11 @@ module.exports = {

create(context) {
const options = context.options[0] || {},
ignoreProperties = nullishCoalesce(options.ignoreProperties, false),
ignoreImports = nullishCoalesce(options.ignoreImports, false),
ignoreProperties = options.ignoreProperties ?? false,
ignoreImports = options.ignoreImports ?? false,
ignoredIdentifiers = options.ignoredIdentifiers || [],
allowOneCharWords = options.allowOneCharWords || "never",
ignoreSingleWords = nullishCoalesce(options.ignoreSingleWords, false);
ignoreSingleWords = options.ignoreSingleWords ?? false;

const LOG_RULE_PREFIX = "eslint-plugin-sequence/strict-camel-case ";
const LEVELS = ["OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"];
Expand Down
13 changes: 0 additions & 13 deletions src/lib/rules/util/misc-js.js

This file was deleted.

0 comments on commit 5d2c543

Please sign in to comment.