Every line of 'eslint ignore comments' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
33 function isPrettierIgnoreComment(comment) { 34 return comment.image.match( 35 /(\/\/(\s*)prettier-ignore(\s*))|(\/\*(\s*)prettier-ignore(\s*)\*\/)/gm 36 ); 37 }
47 export default function blankComments(code, file, options) { 48 const comments = options.comments 49 50 const onComment = function (block, text, start, end) { 51 if (comments !== false) { 52 text = (block ? '*' : '/') + text 53 for (let i = 0; i < comments.length; i++) { 54 if (comments[i].test(text)) return 55 } 56 } 57 text = code.slice(start, end).replace(NOBLANK, blankBlock) 58 code = code.slice(0, start) + text + code.slice(end) 59 } 60 61 // Now replace the comments. As blankComment will not change code 62 // positions, trimming empty lines will be easy. 63 acorn.parse(code, Object.assign( 64 {}, 65 options.acornOptions, 66 { onComment } 67 )) 68 69 return code 70 }