Skip to content

Commit

Permalink
refactor: switch to optional chaining in custom filters and update es…
Browse files Browse the repository at this point in the history
…lint config (#1274)
  • Loading branch information
rishabhr4 authored Oct 8, 2024
1 parent 52c6796 commit 5c28787
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extends:
- plugin:sonarjs/recommended

parserOptions:
ecmaVersion: 2018
ecmaVersion: 2020
sourceType: module
ecmaFeatures:
jsx: true
Expand Down
2 changes: 1 addition & 1 deletion apps/nunjucks-filters/src/customFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function replaceServerVariablesWithValues(url, serverVariables) {
const getVariableValue = (object, variable) => {
const keyValue = object[variable]._json;

if (keyValue) return keyValue.default || (keyValue.enum && keyValue.enum[0]);
if (keyValue) return keyValue.default ?? keyValue.enum?.[0];
};

const urlVariables = getVariablesNamesFromUrl(url);
Expand Down

0 comments on commit 5c28787

Please sign in to comment.