Skip to content

Commit

Permalink
Merge pull request #8 from idcc-dev/fr_linting_curly_rule
Browse files Browse the repository at this point in the history
Updated linting rules
  • Loading branch information
dilallkx committed May 16, 2019
2 parents 2cfd726 + 72fa7a6 commit 1eaddce
Show file tree
Hide file tree
Showing 34 changed files with 280 additions and 260 deletions.
2 changes: 1 addition & 1 deletion .meepctl-repocfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repo:
src: js-apps/meep-frontend
bin: bin/meep-frontend
codecov: false
lint: false
lint: true
local-deps:
meep-ctrl-engine-api: js-packages/meep-ctrl-engine-client
meep-webhook:
Expand Down
4 changes: 0 additions & 4 deletions go-apps/meepctl/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,3 @@ go build -o ./$IMAGE_NAME .
# Install
echo "...install"
go install

# Re-generate the doc
echo "...updating meepctl doc"
meepctl genmd
28 changes: 20 additions & 8 deletions js-apps/meep-frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ module.exports = {
'react'
],
"settings": {
"react": {
"createClass": "createReactClass", // Regex for Component Factory to use,
// default to "createReactClass"
"pragma": "React", // Pragma to use, default to "React"
"version": "15.0", // React version, default to the latest React stable release
"flowVersion": "0.53" // Flow version
},
"propWrapperFunctions": [
"react": {
"createClass": "createReactClass", // Regex for Component Factory to use,
// default to "createReactClass"
"pragma": "React", // Pragma to use, default to "React"
"version": "15.0", // React version, default to the latest React stable release
"flowVersion": "0.53" // Flow version
},
"propWrapperFunctions": [
// The names of any function used to wrap propTypes, e.g. `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped.
"forbidExtraProps",
{"property": "freeze", "object": "Object"},
Expand All @@ -42,6 +42,18 @@ module.exports = {
'error',
'unix'
],
'curly': [
"error",
"all"
],
'comma-dangle': [
"error",
"never"
],
'eqeqeq': [
"error",
"always"
],
'quotes': [
'error',
'single'
Expand Down
1 change: 1 addition & 0 deletions js-apps/meep-frontend/src/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

# Ignore built files except build/index.js
dist/*

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class IDDeployScenarioDialog extends Component {
}

onDeployScenario() {
if (this.state.selectedScenario == '') {
if (this.state.selectedScenario === '') {
// console.log('Invalid scenario name');
// TODO: consider showing an alert
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class IDExportScenarioDialog extends Component {

exportScenario() {

if (this.state.filename == '') {
if (this.state.filename === '') {
// console.log('Invalid file name provided');
// TODO: consider showing an alert
return;
Expand Down Expand Up @@ -70,7 +70,7 @@ class IDExportScenarioDialog extends Component {
onChange={
(e) => {
const val = e.target.value;
const err = (!val && val !=null)
const err = (!val && val !== null)
? 'Please enter a filename'
: '';
this.setState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class IDNewScenarioDialog extends Component {
*/
getScenarioNewCb(error/*, data, response*/) {

if (error == null) {
if (error === null) {
// TODO: consider showing an alert
return;
}

// Validate scenario name
if (this.state.scenarioName == '' || this.state.err != null) {
if (this.state.scenarioName === '' || this.state.err !== null) {
// TODO: consider showing an alert
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class IDSaveScenarioDialog extends Component {
err = 'Lowercase alphanumeric or \'-\'';
}
} else {
err = 'Please enter a scenario name'
err = 'Please enter a scenario name';
}

this.setState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
PREFIX_INT_EDGE,
PREFIX_INT_FOG,
PREFIX_EDGE_FOG,
PREFIX_TERM_LINK,
PREFIX_TERM_LINK

} from '../../meep-constants';

Expand All @@ -82,13 +82,12 @@ const validateLatency = (val) => {
return 'Value is required';
}
if (val) {
if (isNaN(val)) return 'Latency value should be a number';
if ((val != '') && val < MIN_LATENCY_VALUE || val > MAX_LATENCY_VALUE) {
if (isNaN(val)) {return 'Latency value should be a number';}
if ((val !== '') && val < MIN_LATENCY_VALUE || val > MAX_LATENCY_VALUE) {
return `Out of range (${MIN_LATENCY_VALUE}-${MAX_LATENCY_VALUE})`;
}
if (!isInt(val)) {
return 'Latency value should be an integer';
}
if (!isInt(val)) {return 'Latency value should be an integer';}

}
return null;
};
Expand All @@ -98,8 +97,8 @@ const validateLatencyVariation = (val) => {
return 'Value is required';
}
if (val) {
if (isNaN(val)) return 'Latency variation should be a number';
if ((val != '') && val < MIN_LATENCY_VARIATION_VALUE || val > MAX_LATENCY_VARIATION_VALUE) {
if (isNaN(val)) {return 'Latency variation should be a number';}
if ((val !== '') && val < MIN_LATENCY_VARIATION_VALUE || val > MAX_LATENCY_VARIATION_VALUE) {
return `Out of range (${MIN_LATENCY_VARIATION_VALUE}-${MAX_LATENCY_VARIATION_VALUE})`;
}
if (!isInt(val)) {
Expand All @@ -114,8 +113,8 @@ const validatePacketLoss = (val) => {
return 'Value is required';
}
if (val && val !== '0') {
if (isNaN(val)) return 'Packet loss value should be a number';
if ((val != '') && val < MIN_PACKET_LOSS_VALUE || val > MAX_PACKET_LOSS_VALUE) {
if (isNaN(val)) {return 'Packet loss value should be a number';}
if ((val !== '') && val < MIN_PACKET_LOSS_VALUE || val > MAX_PACKET_LOSS_VALUE) {
return `Out of range (${MIN_PACKET_LOSS_VALUE}-${MAX_PACKET_LOSS_VALUE})`;
}
if (!Number(val) || val[val.length-1] === '.') {
Expand All @@ -133,8 +132,8 @@ const validateThroughput = (val) => {
return 'Value is required';
}
if (val) {
if (isNaN(val)) return 'Throughput value should be a number';
if ((val != '') && val < MIN_THROUGHPUT_VALUE || val > MAX_THROUGHPUT_VALUE) {
if (isNaN(val)) {return 'Throughput value should be a number';}
if ((val !== '') && val < MIN_THROUGHPUT_VALUE || val > MAX_THROUGHPUT_VALUE) {
return `Out of range (${MIN_THROUGHPUT_VALUE}-${MAX_THROUGHPUT_VALUE})`;
}
}
Expand Down
7 changes: 7 additions & 0 deletions js-apps/meep-frontend/src/js/components/meep-top-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const CorePodsLed = (props) => {
const MeepTopBar = (props) => {
/*eslint-disable */
const logo = require('../../img/ID-Icon-01-idcc.svg');
const advantEdge = require('../../img/AdvantEDGE-logo-NoTagline_White_RGB.png');
/*eslint-enable */
return (
<Toolbar>
Expand All @@ -67,6 +68,12 @@ const MeepTopBar = (props) => {
alt=""
onClick={() => {props.toggleMainDrawer();}}
/>
<img
id='AdvantEdgeLogo'
height={50}
src={advantEdge}
alt=''
/>
<ToolbarTitle><span style={titleStyle}>{props.title}</span></ToolbarTitle>
</ToolbarSection>
<ToolbarSection alignEnd>
Expand Down
Loading

0 comments on commit 1eaddce

Please sign in to comment.