Files
codeql-action/node_modules/eslint/lib/shared/severity.js
dependabot[bot] 144b7d5b16 Bump the npm group with 2 updates (#2045)
* Bump the npm group with 2 updates

Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import).


Updates `eslint` from 8.55.0 to 8.56.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.55.0...v8.56.0)

Updates `eslint-plugin-import` from 2.29.0 to 2.29.1
- [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
- [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.29.0...v2.29.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint-plugin-import
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-12-18 10:52:32 -08:00

50 lines
1.2 KiB
JavaScript

/**
* @fileoverview Helpers for severity values (e.g. normalizing different types).
* @author Bryan Mishkin
*/
"use strict";
/**
* Convert severity value of different types to a string.
* @param {string|number} severity severity value
* @throws error if severity is invalid
* @returns {string} severity string
*/
function normalizeSeverityToString(severity) {
if ([2, "2", "error"].includes(severity)) {
return "error";
}
if ([1, "1", "warn"].includes(severity)) {
return "warn";
}
if ([0, "0", "off"].includes(severity)) {
return "off";
}
throw new Error(`Invalid severity value: ${severity}`);
}
/**
* Convert severity value of different types to a number.
* @param {string|number} severity severity value
* @throws error if severity is invalid
* @returns {number} severity number
*/
function normalizeSeverityToNumber(severity) {
if ([2, "2", "error"].includes(severity)) {
return 2;
}
if ([1, "1", "warn"].includes(severity)) {
return 1;
}
if ([0, "0", "off"].includes(severity)) {
return 0;
}
throw new Error(`Invalid severity value: ${severity}`);
}
module.exports = {
normalizeSeverityToString,
normalizeSeverityToNumber
};