Permalink
Cannot retrieve contributors at this time
30 lines (29 sloc)
1.02 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/eslint-plugin-jsx-a11y/lib/util/isNonLiteralProperty.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports["default"] = void 0; | |
var _jsxAstUtils = require("jsx-ast-utils"); | |
/** | |
* Returns boolean indicating whether the given element has been specified with | |
* an AST node with a non-literal type. | |
* | |
* Returns true if the elements has a role and its value is not of a type Literal. | |
* Otherwise returns false. | |
*/ | |
var isNonLiteralProperty = function isNonLiteralProperty(attributes, propName) { | |
var prop = (0, _jsxAstUtils.getProp)(attributes, propName); | |
if (!prop) return false; | |
var propValue = prop.value; | |
if (!propValue) return false; | |
if (propValue.type === 'Literal') return false; | |
if (propValue.type === 'JSXExpressionContainer') { | |
var expression = propValue.expression; | |
if (expression.type === 'Identifier' && expression.name === 'undefined') return false; | |
if (expression.type === 'JSXText') return false; | |
} | |
return true; | |
}; | |
var _default = isNonLiteralProperty; | |
exports["default"] = _default; | |
module.exports = exports.default; |