From 61532301fbec88be5b77666d91e96e90d0d84b52 Mon Sep 17 00:00:00 2001 From: sveisvei Date: Sat, 18 Jun 2016 21:55:46 +0200 Subject: [PATCH] eslint --fix --- packages/unleash-api/app.js | 2 +- packages/unleash-api/lib/db/dbPool.js | 2 +- packages/unleash-api/lib/db/event.js | 8 +- packages/unleash-api/lib/db/feature.js | 6 +- packages/unleash-api/lib/db/strategy.js | 4 +- .../unleash-api/lib/error/validateRequest.js | 4 +- packages/unleash-api/lib/eventDiffer.js | 6 +- packages/unleash-api/lib/eventType.js | 2 +- packages/unleash-api/lib/extractUser.js | 2 +- .../unleash-api/lib/routes/feature-archive.js | 10 +-- packages/unleash-api/lib/routes/feature.js | 36 ++++----- packages/unleash-api/lib/routes/strategy.js | 26 +++---- .../unleash-api/scripts/migration-runner.js | 4 +- packages/unleash-api/server-impl.js | 6 +- packages/unleash-api/test/databaseConfig.js | 2 +- packages/unleash-api/test/eventDifferTest.js | 32 ++++---- packages/unleash-api/test/specHelper.js | 76 +++++++++---------- .../unleash-frontend/jest-preprocessor.js | 2 +- packages/unleash-frontend/lib/index.js | 2 +- packages/unleash-frontend/lib/server-dev.js | 2 +- .../unleash-frontend/public/js/UnleashApp.jsx | 24 +++--- .../js/__tests__/components/Menu-test.js | 6 +- .../feature/ArchiveFeatureComponent-test.js | 24 +++--- .../components/feature/FeatureForm-test.js | 28 +++---- .../components/feature/FeatureList-test.js | 40 +++++----- .../stores/FeatureToggleStore-test.js | 22 +++--- .../public/js/components/ErrorMessages.jsx | 18 ++--- .../public/js/components/ErrorMessages.ui.jsx | 2 +- .../public/js/components/Menu.jsx | 2 +- .../public/js/components/User.jsx | 14 ++-- .../feature/ArchiveFeatureComponent.jsx | 4 +- .../public/js/components/feature/Feature.jsx | 25 +++--- .../js/components/feature/FeatureForm.jsx | 28 +++---- .../js/components/feature/FeatureList.jsx | 20 +++-- .../feature/FeatureTogglesComponent.jsx | 14 ++-- .../public/js/components/form/TextInput.jsx | 8 +- .../js/components/log/LogEntriesComponent.jsx | 6 +- .../public/js/components/log/LogEntry.jsx | 12 +-- .../public/js/components/log/LogEntryList.jsx | 10 +-- .../strategy/StrategiesComponent.jsx | 16 ++-- .../js/components/strategy/Strategy.jsx | 4 +- .../js/components/strategy/StrategyForm.jsx | 22 +++--- .../js/components/strategy/StrategyList.jsx | 6 +- .../public/js/stores/ArchivedToggleStore.js | 2 +- .../public/js/stores/ErrorActions.js | 4 +- .../public/js/stores/ErrorStore.js | 6 +- .../public/js/stores/EventStore.js | 6 +- .../public/js/stores/FeatureToggleActions.js | 4 +- .../js/stores/FeatureToggleServerFacade.js | 14 ++-- .../public/js/stores/FeatureToggleStore.js | 2 +- .../public/js/stores/StrategyAPI.js | 8 +- .../public/js/stores/StrategyActions.js | 2 +- .../public/js/stores/StrategyStore.js | 2 +- .../public/js/stores/UserStore.js | 4 +- .../unleash-frontend/public/js/utils/Timer.js | 2 +- packages/unleash-frontend/webpack.config.js | 12 +-- 56 files changed, 327 insertions(+), 330 deletions(-) diff --git a/packages/unleash-api/app.js b/packages/unleash-api/app.js index f8733969d5..cc3da3642c 100644 --- a/packages/unleash-api/app.js +++ b/packages/unleash-api/app.js @@ -32,7 +32,7 @@ module.exports = function(config) { app.use(bodyParser.json({ strict: false })); app.use(log4js.connectLogger(logger, { format: ':remote-addr :status :method :url :response-timems', - level: 'auto' // 3XX=WARN, 4xx/5xx=ERROR + level: 'auto', // 3XX=WARN, 4xx/5xx=ERROR })); // Setup API routes diff --git a/packages/unleash-api/lib/db/dbPool.js b/packages/unleash-api/lib/db/dbPool.js index dd376dfd66..761657c71b 100644 --- a/packages/unleash-api/lib/db/dbPool.js +++ b/packages/unleash-api/lib/db/dbPool.js @@ -5,6 +5,6 @@ module.exports = function(databaseConnection) { return knex({ client: 'pg', connection: databaseConnection, - pool: { min: 2, max: 20 } + pool: { min: 2, max: 20 }, }); }; diff --git a/packages/unleash-api/lib/db/event.js b/packages/unleash-api/lib/db/event.js index 147f9c25c7..8196d1cb89 100644 --- a/packages/unleash-api/lib/db/event.js +++ b/packages/unleash-api/lib/db/event.js @@ -6,7 +6,7 @@ module.exports = function(db) { return db('events').insert({ type: event.type, created_by: event.createdBy, // eslint-disable-line - data: event.data + data: event.data, }); } @@ -22,7 +22,7 @@ module.exports = function(db) { return db .select(EVENT_COLUMNS) .from('events') - .whereRaw("data ->> 'name' = ?", [name]) + .whereRaw('data ->> \'name\' = ?', [name]) .orderBy('created_at', 'desc') .map(rowToEvent); } @@ -33,14 +33,14 @@ module.exports = function(db) { type: row.type, createdBy: row.created_by, createdAt: row.created_at, - data: row.data + data: row.data, }; } return { store: storeEvent, getEvents, - getEventsFilterByName + getEventsFilterByName, }; }; diff --git a/packages/unleash-api/lib/db/feature.js b/packages/unleash-api/lib/db/feature.js index 4df93d3f9b..2de1185ca9 100644 --- a/packages/unleash-api/lib/db/feature.js +++ b/packages/unleash-api/lib/db/feature.js @@ -50,7 +50,7 @@ module.exports = function(db, eventStore) { description: row.description, enabled: row.enabled > 0, strategy: row.strategy_name, // eslint-disable-line - parameters: row.parameters + parameters: row.parameters, }; } @@ -61,7 +61,7 @@ module.exports = function(db, eventStore) { enabled: data.enabled ? 1 : 0, archived: data.archived ? 1 :0, strategy_name: data.strategy, // eslint-disable-line - parameters: data.parameters + parameters: data.parameters, }; } @@ -106,6 +106,6 @@ module.exports = function(db, eventStore) { getFeature, getArchivedFeatures, _createFeature: createFeature, // visible for testing - _updateFeature: updateFeature // visible for testing + _updateFeature: updateFeature, // visible for testing }; }; diff --git a/packages/unleash-api/lib/db/strategy.js b/packages/unleash-api/lib/db/strategy.js index 7aeebf7cd7..5fafe7fd6e 100644 --- a/packages/unleash-api/lib/db/strategy.js +++ b/packages/unleash-api/lib/db/strategy.js @@ -40,7 +40,7 @@ module.exports = function(db, eventStore) { return { name: row.name, description: row.description, - parametersTemplate: row.parameters_template + parametersTemplate: row.parameters_template, }; } @@ -63,7 +63,7 @@ module.exports = function(db, eventStore) { return { getStrategies, getStrategy, - _createStrategy: createStrategy // visible for testing + _createStrategy: createStrategy, // visible for testing }; }; diff --git a/packages/unleash-api/lib/error/validateRequest.js b/packages/unleash-api/lib/error/validateRequest.js index 990fd7f659..a09691b309 100644 --- a/packages/unleash-api/lib/error/validateRequest.js +++ b/packages/unleash-api/lib/error/validateRequest.js @@ -1,11 +1,11 @@ 'use strict'; -const Promise = require("bluebird"); +const Promise = require('bluebird'); const ValidationError = require('./ValidationError'); function validateRequest(req) { return new Promise((resolve, reject) => { if (req.validationErrors()) { - reject(new ValidationError("Invalid syntax")); + reject(new ValidationError('Invalid syntax')); } else { resolve(req); } diff --git a/packages/unleash-api/lib/eventDiffer.js b/packages/unleash-api/lib/eventDiffer.js index 6364399151..91fd9ddcd4 100644 --- a/packages/unleash-api/lib/eventDiffer.js +++ b/packages/unleash-api/lib/eventDiffer.js @@ -4,14 +4,14 @@ const diff = require('deep-diff').diff; const strategyTypes = [ eventType.strategyCreated, - eventType.strategyDeleted + eventType.strategyDeleted, ]; const featureTypes = [ eventType.featureCreated, eventType.featureUpdated, eventType.featureArchived, - eventType.featureRevived + eventType.featureRevived, ]; function baseTypeFor(event) { @@ -74,5 +74,5 @@ function addDiffs(events) { module.exports = { - addDiffs + addDiffs, }; diff --git a/packages/unleash-api/lib/eventType.js b/packages/unleash-api/lib/eventType.js index 1c2aee856e..267405c64b 100644 --- a/packages/unleash-api/lib/eventType.js +++ b/packages/unleash-api/lib/eventType.js @@ -5,5 +5,5 @@ module.exports = { featureArchived: 'feature-archived', featureRevived: 'feature-revived', strategyCreated: 'strategy-created', - strategyDeleted: 'strategy-deleted' + strategyDeleted: 'strategy-deleted', }; diff --git a/packages/unleash-api/lib/extractUser.js b/packages/unleash-api/lib/extractUser.js index 3471ac6093..69006970ad 100644 --- a/packages/unleash-api/lib/extractUser.js +++ b/packages/unleash-api/lib/extractUser.js @@ -1,5 +1,5 @@ 'use strict'; function extractUsername(req) { - return req.cookies.username || "unknown"; + return req.cookies.username || 'unknown'; } module.exports = extractUsername; diff --git a/packages/unleash-api/lib/routes/feature-archive.js b/packages/unleash-api/lib/routes/feature-archive.js index 873d03df15..33cc47e1f0 100644 --- a/packages/unleash-api/lib/routes/feature-archive.js +++ b/packages/unleash-api/lib/routes/feature-archive.js @@ -19,16 +19,16 @@ module.exports = function (app, config) { validateRequest(req) .then(() => eventStore.create({ - type: eventType.featureRevived, - createdBy: req.connection.remoteAddress, - data: req.body - })).then(() => { + type: eventType.featureRevived, + createdBy: req.connection.remoteAddress, + data: req.body, + })).then(() => { res.status(200).end(); }).catch(ValidationError, () => { res.status(400).json(req.validationErrors()); }) .catch(err => { - logger.error("Could not revive feature toggle", err); + logger.error('Could not revive feature toggle', err); res.status(500).end(); }); }); diff --git a/packages/unleash-api/lib/routes/feature.js b/packages/unleash-api/lib/routes/feature.js index acd028f5dd..508aa5fc53 100644 --- a/packages/unleash-api/lib/routes/feature.js +++ b/packages/unleash-api/lib/routes/feature.js @@ -1,5 +1,5 @@ 'use strict'; -const Promise = require("bluebird"); +const Promise = require('bluebird'); const logger = require('../logger'); const eventType = require('../eventType'); const NameExistsError = require('../error/NameExistsError'); @@ -35,23 +35,23 @@ module.exports = function (app, config) { validateRequest(req) .then(validateUniqueName) .then(() => eventStore.create({ - type: eventType.featureCreated, - createdBy: extractUser(req), - data: req.body - })) + type: eventType.featureCreated, + createdBy: extractUser(req), + data: req.body, + })) .then(() => { res.status(201).end(); }) .catch(NameExistsError, () => { res.status(403).json([{ - msg: `A feature named '${req.body.name}' already exists. It could be archived.` + msg: `A feature named '${req.body.name}' already exists. It could be archived.`, }]).end(); }) .catch(ValidationError, () => { res.status(400).json(req.validationErrors()); }) .catch(err => { - logger.error("Could not create feature toggle", err); + logger.error('Could not create feature toggle', err); res.status(500).end(); }); }); @@ -65,10 +65,10 @@ module.exports = function (app, config) { featureDb.getFeature(featureName) .then(() => eventStore.create({ - type: eventType.featureUpdated, - createdBy: userName, - data: updatedFeature - })) + type: eventType.featureUpdated, + createdBy: userName, + data: updatedFeature, + })) .then(() => { res.status(200).end(); }) @@ -87,12 +87,12 @@ module.exports = function (app, config) { featureDb.getFeature(featureName) .then(() => eventStore.create({ - type: eventType.featureArchived, - createdBy: userName, - data: { - name: featureName - } - })) + type: eventType.featureArchived, + createdBy: userName, + data: { + name: featureName, + }, + })) .then(() => { res.status(200).end(); }) @@ -109,7 +109,7 @@ module.exports = function (app, config) { return new Promise((resolve, reject) => { featureDb.getFeature(req.body.name) .then(() => { - reject(new NameExistsError("Feature name already exist")); + reject(new NameExistsError('Feature name already exist')); }, () => { resolve(req); }); diff --git a/packages/unleash-api/lib/routes/strategy.js b/packages/unleash-api/lib/routes/strategy.js index 4ea217ddcc..ec9abd5b0b 100644 --- a/packages/unleash-api/lib/routes/strategy.js +++ b/packages/unleash-api/lib/routes/strategy.js @@ -1,5 +1,5 @@ 'use strict'; -const Promise = require("bluebird"); +const Promise = require('bluebird'); const eventType = require('../eventType'); const logger = require('../logger'); const NameExistsError = require('../error/NameExistsError'); @@ -33,12 +33,12 @@ module.exports = function (app, config) { strategyDb.getStrategy(strategyName) .then(() => eventStore.create({ - type: eventType.strategyDeleted, - createdBy: extractUser(req), - data: { - name: strategyName - } - })) + type: eventType.strategyDeleted, + createdBy: extractUser(req), + data: { + name: strategyName, + }, + })) .then(() => { res.status(200).end(); }) @@ -60,10 +60,10 @@ module.exports = function (app, config) { validateRequest(req) .then(validateStrategyName) .then(() => eventStore.create({ - type: eventType.strategyCreated, - createdBy: extractUser(req), - data: newStrategy - })) + type: eventType.strategyCreated, + createdBy: extractUser(req), + data: newStrategy, + })) .then(() => { res.status(201).end(); }) @@ -74,7 +74,7 @@ module.exports = function (app, config) { res.status(400).json(req.validationErrors()); }) .catch(err => { - logger.error("Could not create strategy", err); + logger.error('Could not create strategy', err); res.status(500).end(); }); }); @@ -83,7 +83,7 @@ module.exports = function (app, config) { return new Promise((resolve, reject) => { strategyDb.getStrategy(req.body.name) .then(() => { - reject(new NameExistsError("Feature name already exist")); + reject(new NameExistsError('Feature name already exist')); }, () => { resolve(req); }); diff --git a/packages/unleash-api/scripts/migration-runner.js b/packages/unleash-api/scripts/migration-runner.js index d4594251ac..3696e5b6e4 100644 --- a/packages/unleash-api/scripts/migration-runner.js +++ b/packages/unleash-api/scripts/migration-runner.js @@ -13,7 +13,7 @@ module.exports = { return { up: runMigration.bind(null, util.format(format, name, 'up')), - down: runMigration.bind(null, util.format(format, name, 'down')) + down: runMigration.bind(null, util.format(format, name, 'down')), }; - } + }, }; diff --git a/packages/unleash-api/server-impl.js b/packages/unleash-api/server-impl.js index 35e4d2a0ff..d06e6f3acd 100644 --- a/packages/unleash-api/server-impl.js +++ b/packages/unleash-api/server-impl.js @@ -21,7 +21,7 @@ function start(options) { eventStore, featureDb, strategyDb, - publicFolder: options.publicFolder + publicFolder: options.publicFolder, }; const app = require('./app')(config); @@ -33,7 +33,7 @@ function start(options) { return { app, server, - config + config, }; } @@ -43,5 +43,5 @@ process.on('uncaughtException', err => { }); module.exports = { - start + start, }; diff --git a/packages/unleash-api/test/databaseConfig.js b/packages/unleash-api/test/databaseConfig.js index 2f4ecc03e7..430438fe87 100644 --- a/packages/unleash-api/test/databaseConfig.js +++ b/packages/unleash-api/test/databaseConfig.js @@ -7,5 +7,5 @@ function getDatabaseUri() { } } module.exports = { - getDatabaseUri + getDatabaseUri, }; diff --git a/packages/unleash-api/test/eventDifferTest.js b/packages/unleash-api/test/eventDifferTest.js index e0bd5e9dc0..9d13c954b2 100644 --- a/packages/unleash-api/test/eventDifferTest.js +++ b/packages/unleash-api/test/eventDifferTest.js @@ -7,7 +7,7 @@ describe('eventDiffer', () => { it('fails if events include an unknown event type', () => { const events = [ { type: eventType.featureCreated, data: {} }, - { type: 'unknown-type', data: {} } + { type: 'unknown-type', data: {} }, ]; assert.throws(() => { @@ -22,19 +22,19 @@ describe('eventDiffer', () => { const events = [ { type: eventType.featureUpdated, - data: { name, description: desc, strategy: 'default', enabled: true, parameters: { value: 2 } } + data: { name, description: desc, strategy: 'default', enabled: true, parameters: { value: 2 } }, }, { type: eventType.featureCreated, - data: { name, description: desc, strategy: 'default', enabled: false, parameters: { value: 1 } } - } + data: { name, description: desc, strategy: 'default', enabled: false, parameters: { value: 1 } }, + }, ]; eventDiffer.addDiffs(events); assert.deepEqual(events[0].diffs, [ - { kind: 'E', path: ["enabled"], lhs: false, rhs: true }, - { kind: 'E', path: ["parameters", "value"], lhs: 1, rhs: 2 } + { kind: 'E', path: ['enabled'], lhs: false, rhs: true }, + { kind: 'E', path: ['parameters', 'value'], lhs: 1, rhs: 2 }, ]); assert.strictEqual(events[1].diffs, null); @@ -44,20 +44,20 @@ describe('eventDiffer', () => { const events = [ { type: eventType.featureUpdated, - data: { name: 'bar', description: 'desc', strategy: 'default', enabled: true, parameters: {} } + data: { name: 'bar', description: 'desc', strategy: 'default', enabled: true, parameters: {} }, }, { type: eventType.featureUpdated, - data: { name: 'foo', description: 'desc', strategy: 'default', enabled: false, parameters: {} } + data: { name: 'foo', description: 'desc', strategy: 'default', enabled: false, parameters: {} }, }, { type: eventType.featureCreated, - data: { name: 'bar', description: 'desc', strategy: 'default', enabled: false, parameters: {} } + data: { name: 'bar', description: 'desc', strategy: 'default', enabled: false, parameters: {} }, }, { type: eventType.featureCreated, - data: { name: 'foo', description: 'desc', strategy: 'default', enabled: true, parameters: {} } - } + data: { name: 'foo', description: 'desc', strategy: 'default', enabled: true, parameters: {} }, + }, ]; eventDiffer.addDiffs(events); @@ -72,12 +72,12 @@ describe('eventDiffer', () => { const events = [ { type: eventType.featureUpdated, - data: { name: 'foo', description: 'desc', strategy: 'default', enabled: true, parameters: {} } + data: { name: 'foo', description: 'desc', strategy: 'default', enabled: true, parameters: {} }, }, { type: eventType.featureCreated, - data: { name: 'foo', description: 'desc', strategy: 'default', enabled: true, parameters: {} } - } + data: { name: 'foo', description: 'desc', strategy: 'default', enabled: true, parameters: {} }, + }, ]; eventDiffer.addDiffs(events); @@ -88,8 +88,8 @@ describe('eventDiffer', () => { const events = [ { type: eventType.featureUpdated, - data: { name: 'foo', description: 'desc', strategy: 'default', enabled: true, parameters: {} } - } + data: { name: 'foo', description: 'desc', strategy: 'default', enabled: true, parameters: {} }, + }, ]; eventDiffer.addDiffs(events); diff --git a/packages/unleash-api/test/specHelper.js b/packages/unleash-api/test/specHelper.js index bcb61ee5e4..716e18da00 100644 --- a/packages/unleash-api/test/specHelper.js +++ b/packages/unleash-api/test/specHelper.js @@ -17,7 +17,7 @@ const app = require('../app')({ eventDb, eventStore, featureDb, - strategyDb + strategyDb, }); Promise.promisifyAll(request); @@ -26,73 +26,73 @@ request = request(app); function createStrategies() { return Promise.map([ { - name: "default", - description: "Default on or off Strategy.", - parametersTemplate: {} + name: 'default', + description: 'Default on or off Strategy.', + parametersTemplate: {}, }, { - name: "usersWithEmail", - description: "Active for users defined in the comma-separated emails-parameter.", + name: 'usersWithEmail', + description: 'Active for users defined in the comma-separated emails-parameter.', parametersTemplate: { - emails: "String" - } - } + emails: 'String', + }, + }, ], strategy => strategyDb._createStrategy(strategy)); } function createFeatures() { return Promise.map([ { - name: "featureX", - description: "the #1 feature", + name: 'featureX', + description: 'the #1 feature', enabled: true, - strategy: "default" + strategy: 'default', }, { - name: "featureY", - description: "soon to be the #1 feature", + name: 'featureY', + description: 'soon to be the #1 feature', enabled: false, - strategy: "baz", + strategy: 'baz', parameters: { - foo: "bar" - } + foo: 'bar', + }, }, { - name: "featureZ", - description: "terrible feature", + name: 'featureZ', + description: 'terrible feature', enabled: true, - strategy: "baz", + strategy: 'baz', parameters: { - foo: "rab" - } + foo: 'rab', + }, }, { - name: "featureArchivedX", - description: "the #1 feature", + name: 'featureArchivedX', + description: 'the #1 feature', enabled: true, archived: true, - strategy: "default" + strategy: 'default', }, { - name: "featureArchivedY", - description: "soon to be the #1 feature", + name: 'featureArchivedY', + description: 'soon to be the #1 feature', enabled: false, archived: true, - strategy: "baz", + strategy: 'baz', parameters: { - foo: "bar" - } + foo: 'bar', + }, }, { - name: "featureArchivedZ", - description: "terrible feature", + name: 'featureArchivedZ', + description: 'terrible feature', enabled: true, archived: true, - strategy: "baz", + strategy: 'baz', parameters: { - foo: "rab" - } - } + foo: 'rab', + }, + }, ], feature => featureDb._createFeature(feature)); } @@ -119,6 +119,6 @@ module.exports = { setup: setupDatabase, resetAndSetup() { return resetDatabase().then(setupDatabase); - } - } + }, + }, }; diff --git a/packages/unleash-frontend/jest-preprocessor.js b/packages/unleash-frontend/jest-preprocessor.js index 6379efc14b..d16cc2c3c9 100644 --- a/packages/unleash-frontend/jest-preprocessor.js +++ b/packages/unleash-frontend/jest-preprocessor.js @@ -5,5 +5,5 @@ const ReactTools = require('react-tools'); module.exports = { process(src) { return ReactTools.transform(src); - } + }, }; diff --git a/packages/unleash-frontend/lib/index.js b/packages/unleash-frontend/lib/index.js index 84cd000395..1a26e24151 100644 --- a/packages/unleash-frontend/lib/index.js +++ b/packages/unleash-frontend/lib/index.js @@ -2,5 +2,5 @@ const path = require('path'); module.exports = { - publicFolder: path.join(__dirname, '..', 'public') + publicFolder: path.join(__dirname, '..', 'public'), }; diff --git a/packages/unleash-frontend/lib/server-dev.js b/packages/unleash-frontend/lib/server-dev.js index 7f2a0855ba..f4e6106e3e 100644 --- a/packages/unleash-frontend/lib/server-dev.js +++ b/packages/unleash-frontend/lib/server-dev.js @@ -12,5 +12,5 @@ const compiler = webpack(webpackConfig); app.use(config.baseUriPath, webpackDevMiddleware(compiler, { publicPath: '/js', - noInfo: true + noInfo: true, })); diff --git a/packages/unleash-frontend/public/js/UnleashApp.jsx b/packages/unleash-frontend/public/js/UnleashApp.jsx index e0a85d9a12..5d0c42587c 100644 --- a/packages/unleash-frontend/public/js/UnleashApp.jsx +++ b/packages/unleash-frontend/public/js/UnleashApp.jsx @@ -12,32 +12,32 @@ const RouteHandler = Router.RouteHandler; const UnleashApp = React.createClass({ contextTypes: { - router: React.PropTypes.func + router: React.PropTypes.func, }, getInitialState() { return { - features: FeatureToggleStore.getFeatureToggles(), - strategies: StrategyStore.getStrategies(), - archivedFeatures: ArchiveStore.getArchivedToggles() + features: FeatureToggleStore.getFeatureToggles(), + strategies: StrategyStore.getStrategies(), + archivedFeatures: ArchiveStore.getArchivedToggles(), }; }, onFeatureToggleChange() { this.setState({ - features: FeatureToggleStore.getFeatureToggles() + features: FeatureToggleStore.getFeatureToggles(), }); }, onStrategiesChange() { this.setState({ - strategies: StrategyStore.getStrategies() + strategies: StrategyStore.getStrategies(), }); }, onArchiveChange() { this.setState({ - archivedFeatures: ArchiveStore.getArchivedToggles() + archivedFeatures: ArchiveStore.getArchivedToggles(), }); }, @@ -68,10 +68,10 @@ const UnleashApp = React.createClass({ return (
- {this.renderLink("features", "Toggles")} - {this.renderLink("strategies", "Strategies")} - {this.renderLink("log", "Log")} - {this.renderLink("archive", "Archive")} + {this.renderLink('features', 'Toggles')} + {this.renderLink('strategies', 'Strategies')} + {this.renderLink('log', 'Log')} + {this.renderLink('archive', 'Archive')}
@@ -91,7 +91,7 @@ const UnleashApp = React.createClass({
); - } + }, }); diff --git a/packages/unleash-frontend/public/js/__tests__/components/Menu-test.js b/packages/unleash-frontend/public/js/__tests__/components/Menu-test.js index 320d1c0b11..60858d213e 100644 --- a/packages/unleash-frontend/public/js/__tests__/components/Menu-test.js +++ b/packages/unleash-frontend/public/js/__tests__/components/Menu-test.js @@ -2,10 +2,10 @@ 'use strict'; -jest.dontMock("../../components/Menu"); +jest.dontMock('../../components/Menu'); -const Menu = require("../../components/Menu"); -const React = require("react/addons"); +const Menu = require('../../components/Menu'); +const React = require('react/addons'); const TestUtils = React.addons.TestUtils; describe('Menu test', () => { diff --git a/packages/unleash-frontend/public/js/__tests__/components/feature/ArchiveFeatureComponent-test.js b/packages/unleash-frontend/public/js/__tests__/components/feature/ArchiveFeatureComponent-test.js index 49facccea8..b1a70fc851 100644 --- a/packages/unleash-frontend/public/js/__tests__/components/feature/ArchiveFeatureComponent-test.js +++ b/packages/unleash-frontend/public/js/__tests__/components/feature/ArchiveFeatureComponent-test.js @@ -1,19 +1,19 @@ 'use strict'; -jest.dontMock("../../../components/feature/ArchiveFeatureComponent"); -jest.mock("../../../stores/FeatureToggleActions"); +jest.dontMock('../../../components/feature/ArchiveFeatureComponent'); +jest.mock('../../../stores/FeatureToggleActions'); jest.autoMockOff(); -const React = require("react/addons"); +const React = require('react/addons'); const TestUtils = React.addons.TestUtils; -const FeatureArchive = require("../../../components/feature/ArchiveFeatureComponent"); -const FeatureActions = require("../../../stores/FeatureToggleActions"); +const FeatureArchive = require('../../../components/feature/ArchiveFeatureComponent'); +const FeatureActions = require('../../../stores/FeatureToggleActions'); -describe("FeatureForm", () => { +describe('FeatureForm', () => { let Component; beforeEach(() => { const archivedToggles = [ - { name: "featureX" }, - { name: "featureY" } + { name: 'featureX' }, + { name: 'featureY' }, ]; Component = TestUtils.renderIntoDocument( @@ -24,14 +24,14 @@ describe("FeatureForm", () => { React.unmountComponentAtNode(document.body); }); - it("should render two archived features", () => { - const rows = Component.getDOMNode().querySelectorAll("tbody tr"); + it('should render two archived features', () => { + const rows = Component.getDOMNode().querySelectorAll('tbody tr'); expect(rows.length).toEqual(2); }); - it("should revive archived feature toggle", () => { - const button = Component.getDOMNode().querySelector("tbody button"); + it('should revive archived feature toggle', () => { + const button = Component.getDOMNode().querySelector('tbody button'); TestUtils.Simulate.click(button); jest.runAllTimers(); diff --git a/packages/unleash-frontend/public/js/__tests__/components/feature/FeatureForm-test.js b/packages/unleash-frontend/public/js/__tests__/components/feature/FeatureForm-test.js index 60df741a34..785c8bd5e2 100644 --- a/packages/unleash-frontend/public/js/__tests__/components/feature/FeatureForm-test.js +++ b/packages/unleash-frontend/public/js/__tests__/components/feature/FeatureForm-test.js @@ -1,35 +1,35 @@ 'use strict'; -jest.dontMock("../../../components/feature/FeatureForm"); +jest.dontMock('../../../components/feature/FeatureForm'); -const React = require("react/addons"); +const React = require('react/addons'); const TestUtils = React.addons.TestUtils; -const FeatureForm = require("../../../components/feature/FeatureForm"); +const FeatureForm = require('../../../components/feature/FeatureForm'); -describe("FeatureForm", () => { +describe('FeatureForm', () => { let Component; const strategies = [ - { name: "default" } + { name: 'default' }, ]; afterEach(() => { React.unmountComponentAtNode(document.body); }); - describe("new", () => { - it("should render empty form", () => { + describe('new', () => { + it('should render empty form', () => { Component = TestUtils .renderIntoDocument(); - const name = Component.getDOMNode().querySelectorAll("input"); - expect(name[0].value).toEqual(""); + const name = Component.getDOMNode().querySelectorAll('input'); + expect(name[0].value).toEqual(''); }); }); - describe("edit", () => { - const feature = { name: "Test", strategy: "unknown" }; + describe('edit', () => { + const feature = { name: 'Test', strategy: 'unknown' }; - it("should show unknown strategy as default", () => { + it('should show unknown strategy as default', () => { Component = TestUtils .renderIntoDocument(); - const strategySelect = Component.getDOMNode().querySelector("select"); - expect(strategySelect.value).toEqual("default"); + const strategySelect = Component.getDOMNode().querySelector('select'); + expect(strategySelect.value).toEqual('default'); }); }); }); diff --git a/packages/unleash-frontend/public/js/__tests__/components/feature/FeatureList-test.js b/packages/unleash-frontend/public/js/__tests__/components/feature/FeatureList-test.js index d6225ea702..0a01a20cb3 100644 --- a/packages/unleash-frontend/public/js/__tests__/components/feature/FeatureList-test.js +++ b/packages/unleash-frontend/public/js/__tests__/components/feature/FeatureList-test.js @@ -1,22 +1,22 @@ 'use strict'; -jest.dontMock("../../../components/feature/FeatureList"); -jest.dontMock("../../../components/feature/Feature"); +jest.dontMock('../../../components/feature/FeatureList'); +jest.dontMock('../../../components/feature/Feature'); -const React = require("react/addons"); +const React = require('react/addons'); const TestUtils = React.addons.TestUtils; -const FeatureList = require("../../../components/feature/FeatureList"); +const FeatureList = require('../../../components/feature/FeatureList'); -describe("FeatureList", () => { +describe('FeatureList', () => { let Component; let features; beforeEach(() => { features = [ - { name: "featureX", strategy: "other" }, - { name: "group.featureY", strategy: "default" } + { name: 'featureX', strategy: 'other' }, + { name: 'group.featureY', strategy: 'default' }, ]; const strategies=[ - { name: "default" } + { name: 'default' }, ]; Component = TestUtils .renderIntoDocument(); }); @@ -25,34 +25,34 @@ describe("FeatureList", () => { React.unmountComponentAtNode(document.body); }); - it("should render all features", () => { - const features = Component.getDOMNode().querySelectorAll(".feature"); + it('should render all features', () => { + const features = Component.getDOMNode().querySelectorAll('.feature'); expect(features.length).toEqual(2); }); - it("should filter list of features", () => { + it('should filter list of features', () => { const filterNode = Component.refs.filter.getDOMNode(); - TestUtils.Simulate.change(filterNode, { target: { value: "group" } }); + TestUtils.Simulate.change(filterNode, { target: { value: 'group' } }); - const features = Component.getDOMNode().querySelectorAll(".feature"); + const features = Component.getDOMNode().querySelectorAll('.feature'); expect(features.length).toEqual(1); }); - it("should filter list of features ignoring case", () => { + it('should filter list of features ignoring case', () => { const filterNode = Component.refs.filter.getDOMNode(); - TestUtils.Simulate.change(filterNode, { target: { value: "GROUP" } }); + TestUtils.Simulate.change(filterNode, { target: { value: 'GROUP' } }); - const features = Component.getDOMNode().querySelectorAll(".feature"); + const features = Component.getDOMNode().querySelectorAll('.feature'); expect(features.length).toEqual(1); - expect(features[0].textContent).toMatch("group"); + expect(features[0].textContent).toMatch('group'); }); - it("should filter list of features by strategy name", () => { - const searchString = "other"; + it('should filter list of features by strategy name', () => { + const searchString = 'other'; const filterNode = Component.refs.filter.getDOMNode(); TestUtils.Simulate.change(filterNode, { target: { value: searchString } }); - const features = Component.getDOMNode().querySelectorAll(".feature"); + const features = Component.getDOMNode().querySelectorAll('.feature'); expect(features.length).toEqual(1); expect(features[0].textContent).toMatch(searchString); }); diff --git a/packages/unleash-frontend/public/js/__tests__/stores/FeatureToggleStore-test.js b/packages/unleash-frontend/public/js/__tests__/stores/FeatureToggleStore-test.js index a0070b88fd..d7dd124e46 100644 --- a/packages/unleash-frontend/public/js/__tests__/stores/FeatureToggleStore-test.js +++ b/packages/unleash-frontend/public/js/__tests__/stores/FeatureToggleStore-test.js @@ -12,7 +12,7 @@ describe('FeatureToggleStore', () => { Actions = require('../../stores/FeatureToggleActions'); Store = require('../../stores/FeatureToggleStore'); toggles = [ - { name: "app.feature", enabled: true, strategy: "default" } + { name: 'app.feature', enabled: true, strategy: 'default' }, ]; }); @@ -25,19 +25,19 @@ describe('FeatureToggleStore', () => { jest.runAllTimers(); expect(Store.getFeatureToggles().length).toBe(1); - expect(Store.getFeatureToggles()[0].name).toEqual("app.feature"); + expect(Store.getFeatureToggles()[0].name).toEqual('app.feature'); }); it('should add a another toggle', () => { Actions.init.completed(toggles); - const newToggle = { name: "app.featureB", enabled: true, strategy: "default" }; + const newToggle = { name: 'app.featureB', enabled: true, strategy: 'default' }; Actions.create.completed(newToggle); jest.runAllTimers(); expect(Store.getFeatureToggles().length).toBe(2); - expect(Store.getFeatureToggles()[1].name).toEqual("app.featureB"); + expect(Store.getFeatureToggles()[1].name).toEqual('app.featureB'); }); it('should archive toggle', () => { @@ -51,17 +51,17 @@ describe('FeatureToggleStore', () => { it('should keep toggles in sorted order', () => { Actions.init.completed([ - { name: "A" }, - { name: "B" }, - { name: "C" } + { name: 'A' }, + { name: 'B' }, + { name: 'C' }, ]); - Actions.create.completed({ name: "AA" }); + Actions.create.completed({ name: 'AA' }); jest.runAllTimers(); - expect(Store.getFeatureToggles()[0].name).toEqual("A"); - expect(Store.getFeatureToggles()[1].name).toEqual("AA"); - expect(Store.getFeatureToggles()[3].name).toEqual("C"); + expect(Store.getFeatureToggles()[0].name).toEqual('A'); + expect(Store.getFeatureToggles()[1].name).toEqual('AA'); + expect(Store.getFeatureToggles()[3].name).toEqual('C'); }); it('should update toggle', () => { diff --git a/packages/unleash-frontend/public/js/components/ErrorMessages.jsx b/packages/unleash-frontend/public/js/components/ErrorMessages.jsx index ae84144742..742d873231 100644 --- a/packages/unleash-frontend/public/js/components/ErrorMessages.jsx +++ b/packages/unleash-frontend/public/js/components/ErrorMessages.jsx @@ -6,23 +6,23 @@ const ErrorActions = require('../stores/ErrorActions'); const ErrorMessages = React.createClass({ getInitialState() { - return { - errors: ErrorStore.getErrors() - }; + return { + errors: ErrorStore.getErrors(), + }; }, onStoreChange() { - this.setState({ - errors: ErrorStore.getErrors() - }); + this.setState({ + errors: ErrorStore.getErrors(), + }); }, componentDidMount() { - this.unsubscribe = ErrorStore.listen(this.onStoreChange); + this.unsubscribe = ErrorStore.listen(this.onStoreChange); }, componentWillUnmount() { - this.unsubscribe(); + this.unsubscribe(); }, onClearErrors() { @@ -33,7 +33,7 @@ const ErrorMessages = React.createClass({ return ( ); - } + }, }); module.exports = ErrorMessages; diff --git a/packages/unleash-frontend/public/js/components/ErrorMessages.ui.jsx b/packages/unleash-frontend/public/js/components/ErrorMessages.ui.jsx index 6d88e9f620..db4110fae1 100644 --- a/packages/unleash-frontend/public/js/components/ErrorMessages.ui.jsx +++ b/packages/unleash-frontend/public/js/components/ErrorMessages.ui.jsx @@ -29,7 +29,7 @@ const ErrorMessages = React.createClass({
); - } + }, }); module.exports = ErrorMessages; diff --git a/packages/unleash-frontend/public/js/components/Menu.jsx b/packages/unleash-frontend/public/js/components/Menu.jsx index 42a0a37157..60a748edeb 100644 --- a/packages/unleash-frontend/public/js/components/Menu.jsx +++ b/packages/unleash-frontend/public/js/components/Menu.jsx @@ -57,7 +57,7 @@ const Menu = React.createClass({ ); - } + }, }); module.exports = Menu; diff --git a/packages/unleash-frontend/public/js/components/User.jsx b/packages/unleash-frontend/public/js/components/User.jsx index 95e5421def..7486cf8671 100644 --- a/packages/unleash-frontend/public/js/components/User.jsx +++ b/packages/unleash-frontend/public/js/components/User.jsx @@ -4,13 +4,13 @@ const UserStore = require('../stores/UserStore'); const User = React.createClass({ - onSave() { - const value = this.refs.username.getDOMNode().value.trim(); - UserStore.set(value); - }, + onSave() { + const value = this.refs.username.getDOMNode().value.trim(); + UserStore.set(value); + }, - render() { - return ( + render() { + return (
); - } + }, }); module.exports = User; diff --git a/packages/unleash-frontend/public/js/components/feature/ArchiveFeatureComponent.jsx b/packages/unleash-frontend/public/js/components/feature/ArchiveFeatureComponent.jsx index 44cf6327ba..983218cd42 100644 --- a/packages/unleash-frontend/public/js/components/feature/ArchiveFeatureComponent.jsx +++ b/packages/unleash-frontend/public/js/components/feature/ArchiveFeatureComponent.jsx @@ -1,5 +1,5 @@ 'use strict'; -const React = require("react"); +const React = require('react'); const FeatureActions = require('../../stores/FeatureToggleActions'); const ArchiveFeatureComponent = React.createClass({ @@ -41,7 +41,7 @@ const ArchiveFeatureComponent = React.createClass({ ); - } + }, }); module.exports = ArchiveFeatureComponent; diff --git a/packages/unleash-frontend/public/js/components/feature/Feature.jsx b/packages/unleash-frontend/public/js/components/feature/Feature.jsx index 666f402b11..0cfb80266e 100644 --- a/packages/unleash-frontend/public/js/components/feature/Feature.jsx +++ b/packages/unleash-frontend/public/js/components/feature/Feature.jsx @@ -9,22 +9,22 @@ const Feature = React.createClass({ return { editMode: false, showHistory: false, - events: [] + events: [], }; }, handleEventsResponse(response) { - this.setState({events: response}); + this.setState({ events: response }); }, toggleHistory() { eventStore.getEventsByName(this.props.feature.name).then(this.handleEventsResponse); - this.setState({showHistory: !this.state.showHistory}); + this.setState({ showHistory: !this.state.showHistory }); }, toggleEditMode() { - this.setState({editMode: !this.state.editMode}); + this.setState({ editMode: !this.state.editMode }); }, saveFeature(feature) { @@ -51,16 +51,15 @@ const Feature = React.createClass({ ); - }, render() { return ( - + + {this.props.feature.enabled ? 'toggle-active' : 'toggle-inactive'} title="Status"> @@ -78,23 +77,23 @@ const Feature = React.createClass({
@@ -118,7 +117,7 @@ const Feature = React.createClass({ ); - } + }, }); diff --git a/packages/unleash-frontend/public/js/components/feature/FeatureForm.jsx b/packages/unleash-frontend/public/js/components/feature/FeatureForm.jsx index 924992395d..f9de996473 100644 --- a/packages/unleash-frontend/public/js/components/feature/FeatureForm.jsx +++ b/packages/unleash-frontend/public/js/components/feature/FeatureForm.jsx @@ -7,38 +7,38 @@ const FeatureForm = React.createClass({ return { strategyOptions: this.props.strategies, requiredParams: [], - currentStrategy: this.props.feature ? this.props.feature.strategy : "default" + currentStrategy: this.props.feature ? this.props.feature.strategy : 'default', }; }, componentWillMount() { - if(this.props.feature) { + if (this.props.feature) { this.setSelectedStrategy(this.props.feature.strategy); } }, onStrategyChange(e) { this.setSelectedStrategy(e.target.value); - this.setState({currentStrategy: e.target.value}); + this.setState({ currentStrategy: e.target.value }); }, getParameterValue(name) { - if(this.props.feature && this.props.feature.parameters) { + if (this.props.feature && this.props.feature.parameters) { return this.props.feature.parameters[name]; } else { - return ""; + return ''; } }, setSelectedStrategy(name) { const selectedStrategy = this.props.strategies.filter(strategy => strategy.name === name)[0]; - if(selectedStrategy) { + if (selectedStrategy) { this.setStrategyParams(selectedStrategy); } else { this.setState({ currentStrategy: 'default', - requiredParams: [] + requiredParams: [], }); } }, @@ -46,17 +46,17 @@ const FeatureForm = React.createClass({ setStrategyParams(strategy) { const requiredParams = []; let key; - for(key in strategy.parametersTemplate) { - requiredParams.push({name: key, value: this.getParameterValue(key)}); + for (key in strategy.parametersTemplate) { + requiredParams.push({ name: key, value: this.getParameterValue(key) }); } - this.setState({requiredParams}); + this.setState({ requiredParams }); }, render() { const feature = this.props.feature || { name: '', strategy: 'default', - enabled: false + enabled: false, }; const idPrefix = this.props.feature ? this.props.feature.name : 'new'; @@ -66,7 +66,7 @@ const FeatureForm = React.createClass({
- {this.props.feature ? "" : Create new toggle} + {this.props.feature ? '' : Create new toggle} regex.test(item.name) || regex.test(item.strategy)); - } else { return this.props.features; } - }, render() { @@ -50,8 +48,8 @@ const FeatureList = React.createClass({ />); return ( -
- +
+
@@ -78,7 +76,7 @@ const FeatureList = React.createClass({
); - } + }, }); module.exports = FeatureList; diff --git a/packages/unleash-frontend/public/js/components/feature/FeatureTogglesComponent.jsx b/packages/unleash-frontend/public/js/components/feature/FeatureTogglesComponent.jsx index 1ede49a054..08443686b8 100644 --- a/packages/unleash-frontend/public/js/components/feature/FeatureTogglesComponent.jsx +++ b/packages/unleash-frontend/public/js/components/feature/FeatureTogglesComponent.jsx @@ -8,12 +8,12 @@ const ErrorActions = require('../../stores/ErrorActions'); const FeatureTogglesComponent = React.createClass({ getInitialState() { return { - createView: false + createView: false, }; }, updateFeature(feature) { - FeatureActions.update.triggerPromise(feature); + FeatureActions.update.triggerPromise(feature); }, archiveFeature(feature) { @@ -26,11 +26,11 @@ const FeatureTogglesComponent = React.createClass({ }, newFeature() { - this.setState({createView: true}); + this.setState({ createView: true }); }, cancelNewFeature() { - this.setState({createView: false}); + this.setState({ createView: false }); ErrorActions.clear(); }, @@ -55,15 +55,15 @@ const FeatureTogglesComponent = React.createClass({ }, renderCreateView() { - return ; + strategies={this.props.strategies} />); }, renderCreateButton() { return ; - } + }, }); module.exports = FeatureTogglesComponent; diff --git a/packages/unleash-frontend/public/js/components/form/TextInput.jsx b/packages/unleash-frontend/public/js/components/form/TextInput.jsx index 35f3654a80..7682b7ef03 100644 --- a/packages/unleash-frontend/public/js/components/form/TextInput.jsx +++ b/packages/unleash-frontend/public/js/components/form/TextInput.jsx @@ -8,12 +8,12 @@ const TextInput = React.createClass({ id: React.PropTypes.string.isRequired, placeholder: React.PropTypes.string, value: React.PropTypes.string, - required: React.PropTypes.bool + required: React.PropTypes.bool, }, getDefaultProps() { return { - required: false + required: false, }; }, @@ -41,7 +41,7 @@ const TextInput = React.createClass({
); - } + }, }); -module.exports = TextInput; \ No newline at end of file +module.exports = TextInput; diff --git a/packages/unleash-frontend/public/js/components/log/LogEntriesComponent.jsx b/packages/unleash-frontend/public/js/components/log/LogEntriesComponent.jsx index cc743665d5..99be712e2a 100644 --- a/packages/unleash-frontend/public/js/components/log/LogEntriesComponent.jsx +++ b/packages/unleash-frontend/public/js/components/log/LogEntriesComponent.jsx @@ -8,18 +8,18 @@ const LogEntriesComponent = React.createClass({ getInitialState() { return { createView: false, - events: [] + events: [], }; }, componentDidMount() { eventStore.getEvents().then(res => { - this.setState({events: res.events}); + this.setState({ events: res.events }); }, this.initError); }, initError() { - ErrorActions.error("Could not load events from server"); + ErrorActions.error('Could not load events from server'); }, render() { diff --git a/packages/unleash-frontend/public/js/components/log/LogEntry.jsx b/packages/unleash-frontend/public/js/components/log/LogEntry.jsx index 0a3e73dbf3..7df458de5c 100644 --- a/packages/unleash-frontend/public/js/components/log/LogEntry.jsx +++ b/packages/unleash-frontend/public/js/components/log/LogEntry.jsx @@ -6,7 +6,7 @@ const DIFF_PREFIXES = { A: ' ', E: ' ', D: '-', - N: '+' + N: '+', }; const SPADEN_CLASS = { @@ -18,7 +18,7 @@ const SPADEN_CLASS = { const LogEntry = React.createClass({ propTypes: { - event: React.PropTypes.object.isRequired + event: React.PropTypes.object.isRequired, }, render() { @@ -33,7 +33,7 @@ const LogEntry = React.createClass({ {this.props.event.data.name}[{this.props.event.type}] - + {this.renderEventDiff()} {this.props.event.createdBy} @@ -48,14 +48,14 @@ const LogEntry = React.createClass({ const prettyPrinted = JSON.stringify(localEventData, null, 2); - return ({prettyPrinted}); + return ({prettyPrinted}); }, renderEventDiff() { if (!this.props.showFullEvents && this.props.event.diffs) { const changes = this.props.event.diffs.map(this.buildDiff); return ( - {changes.length === 0 ? '(no changes)' : changes} + {changes.length === 0 ? '(no changes)' : changes} ); } else { return this.renderFullEventData(); @@ -81,7 +81,7 @@ const LogEntry = React.createClass({ } return (
{change}
); - } + }, }); diff --git a/packages/unleash-frontend/public/js/components/log/LogEntryList.jsx b/packages/unleash-frontend/public/js/components/log/LogEntryList.jsx index a00a777ce8..5e83f15199 100644 --- a/packages/unleash-frontend/public/js/components/log/LogEntryList.jsx +++ b/packages/unleash-frontend/public/js/components/log/LogEntryList.jsx @@ -4,12 +4,12 @@ const LogEntry = require('./LogEntry'); const LogEntryList = React.createClass({ propTypes: { - events: React.PropTypes.array.isRequired + events: React.PropTypes.array.isRequired, }, getInitialState() { return { - showFullEvents: false + showFullEvents: false, }; }, @@ -28,7 +28,7 @@ const LogEntryList = React.createClass({ - +
@@ -48,8 +48,8 @@ const LogEntryList = React.createClass({ }, toggleFullEvents() { - this.setState({showFullEvents: !this.state.showFullEvents}); - } + this.setState({ showFullEvents: !this.state.showFullEvents }); + }, }); diff --git a/packages/unleash-frontend/public/js/components/strategy/StrategiesComponent.jsx b/packages/unleash-frontend/public/js/components/strategy/StrategiesComponent.jsx index be57b89481..52d8bff6d6 100644 --- a/packages/unleash-frontend/public/js/components/strategy/StrategiesComponent.jsx +++ b/packages/unleash-frontend/public/js/components/strategy/StrategiesComponent.jsx @@ -7,16 +7,16 @@ const StrategyActions = require('../../stores/StrategyActions'); const StrategiesComponent = React.createClass({ getInitialState() { return { - createView: false + createView: false, }; }, onNewStrategy() { - this.setState({createView: true}); + this.setState({ createView: true }); }, onCancelNewStrategy() { - this.setState({createView: false}); + this.setState({ createView: false }); }, onSave(strategy) { @@ -48,15 +48,15 @@ const StrategiesComponent = React.createClass({ onCancelNewStrategy={this.onCancelNewStrategy} onSave={this.onSave} />); - }, + }, - renderCreateButton() { - return ( + renderCreateButton() { + return ( ); - } - }); + }, +}); module.exports = StrategiesComponent; diff --git a/packages/unleash-frontend/public/js/components/strategy/Strategy.jsx b/packages/unleash-frontend/public/js/components/strategy/Strategy.jsx index 29091a53d3..277460e538 100644 --- a/packages/unleash-frontend/public/js/components/strategy/Strategy.jsx +++ b/packages/unleash-frontend/public/js/components/strategy/Strategy.jsx @@ -3,7 +3,7 @@ const React = require('react'); const Strategy = React.createClass({ propTypes: { - strategy: React.PropTypes.object.isRequired + strategy: React.PropTypes.object.isRequired, }, onRemove(event) { @@ -25,7 +25,7 @@ const Strategy = React.createClass({ ); - } + }, }); module.exports = Strategy; diff --git a/packages/unleash-frontend/public/js/components/strategy/StrategyForm.jsx b/packages/unleash-frontend/public/js/components/strategy/StrategyForm.jsx index 493427850b..0d67de27f0 100644 --- a/packages/unleash-frontend/public/js/components/strategy/StrategyForm.jsx +++ b/packages/unleash-frontend/public/js/components/strategy/StrategyForm.jsx @@ -6,13 +6,13 @@ const StrategyForm = React.createClass({ getDefaultProps() { return { - maxParams: 4 + maxParams: 4, }; }, getInitialState() { return { - parameters: [] + parameters: [], }; }, @@ -27,9 +27,9 @@ const StrategyForm = React.createClass({ const that = this; this.state.parameters.forEach(parameter => { - const name = that.refs[parameter.name].getDOMNode().value.trim(); - if(name) { - strategy.parametersTemplate[name] = "string"; + const name = that.refs[parameter.name].getDOMNode().value.trim(); + if (name) { + strategy.parametersTemplate[name] = 'string'; } }); @@ -45,15 +45,15 @@ const StrategyForm = React.createClass({ onAddParam(event) { event.preventDefault(); const id = this.state.parameters.length + 1; - const params = this.state.parameters.concat([{id, name: `param_${id}`, label: `Parameter ${id}`}]); - this.setState({parameters: params}); + const params = this.state.parameters.concat([{ id, name: `param_${id}`, label: `Parameter ${id}` }]); + this.setState({ parameters: params }); }, onRemoveParam(event) { event.preventDefault(); const params = this.state.parameters.slice(0, -1); - this.setState({parameters: params}); + this.setState({ parameters: params }); }, render() { @@ -119,12 +119,12 @@ const StrategyForm = React.createClass({ }, renderAddLink() { - if(this.state.parameters.length < this.props.maxParams) { + if (this.state.parameters.length < this.props.maxParams) { return + Add required parameter; } }, renderRemoveLink() { - if(this.state.parameters.length > 0) { + if (this.state.parameters.length > 0) { return (
); } - } + }, }); module.exports = StrategyForm; diff --git a/packages/unleash-frontend/public/js/components/strategy/StrategyList.jsx b/packages/unleash-frontend/public/js/components/strategy/StrategyList.jsx index 6588e91106..ca896c9e0b 100644 --- a/packages/unleash-frontend/public/js/components/strategy/StrategyList.jsx +++ b/packages/unleash-frontend/public/js/components/strategy/StrategyList.jsx @@ -4,7 +4,7 @@ const Strategy = require('./Strategy'); const StrategyList = React.createClass({ propTypes: { - strategies: React.PropTypes.array.isRequired + strategies: React.PropTypes.array.isRequired, }, render() { @@ -12,7 +12,7 @@ const StrategyList = React.createClass({ return (
{strategyNodes}
); - } + }, }); -module.exports = StrategyList; \ No newline at end of file +module.exports = StrategyList; diff --git a/packages/unleash-frontend/public/js/stores/ArchivedToggleStore.js b/packages/unleash-frontend/public/js/stores/ArchivedToggleStore.js index eef1984442..696c10535a 100644 --- a/packages/unleash-frontend/public/js/stores/ArchivedToggleStore.js +++ b/packages/unleash-frontend/public/js/stores/ArchivedToggleStore.js @@ -40,7 +40,7 @@ const FeatureStore = Reflux.createStore({ initStore(archivedToggles) { _archivedToggles = archivedToggles; - } + }, }); module.exports = FeatureStore; diff --git a/packages/unleash-frontend/public/js/stores/ErrorActions.js b/packages/unleash-frontend/public/js/stores/ErrorActions.js index 411dff9618..ef03a146a6 100644 --- a/packages/unleash-frontend/public/js/stores/ErrorActions.js +++ b/packages/unleash-frontend/public/js/stores/ErrorActions.js @@ -2,8 +2,8 @@ const Reflux = require('reflux'); const ErrorActions = Reflux.createActions([ - "clear", - "error" + 'clear', + 'error', ]); module.exports = ErrorActions; diff --git a/packages/unleash-frontend/public/js/stores/ErrorStore.js b/packages/unleash-frontend/public/js/stores/ErrorStore.js index 840579fdb4..90188aa88a 100644 --- a/packages/unleash-frontend/public/js/stores/ErrorStore.js +++ b/packages/unleash-frontend/public/js/stores/ErrorStore.js @@ -24,7 +24,7 @@ const FeatureStore = Reflux.createStore({ this.addError(e.msg); }); } else if (error.status === 0) { - this.addError("server unreachable"); + this.addError('server unreachable'); } else { this.addError(error); } @@ -52,7 +52,7 @@ const FeatureStore = Reflux.createStore({ } catch (e) { if (e instanceof SyntaxError) { // fall through; - console.log("Syntax error!"); + console.log('Syntax error!'); } else { throw e; } @@ -63,7 +63,7 @@ const FeatureStore = Reflux.createStore({ getErrors() { return this.errors; - } + }, }); module.exports = FeatureStore; diff --git a/packages/unleash-frontend/public/js/stores/EventStore.js b/packages/unleash-frontend/public/js/stores/EventStore.js index f683402ac1..4f38a2769e 100644 --- a/packages/unleash-frontend/public/js/stores/EventStore.js +++ b/packages/unleash-frontend/public/js/stores/EventStore.js @@ -8,7 +8,7 @@ const EventStore = { return reqwest({ url: 'events', method: 'get', - type: TYPE + type: TYPE, }); }, @@ -16,9 +16,9 @@ const EventStore = { return reqwest({ url: `events/${name}`, method: 'get', - type: TYPE + type: TYPE, }); - } + }, }; diff --git a/packages/unleash-frontend/public/js/stores/FeatureToggleActions.js b/packages/unleash-frontend/public/js/stores/FeatureToggleActions.js index faf885d062..8f2ed25f90 100644 --- a/packages/unleash-frontend/public/js/stores/FeatureToggleActions.js +++ b/packages/unleash-frontend/public/js/stores/FeatureToggleActions.js @@ -1,5 +1,5 @@ 'use strict'; -const Reflux = require("reflux"); +const Reflux = require('reflux'); const Server = require('./FeatureToggleServerFacade'); const FeatureToggleActions = Reflux.createActions({ @@ -8,7 +8,7 @@ const FeatureToggleActions = Reflux.createActions({ create: { asyncResult: true }, update: { asyncResult: true }, archive: { asyncResult: true }, - revive: { asyncResult: true } + revive: { asyncResult: true }, }); FeatureToggleActions.init.listen(function() { diff --git a/packages/unleash-frontend/public/js/stores/FeatureToggleServerFacade.js b/packages/unleash-frontend/public/js/stores/FeatureToggleServerFacade.js index 7e4028dffb..866998e754 100644 --- a/packages/unleash-frontend/public/js/stores/FeatureToggleServerFacade.js +++ b/packages/unleash-frontend/public/js/stores/FeatureToggleServerFacade.js @@ -17,7 +17,7 @@ const FeatureToggleServerFacade = { }, success() { cb(); - } + }, }); }, @@ -33,7 +33,7 @@ const FeatureToggleServerFacade = { }, success() { cb(); - } + }, }); }, @@ -47,7 +47,7 @@ const FeatureToggleServerFacade = { }, success() { cb(); - } + }, }); }, @@ -61,7 +61,7 @@ const FeatureToggleServerFacade = { }, success(data) { cb(null, data.features); - } + }, }); }, @@ -75,7 +75,7 @@ const FeatureToggleServerFacade = { }, success(data) { cb(null, data.features); - } + }, }); }, @@ -91,9 +91,9 @@ const FeatureToggleServerFacade = { }, success() { cb(); - } + }, }); - } + }, }; module.exports = FeatureToggleServerFacade; diff --git a/packages/unleash-frontend/public/js/stores/FeatureToggleStore.js b/packages/unleash-frontend/public/js/stores/FeatureToggleStore.js index a9624d3616..8a9e5aec2b 100644 --- a/packages/unleash-frontend/public/js/stores/FeatureToggleStore.js +++ b/packages/unleash-frontend/public/js/stores/FeatureToggleStore.js @@ -50,7 +50,7 @@ const FeatureStore = Reflux.createStore({ initStore(toggles) { _featureToggles = toggles; - } + }, }); module.exports = FeatureStore; diff --git a/packages/unleash-frontend/public/js/stores/StrategyAPI.js b/packages/unleash-frontend/public/js/stores/StrategyAPI.js index b6a7eb1829..6e255cd1dd 100644 --- a/packages/unleash-frontend/public/js/stores/StrategyAPI.js +++ b/packages/unleash-frontend/public/js/stores/StrategyAPI.js @@ -17,7 +17,7 @@ const StrategyAPI = { }, success() { cb(null, strategy); - } + }, }); }, @@ -31,7 +31,7 @@ const StrategyAPI = { }, success() { cb(null, strategy); - } + }, }); }, @@ -45,9 +45,9 @@ const StrategyAPI = { }, success(data) { cb(null, data.strategies); - } + }, }); - } + }, }; module.exports = StrategyAPI; diff --git a/packages/unleash-frontend/public/js/stores/StrategyActions.js b/packages/unleash-frontend/public/js/stores/StrategyActions.js index a1382a8983..4944fc9482 100644 --- a/packages/unleash-frontend/public/js/stores/StrategyActions.js +++ b/packages/unleash-frontend/public/js/stores/StrategyActions.js @@ -1,5 +1,5 @@ 'use strict'; -const Reflux = require("reflux"); +const Reflux = require('reflux'); const StrategyAPI = require('./StrategyAPI'); const StrategyActions = Reflux.createActions({ diff --git a/packages/unleash-frontend/public/js/stores/StrategyStore.js b/packages/unleash-frontend/public/js/stores/StrategyStore.js index afa452f754..e3b0b6a37b 100644 --- a/packages/unleash-frontend/public/js/stores/StrategyStore.js +++ b/packages/unleash-frontend/public/js/stores/StrategyStore.js @@ -35,7 +35,7 @@ const StrategyStore = Reflux.createStore({ initStore(strategies) { _strategies = strategies; - } + }, }); module.exports = StrategyStore; diff --git a/packages/unleash-frontend/public/js/stores/UserStore.js b/packages/unleash-frontend/public/js/stores/UserStore.js index d325b57b06..39bdac8942 100644 --- a/packages/unleash-frontend/public/js/stores/UserStore.js +++ b/packages/unleash-frontend/public/js/stores/UserStore.js @@ -19,7 +19,7 @@ function readCookie(name) { const UserStore = { init() { - _username = readCookie("username"); + _username = readCookie('username'); }, set(username) { @@ -29,7 +29,7 @@ const UserStore = { get() { return _username; - } + }, }; module.exports = UserStore; diff --git a/packages/unleash-frontend/public/js/utils/Timer.js b/packages/unleash-frontend/public/js/utils/Timer.js index 39291463bc..84fc779037 100644 --- a/packages/unleash-frontend/public/js/utils/Timer.js +++ b/packages/unleash-frontend/public/js/utils/Timer.js @@ -7,7 +7,7 @@ const Timer = function(cb, interval) { Timer.prototype.start = function() { if (this.timerId != null) { - console.warn("timer already started"); + console.warn('timer already started'); } console.log('starting timer'); diff --git a/packages/unleash-frontend/webpack.config.js b/packages/unleash-frontend/webpack.config.js index a5097fc67e..586c685275 100644 --- a/packages/unleash-frontend/webpack.config.js +++ b/packages/unleash-frontend/webpack.config.js @@ -14,25 +14,25 @@ module.exports = { output: { path: jsroot, filename: 'bundle.js', - publicPath: '/js/' + publicPath: '/js/', }, resolve: { root: [jsroot], extensions: ['', '.js', '.jsx'], - modulesDirectories: ["web_modules", "node_modules"] + modulesDirectories: ['web_modules', 'node_modules'], }, module: { loaders: [ - { test: /\.jsx$/, loader: 'jsx?harmony' } - ] + { test: /\.jsx$/, loader: 'jsx?harmony' }, + ], }, - devtool: "source-map", + devtool: 'source-map', externals: { // stuff not in node_modules can be resolved here. - } + }, };
When