0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Update grunt-jscs dependency

No Issue
- grunt-jscs@1.2.0
- Clean up some instances of multiple spaces.
- Remove jscs:disable for regexes now that jscs better supports them.
This commit is contained in:
Jason Williams 2015-01-16 18:03:16 +00:00
parent d1dfc07612
commit a0e1053f76
9 changed files with 2 additions and 22 deletions

View file

@ -8,7 +8,7 @@ Ember.MODEL_FACTORY_INJECTIONS = true;
var App = Ember.Application.extend({ var App = Ember.Application.extend({
modulePrefix: 'ghost', modulePrefix: 'ghost',
Resolver: Resolver['default'] Resolver: Resolver.default
}); });
// Runtime configuration of Ember.Application // Runtime configuration of Ember.Application

View file

@ -227,9 +227,7 @@ var PostTagsInputController = Ember.Controller.extend({
makeSuggestionObject: function (matchingTag, _searchTerm) { makeSuggestionObject: function (matchingTag, _searchTerm) {
var searchTerm = Ember.Handlebars.Utils.escapeExpression(_searchTerm), var searchTerm = Ember.Handlebars.Utils.escapeExpression(_searchTerm),
// jscs:disable
regexEscapedSearchTerm = searchTerm.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'), regexEscapedSearchTerm = searchTerm.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'),
// jscs:enable
tagName = Ember.Handlebars.Utils.escapeExpression(matchingTag.get('name')), tagName = Ember.Handlebars.Utils.escapeExpression(matchingTag.get('name')),
regex = new RegExp('(' + regexEscapedSearchTerm + ')', 'gi'), regex = new RegExp('(' + regexEscapedSearchTerm + ')', 'gi'),
highlightedName, highlightedName,

View file

@ -5,12 +5,10 @@ var formatHTML = Ember.Handlebars.makeBoundHelper(function (html) {
var escapedhtml = html || ''; var escapedhtml = html || '';
// replace script and iFrame // replace script and iFrame
// jscs:disable
escapedhtml = escapedhtml.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, escapedhtml = escapedhtml.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
'<pre class="js-embed-placeholder">Embedded JavaScript</pre>'); '<pre class="js-embed-placeholder">Embedded JavaScript</pre>');
escapedhtml = escapedhtml.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, escapedhtml = escapedhtml.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
'<pre class="iframe-embed-placeholder">Embedded iFrame</pre>'); '<pre class="iframe-embed-placeholder">Embedded iFrame</pre>');
// jscs:enable
// sanitize HTML // sanitize HTML
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers // jscs:disable requireCamelCaseOrUpperCaseIdentifiers

View file

@ -13,12 +13,10 @@ formatMarkdown = Ember.Handlebars.makeBoundHelper(function (markdown) {
escapedhtml = showdown.makeHtml(markdown || ''); escapedhtml = showdown.makeHtml(markdown || '');
// replace script and iFrame // replace script and iFrame
// jscs:disable
escapedhtml = escapedhtml.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, escapedhtml = escapedhtml.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
'<pre class="js-embed-placeholder">Embedded JavaScript</pre>'); '<pre class="js-embed-placeholder">Embedded JavaScript</pre>');
escapedhtml = escapedhtml.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, escapedhtml = escapedhtml.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
'<pre class="iframe-embed-placeholder">Embedded iFrame</pre>'); '<pre class="iframe-embed-placeholder">Embedded iFrame</pre>');
// jscs:enable
// sanitize html // sanitize html
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers // jscs:disable requireCamelCaseOrUpperCaseIdentifiers

View file

@ -2,5 +2,5 @@
/*global require */ /*global require */
if (!window.disableBoot) { if (!window.disableBoot) {
window.App = require('ghost/app')['default'].create(); window.App = require('ghost/app').default.create();
} }

View file

@ -320,9 +320,7 @@ EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
var editor = this.get('codemirror'), var editor = this.get('codemirror'),
line = this.findLine(Ember.$(e.currentTarget).attr('id')), line = this.findLine(Ember.$(e.currentTarget).attr('id')),
lineNumber = editor.getLineNumber(line), lineNumber = editor.getLineNumber(line),
// jscs:disable
match = line.text.match(/\([^\n]*\)?/), match = line.text.match(/\([^\n]*\)?/),
// jscs:enable
replacement = '(http://)'; replacement = '(http://)';
if (match) { if (match) {
@ -332,9 +330,7 @@ EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
{line: lineNumber, ch: match.index + match[0].length - 1} {line: lineNumber, ch: match.index + match[0].length - 1}
); );
} else { } else {
// jscs:disable
match = line.text.match(/\]/); match = line.text.match(/\]/);
// jscs:enable
if (match) { if (match) {
editor.replaceRange( editor.replaceRange(
replacement, replacement,

View file

@ -1,8 +1,6 @@
var MarkerManager = Ember.Mixin.create({ var MarkerManager = Ember.Mixin.create({
// jscs:disable
imageMarkdownRegex: /^(?:\{<(.*?)>\})?!(?:\[([^\n\]]*)\])(?:\(([^\n\]]*)\))?$/gim, imageMarkdownRegex: /^(?:\{<(.*?)>\})?!(?:\[([^\n\]]*)\])(?:\(([^\n\]]*)\))?$/gim,
markerRegex: /\{<([\w\W]*?)>\}/, markerRegex: /\{<([\w\W]*?)>\}/,
// jscs:enable
uploadId: 1, uploadId: 1,
@ -164,9 +162,7 @@ var MarkerManager = Ember.Mixin.create({
var editor = this.get('codemirror'), var editor = this.get('codemirror'),
ln = editor.getLineNumber(line), ln = editor.getLineNumber(line),
// jscs:disable
markerRegex = /\{<([\w\W]*?)>\}/, markerRegex = /\{<([\w\W]*?)>\}/,
// jscs:enable
markerText = line.text.match(markerRegex); markerText = line.text.match(markerRegex);

View file

@ -9,12 +9,10 @@ var url,
* URLs are allowed if they start with http://, https://, or /. * URLs are allowed if they start with http://, https://, or /.
*/ */
url = function (url) { url = function (url) {
// jscs:disable
url = url.toString().replace(/['"]+/g, ''); url = url.toString().replace(/['"]+/g, '');
if (/^https?:\/\//.test(url) || /^\//.test(url)) { if (/^https?:\/\//.test(url) || /^\//.test(url)) {
return url; return url;
} }
// jscs:enable
}; };
/** /**

View file

@ -49,9 +49,7 @@ function init() {
hashPrefix = new Array(currentHeaderLevel + 2).join('#'); hashPrefix = new Array(currentHeaderLevel + 2).join('#');
// jscs:disable
replacementLine = hashPrefix + ' ' + line.replace(/^#* /, ''); replacementLine = hashPrefix + ' ' + line.replace(/^#* /, '');
// jscs:enable
this.replaceRange(replacementLine, fromLineStart, toLineEnd); this.replaceRange(replacementLine, fromLineStart, toLineEnd);
this.setCursor(cursor.line, cursor.ch + replacementLine.length); this.setCursor(cursor.line, cursor.ch + replacementLine.length);
@ -86,9 +84,7 @@ function init() {
return; return;
case 'list': case 'list':
// jscs:disable
md = text.replace(/^(\s*)(\w\W*)/gm, '$1* $2'); md = text.replace(/^(\s*)(\w\W*)/gm, '$1* $2');
// jscs:enable
this.replaceSelection(md, 'end'); this.replaceSelection(md, 'end');
return; return;