MCPcopy
hub / github.com/ajaxorg/ace / lintingDirective

Function lintingDirective

lib/ace/mode/javascript/jshint.js:4841–5141  ·  view source on GitHub ↗

* Process an inline linting directive * * @param {Token} directiveToken - the directive-bearing comment token * @param {Token} previous - the token that preceeds the directive

(directiveToken, previous)

Source from the content-addressed store, hash-verified

4839 * @param {Token} previous - the token that preceeds the directive
4840 */
4841 function lintingDirective(directiveToken, previous) {
4842 var body = directiveToken.body.split(",")
4843 .map(function(s) { return s.trim(); });
4844 var predef = {};
4845
4846 if (directiveToken.type === "falls through") {
4847 previous.caseFallsThrough = true;
4848 return;
4849 }
4850
4851 if (directiveToken.type === "globals") {
4852 body.forEach(function(item, idx) {
4853 var parts = item.split(":");
4854 var key = parts[0].trim();
4855
4856 if (key === "-" || !key.length) {
4857 // Ignore trailing comma
4858 if (idx > 0 && idx === body.length - 1) {
4859 return;
4860 }
4861 error("E002", directiveToken);
4862 return;
4863 }
4864
4865 if (key.charAt(0) === "-") {
4866 key = key.slice(1);
4867
4868 JSHINT.blacklist[key] = key;
4869 delete predefined[key];
4870 } else {
4871 predef[key] = parts.length > 1 && parts[1].trim() === "true";
4872 }
4873 });
4874
4875 combine(predefined, predef);
4876
4877 for (var key in predef) {
4878 if (_.has(predef, key)) {
4879 declared[key] = directiveToken;
4880 }
4881 }
4882 }
4883
4884 if (directiveToken.type === "exported") {
4885 body.forEach(function(e, idx) {
4886 if (!e.length) {
4887 // Ignore trailing comma
4888 if (idx > 0 && idx === body.length - 1) {
4889 return;
4890 }
4891 error("E002", directiveToken);
4892 return;
4893 }
4894
4895 state.funct["(scope)"].addExported(e);
4896 });
4897 }
4898

Callers 1

advanceFunction · 0.85

Calls 13

combineFunction · 0.85
checkOptionFunction · 0.85
isFiniteFunction · 0.85
removeIgnoredMessagesFunction · 0.85
hasParsedCodeFunction · 0.85
applyOptionsFunction · 0.85
mapMethod · 0.80
splitMethod · 0.80
sliceMethod · 0.80
execMethod · 0.80
errorFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…