You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JSHint supports javascript style comments in .jshintrc. When a project contains such config file and brackets opens it, brackets-jshint fails to parse it because of comments.
Please use the following method to strip comments before you do JSON.parse in main.js
/** * Removes JavaScript comments from a string by replacing * everything between block comments and everything after * single-line comments in a non-greedy way. * * English version of the regex: * match '/*' * then match zero or more instances of any character (incl. \n) * except for instances of '* /' (without a space, obv.) * then match '* /' (again, without a space) * * @param {string} str a string with potential JavaScript comments. * @returns {string} a string without JavaScript comments. */functionremoveComments(str){str=str||"";str=str.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\//g,"");str=str.replace(/\/\/[^\n\r]*/g,"");// Everything after '//'returnstr;}
This is the same approach jshint uses with its command line interface.
I considered giving a pull request, but somehow you are using non consistent line endings in main.js and it mess up the patch. So I did not bother.
The text was updated successfully, but these errors were encountered:
JSHint supports javascript style comments in .jshintrc. When a project contains such config file and brackets opens it, brackets-jshint fails to parse it because of comments.
Please use the following method to strip comments before you do JSON.parse in main.js
This is the same approach jshint uses with its command line interface.
I considered giving a pull request, but somehow you are using non consistent line endings in main.js and it mess up the patch. So I did not bother.
The text was updated successfully, but these errors were encountered: