0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

Merge pull request #4810 from jaswilli/jscs-cleanup

Update grunt-jscs dependency
This commit is contained in:
Hannah Wolfe 2015-01-16 18:42:20 +00:00
commit 75ef56e91b
12 changed files with 8 additions and 28 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -30,7 +30,7 @@ utils = {
}
return Promise.resolve(object);
},
checkFileExists: function (options, filename) {
checkFileExists: function (options, filename) {
return options[filename] && options[filename].type && options[filename].path;
},
checkFileIsValid: function (file, types, extensions) {

View file

@ -58,7 +58,7 @@ describe('Import', function () {
});
describe('Sanitizes', function () {
before(function () {
before(function () {
knex = config.database.knex;
});
beforeEach(testUtils.setup('roles', 'owner', 'settings'));
@ -122,7 +122,7 @@ describe('Import', function () {
});
describe('DataImporter', function () {
before(function () {
before(function () {
knex = config.database.knex;
});
beforeEach(testUtils.setup('roles', 'owner', 'settings'));
@ -337,7 +337,7 @@ describe('Import', function () {
});
describe('002', function () {
before(function () {
before(function () {
knex = config.database.knex;
});
beforeEach(testUtils.setup('roles', 'owner', 'settings'));
@ -507,7 +507,7 @@ describe('Import', function () {
});
describe('003', function () {
before(function () {
before(function () {
knex = config.database.knex;
});
beforeEach(testUtils.setup('roles', 'owner', 'settings'));

View file

@ -88,7 +88,7 @@
"grunt-ember-templates": "~0.5.0-alpha",
"grunt-es6-module-transpiler": "~0.6.0",
"grunt-express-server": "~0.4.19",
"grunt-jscs": "~1.1.0",
"grunt-jscs": "~1.2.0",
"grunt-mocha-cli": "~1.11.0",
"grunt-sass": "~0.16.1",
"grunt-shell": "~1.1.1",