1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00

Fix linting errors (#145)

* Use pretty (svg) badges

* Fix build
This commit is contained in:
Simen Bekkhus 2016-08-22 15:12:05 +02:00 committed by Ivar Conradi Østhus
parent ad3df75348
commit fb767f2b4a
15 changed files with 52 additions and 47 deletions

View File

@ -2,7 +2,11 @@
__Warning: We are in the process of splitting up unleash into multiple packages in this repository, if you want to test the previous package see [previous tag](https://github.com/finn-no/unleash/tree/v1.0.0-alpha.2) __
[![Build Status](https://travis-ci.org/finn-no/unleash.svg?branch=master)](https://travis-ci.org/finn-no/unleash) [![Code Climate](https://codeclimate.com/github/finn-no/unleash/badges/gpa.svg)](https://codeclimate.com/github/finn-no/unleash) [![Coverage Status](https://coveralls.io/repos/finn-no/unleash/badge.png?branch=master)](https://coveralls.io/r/finn-no/unleash?branch=master) [![Dependency Status](https://david-dm.org/finn-no/unleash.png)](https://david-dm.org/finn-no/unleash) [![devDependency Status](https://david-dm.org/finn-no/unleash/dev-status.png)](https://david-dm.org/finn-no/unleash#info=devD)
[![Build Status](https://travis-ci.org/finn-no/unleash.svg?branch=master)](https://travis-ci.org/finn-no/unleash)
[![Code Climate](https://codeclimate.com/github/finn-no/unleash/badges/gpa.svg)](https://codeclimate.com/github/finn-no/unleash)
[![Coverage Status](https://coveralls.io/repos/finn-no/unleash/badge.svg?branch=master)](https://coveralls.io/r/finn-no/unleash?branch=master)
[![Dependency Status](https://david-dm.org/finn-no/unleash.svg)](https://david-dm.org/finn-no/unleash)
[![devDependency Status](https://david-dm.org/finn-no/unleash/dev-status.svg)](https://david-dm.org/finn-no/unleash#info=devD)
![Admin UI](https://cloud.githubusercontent.com/assets/572/5873775/3ddc1a66-a2fa-11e4-923c-0a9569605dad.png)

View File

@ -18,10 +18,11 @@
"engines": {
"node": "6"
},
"license": "Apache-2.0",
"scripts": {
"bootstrap": "lerna bootstrap",
"prepublish": "npm run bootstrap",
"lint": "node node_modules/eslint/bin/eslint.js packages --fix --ignore-pattern=node_modules --ext=js,jsx",
"lint": "eslint . --ext=js,jsx",
"test": "npm run lint && lerna --concurrency=1 exec npm run test",
"test:ci": "npm run lint && lerna --concurrency=1 exec npm run test:ci",
"nsp": "lerna exec nsp check",
@ -33,8 +34,8 @@
},
"dependencies": {},
"devDependencies": {
"eslint": "^2.12.0",
"eslint-config-finn": "^1.0.0-alpha.4",
"eslint": "^2.13.1",
"eslint-config-finn": "1.0.0-alpha.8",
"eslint-plugin-react": "^4.3.0",
"lerna": "2.0.0-beta.20",
"nsp": "^2.3.2"

View File

@ -1,9 +1,9 @@
'use strict';
const Promise = require('bluebird');
const BPromise = require('bluebird');
const ValidationError = require('./ValidationError');
function validateRequest (req) {
return new Promise((resolve, reject) => {
return new BPromise((resolve, reject) => {
if (req.validationErrors()) {
reject(new ValidationError('Invalid syntax'));
} else {

View File

@ -1,5 +1,5 @@
'use strict';
const Promise = require('bluebird');
const BPromise = require('bluebird');
const logger = require('../logger');
const eventType = require('../eventType');
const NameExistsError = require('../error/NameExistsError');
@ -107,7 +107,7 @@ module.exports = function (app, config) {
});
function validateUniqueName (req) {
return new Promise((resolve, reject) => {
return new BPromise((resolve, reject) => {
featureDb.getFeature(req.body.name)
.then(() => {
reject(new NameExistsError('Feature name already exist'));

View File

@ -1,5 +1,5 @@
'use strict';
const Promise = require('bluebird');
const BPromise = require('bluebird');
const eventType = require('../eventType');
const logger = require('../logger');
const NameExistsError = require('../error/NameExistsError');
@ -78,7 +78,7 @@ module.exports = function (app, config) {
});
function validateStrategyName (req) {
return new Promise((resolve, reject) => {
return new BPromise((resolve, reject) => {
strategyDb.getStrategy(req.body.name)
.then(() => {
reject(new NameExistsError('Feature name already exist'));

View File

@ -16,17 +16,17 @@ describe('eventDiffer', () => {
});
it('diffs a feature-update event', () => {
const name = 'foo';
const feature = 'foo';
const desc = 'bar';
const events = [
{
type: eventType.featureUpdated,
data: { name, description: desc, strategy: 'default', enabled: true, parameters: { value: 2 } },
data: { name: feature, 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: feature, description: desc, strategy: 'default', enabled: false, parameters: { value: 1 } },
},
];

View File

@ -1,7 +1,7 @@
'use strict';
process.env.NODE_ENV = 'test';
const Promise = require('bluebird');
const BPromise = require('bluebird');
let request = require('supertest');
const databaseUri = require('./databaseConfig').getDatabaseUri();
const knex = require('../lib/db/dbPool')(databaseUri);
@ -20,11 +20,11 @@ const app = require('../app')({
strategyDb,
});
Promise.promisifyAll(request);
BPromise.promisifyAll(request);
request = request(app);
function createStrategies () {
return Promise.map([
return BPromise.map([
{
name: 'default',
description: 'Default on or off Strategy.',
@ -41,7 +41,7 @@ function createStrategies () {
}
function createFeatures () {
return Promise.map([
return BPromise.map([
{
name: 'featureX',
description: 'the #1 feature',
@ -105,11 +105,11 @@ function destroyFeatures () {
}
function resetDatabase () {
return Promise.all([destroyStrategies(), destroyFeatures()]);
return BPromise.all([destroyStrategies(), destroyFeatures()]);
}
function setupDatabase () {
return Promise.all([createStrategies(), createFeatures()]);
return BPromise.all([createStrategies(), createFeatures()]);
}
module.exports = {

View File

@ -17,8 +17,8 @@ describe('FeatureForm', () => {
describe('new', () => {
it('should render empty form', () => {
Component = TestUtils .renderIntoDocument(<FeatureForm strategies={strategies} />);
const name = Component.getDOMNode().querySelectorAll('input');
expect(name[0].value).toEqual('');
const value = Component.getDOMNode().querySelectorAll('input');
expect(value[0].value).toEqual('');
});
});

View File

@ -22,15 +22,15 @@ const FeatureForm = React.createClass({
this.setState({ currentStrategy: e.target.value });
},
getParameterValue (name) {
getParameterValue (feature) {
if (this.props.feature && this.props.feature.parameters) {
return this.props.feature.parameters[name];
return this.props.feature.parameters[feature];
}
return '';
},
setSelectedStrategy (name) {
const selectedStrategy = this.props.strategies.filter(strategy => strategy.name === name)[0];
setSelectedStrategy (strategyName) {
const selectedStrategy = this.props.strategies.filter(strategy => strategy.name === strategyName)[0];
if (selectedStrategy) {
this.setStrategyParams(selectedStrategy);

View File

@ -14,8 +14,8 @@ const LogEntryList = React.createClass({
},
render () {
const logEntryNodes = this.props.events.map(event =>
<LogEntry event={event} key={event.id} showFullEvents={this.state.showFullEvents} />);
const logEntryNodes = this.props.events.map(evt =>
<LogEntry event={evt} key={evt.id} showFullEvents={this.state.showFullEvents} />);
return (
<div>

View File

@ -6,8 +6,8 @@ const Strategy = React.createClass({
strategy: React.PropTypes.object.isRequired,
},
onRemove (event) {
event.preventDefault();
onRemove (evt) {
evt.preventDefault();
if (window.confirm(`Are you sure you want to delete strategy '${this.props.strategy.name}'?`)) { // eslint-disable-line no-alert
this.props.onRemove(this.props.strategy);
}

View File

@ -16,8 +16,8 @@ const StrategyForm = React.createClass({
};
},
onSubmit (event) {
event.preventDefault();
onSubmit (evt) {
evt.preventDefault();
const strategy = {};
strategy.name = this.refs.name.getValue();
@ -25,30 +25,30 @@ const StrategyForm = React.createClass({
strategy.parametersTemplate = {};
this.state.parameters.forEach(parameter => {
const name = this.refs[parameter.name].getDOMNode().value.trim();
if (name) {
strategy.parametersTemplate[name] = 'string';
const value = this.refs[parameter.name].getDOMNode().value.trim();
if (value) {
strategy.parametersTemplate[value] = 'string';
}
});
this.props.onSave(strategy);
},
onCancel (event) {
event.preventDefault();
onCancel (evt) {
evt.preventDefault();
this.props.onCancelNewStrategy();
},
onAddParam (event) {
event.preventDefault();
onAddParam (evt) {
evt.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 });
},
onRemoveParam (event) {
event.preventDefault();
onRemoveParam (evt) {
evt.preventDefault();
const params = this.state.parameters.slice(0, -1);
this.setState({ parameters: params });

View File

@ -12,9 +12,9 @@ const EventStore = {
});
},
getEventsByName (name) {
getEventsByName (eventName) {
return reqwest({
url: `events/${name}`,
url: `events/${eventName}`,
method: 'get',
type: TYPE,
});

View File

@ -2,8 +2,8 @@
let _username;
// Ref: http://stackoverflow.com/questions/10730362/get-cookie-by-name
function readCookie (name) {
const nameEQ = `${name}=`;
function readCookie (cookieName) {
const nameEQ = `${cookieName}=`;
const ca = document.cookie.split(';');
for (let i = 0;i < ca.length;i++) {
let c = ca[i];

View File

@ -3,8 +3,8 @@
'use strict';
const path = require('path');
const root = path.normalize(path.join(__dirname, '.'));
const jsroot = path.join(root, 'public', 'js');
const publicRoot = path.join(__dirname, 'public');
const jsroot = path.join(publicRoot, 'js');
module.exports = {
@ -12,7 +12,7 @@ module.exports = {
entry: './app.jsx',
output: {
path: path.join(root, 'public'),
path: publicRoot,
filename: 'bundle.js',
publicPath: '/js/',
},