mirror of https://github.com/status-im/consul.git
ui: Move linting to the `node:test` script (#9385)
* Reconfigure linting to be a node-test * Fixup linting across the project
This commit is contained in:
parent
1952b29931
commit
54ab9249dc
|
@ -1,6 +1,7 @@
|
|||
app/utils/dom/event-target/event-target-shim/event.js
|
||||
# unconventional js
|
||||
/blueprints/*/files/
|
||||
/blueprints/*/*-files/
|
||||
/vendor/
|
||||
|
||||
# compiled output
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-env node */
|
||||
module.exports = {
|
||||
"stories": [
|
||||
"../app/**/*.stories.mdx"
|
||||
|
|
|
@ -4,6 +4,7 @@ module.exports = {
|
|||
extends: 'octane',
|
||||
rules: {
|
||||
'no-partial': false,
|
||||
'table-groups': false,
|
||||
|
||||
'no-invalid-interactive': false,
|
||||
'simple-unless': false,
|
||||
|
|
|
@ -69,10 +69,10 @@ test-parallel: deps
|
|||
yarn run test:parallel
|
||||
|
||||
lint: deps
|
||||
yarn run lint:hbs && yarn run lint:js
|
||||
yarn run lint
|
||||
|
||||
format: deps
|
||||
yarn run format:js
|
||||
yarn run format
|
||||
|
||||
steps:
|
||||
yarn run steps:list
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Component from '@ember/component';
|
||||
import { get, set, computed } from '@ember/object';
|
||||
import { alias, sort } from '@ember/object/computed';
|
||||
import { alias } from '@ember/object/computed';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
import { task } from 'ember-concurrency';
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import Component from '@ember/component';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { set, get, computed } from '@ember/object';
|
||||
import { schedule } from '@ember/runloop';
|
||||
|
||||
import { createRoute, getSplitters, getRoutes, getResolvers } from './utils';
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ import Component from '@glimmer/component';
|
|||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { sort } from '@ember/object/computed';
|
||||
|
||||
export default class ConsulIntentionList extends Component {
|
||||
@service('repository/intention') repo;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import Component from '@glimmer/component';
|
||||
import { action } from '@ember/object';
|
||||
|
||||
export default class ConsulNspaceList extends Component {
|
||||
isLinkable(item) {
|
||||
|
|
|
@ -23,7 +23,7 @@ export default class TomographyGraph extends Component {
|
|||
}
|
||||
|
||||
get distances() {
|
||||
const distances = this.args.distances || [];
|
||||
let distances = this.args.distances || [];
|
||||
const max = distances.reduce((prev, d) => Math.max(prev, d.distance), this.max);
|
||||
const len = distances.length;
|
||||
if (len > 360) {
|
||||
|
|
|
@ -27,7 +27,7 @@ export default class DataCollectionComponent extends Component {
|
|||
return this.items;
|
||||
}
|
||||
|
||||
@computed('args.items', 'args.items.content')
|
||||
@computed('args{items,.items.content}')
|
||||
get content() {
|
||||
// TODO: Temporary little hack to ensure we detect DataSource proxy
|
||||
// objects but not any other special Ember Proxy object like ember-data
|
||||
|
@ -53,7 +53,7 @@ export default class DataCollectionComponent extends Component {
|
|||
|
||||
@computed('type', 'filtered', 'args.filters.searchproperties', 'searchTerm')
|
||||
get searched() {
|
||||
if (typeof this.searchTerm === '') {
|
||||
if (this.searchTerm === '') {
|
||||
return this.filtered;
|
||||
}
|
||||
const predicate = this.searchService.predicate(this.type);
|
||||
|
|
|
@ -37,13 +37,8 @@ export default Component.extend(Slotted, {
|
|||
} else {
|
||||
name = prop;
|
||||
}
|
||||
const form = this.form;
|
||||
try {
|
||||
form.handleEvent(event, name);
|
||||
this.onchange({ target: this });
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
this.form.handleEvent(event, name);
|
||||
this.onchange({ target: this });
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,7 +7,6 @@ import Slotted from 'block-slots';
|
|||
const formatItemStyle = PercentageColumns.prototype.formatItemStyle;
|
||||
|
||||
export default Component.extend(Slotted, {
|
||||
tagName: '',
|
||||
dom: service('dom'),
|
||||
tagName: '',
|
||||
height: 500,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
<button
|
||||
{{on 'click' (fn (optional this.popoverController.hide))}}
|
||||
class="cancel"
|
||||
type="button"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
|
@ -67,6 +68,7 @@
|
|||
<button
|
||||
{{on 'click' (fn (optional this.popoverController.hide))}}
|
||||
class="cancel"
|
||||
type="button"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import setHelpers from 'mnemonist/set';
|
||||
|
||||
export default {
|
||||
kinds: {
|
||||
'global-management': (item, value) => item.isGlobalManagement,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Model, { attr } from '@ember-data/model';
|
||||
import { attr } from '@ember-data/model';
|
||||
import ServiceInstanceModel from './service-instance';
|
||||
|
||||
export const PRIMARY_KEY = 'uid';
|
||||
|
|
|
@ -41,7 +41,7 @@ export default class ServiceInstance extends Model {
|
|||
@alias('Service.Service') Name;
|
||||
|
||||
// If the ID is blank fallback to the Service.Service (the Name)
|
||||
@or('Service.ID', 'Service.Service') ID;
|
||||
@or('Service.{ID,Service}') ID;
|
||||
@or('Service.Address', 'Node.Service') Address;
|
||||
|
||||
@alias('Service.Tags') Tags;
|
||||
|
@ -54,7 +54,7 @@ export default class ServiceInstance extends Model {
|
|||
// MeshChecks are a concatenation of Checks for the Instance and Checks for
|
||||
// the ProxyInstance. Checks is an ember-data-model-fragment, so we can't just
|
||||
// concat it, we have to loop through all the items in order to merge
|
||||
@computed('Checks', 'ProxyInstance.Checks', 'ProxyInstance.ServiceProxy.Expose.Checks')
|
||||
@computed('Checks', 'ProxyInstance{Checks,ServiceProxy.Expose.Checks}')
|
||||
get MeshChecks() {
|
||||
return (get(this, 'Checks') || [])
|
||||
.map(item => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Model, { attr } from '@ember-data/model';
|
||||
import { computed, get } from '@ember/object';
|
||||
import { computed } from '@ember/object';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
|
||||
export const PRIMARY_KEY = 'uid';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { inject as service } from '@ember/service';
|
||||
import Route from 'consul-ui/routing/route';
|
||||
import { get } from '@ember/object';
|
||||
import { action, setProperties } from '@ember/object';
|
||||
import { action } from '@ember/object';
|
||||
|
||||
export default class ShowRoute extends Route {
|
||||
@service('data-source/service') data;
|
||||
|
@ -10,7 +10,6 @@ export default class ShowRoute extends Route {
|
|||
|
||||
@action
|
||||
async createIntention(source, destination) {
|
||||
const intention = service.Intention;
|
||||
const model = this.repo.create({
|
||||
Datacenter: source.Datacenter,
|
||||
SourceName: source.Name,
|
||||
|
|
|
@ -23,9 +23,10 @@ export default class NodeSerializer extends Serializer.extend(EmbeddedRecordsMix
|
|||
};
|
||||
|
||||
transformHasManyResponse(store, relationship, item, parent = null) {
|
||||
let checks = {};
|
||||
let serializer;
|
||||
switch (relationship.key) {
|
||||
case 'Services':
|
||||
const checks = {};
|
||||
(item.Checks || [])
|
||||
.filter(item => {
|
||||
return item.ServiceID !== '';
|
||||
|
@ -36,7 +37,7 @@ export default class NodeSerializer extends Serializer.extend(EmbeddedRecordsMix
|
|||
}
|
||||
checks[item.ServiceID].push(item);
|
||||
});
|
||||
const serializer = this.store.serializerFor(relationship.type);
|
||||
serializer = this.store.serializerFor(relationship.type);
|
||||
item.Services = item.Services.map(service =>
|
||||
serializer.transformHasManyResponseFromNode(item, service, checks)
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import RepositoryService from 'consul-ui/services/repository';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { set, get } from '@ember/object';
|
||||
import { set } from '@ember/object';
|
||||
|
||||
const modelName = 'service-instance';
|
||||
export default class ServiceInstanceService extends RepositoryService {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const path = require('path');
|
||||
|
||||
const testInfo = require('ember-cli-test-info');
|
||||
/*eslint node/no-extraneous-require: "off"*/
|
||||
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
||||
|
||||
module.exports = useTestFrameworkDetector({
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/*eslint node/no-extraneous-require: "off"*/
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
module.exports = {
|
||||
description: 'Generates a Consul HTTP ember-data adapter',
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const path = require('path');
|
||||
|
||||
/*eslint node/no-extraneous-require: "off"*/
|
||||
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
||||
|
||||
module.exports = useTestFrameworkDetector({
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/*eslint node/no-extraneous-require: "off"*/
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
module.exports = {
|
||||
description: 'Generates a Consul HTTP ember-data model',
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const path = require('path');
|
||||
|
||||
/*eslint node/no-extraneous-require: "off"*/
|
||||
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
||||
|
||||
module.exports = useTestFrameworkDetector({
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const path = require('path');
|
||||
|
||||
/*eslint node/no-extraneous-require: "off"*/
|
||||
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
||||
|
||||
module.exports = useTestFrameworkDetector({
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/*eslint node/no-extraneous-require: "off"*/
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
module.exports = {
|
||||
description: 'Generates a Consul HTTP ember-data serializer',
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/*eslint node/no-extraneous-require: "off"*/
|
||||
'use strict';
|
||||
|
||||
const Funnel = require('broccoli-funnel');
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* eslint-env node */
|
||||
/*eslint node/no-extraneous-require: "off"*/
|
||||
'use strict';
|
||||
//
|
||||
const $ = process.env;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-env node */
|
||||
|
||||
const test = require('tape');
|
||||
|
||||
const getEnvironment = require('../../config/environment.js');
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-env node */
|
||||
|
||||
const test = require('tape');
|
||||
|
||||
const utils = require('../../config/utils.js');
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"build:staging": "ember build --environment staging",
|
||||
"build:ci": "ember build --environment test",
|
||||
"doc:toc": "doctoc README.md",
|
||||
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*",
|
||||
"lint": "FORCE_COLOR=1 npm-run-all --aggregate-output --continue-on-error --parallel lint:*",
|
||||
"lint:hbs": "ember-template-lint .",
|
||||
"lint:js": "eslint .",
|
||||
"_lint:dev:js": "eslint -c .dev.eslintrc.js --fix ./*.js ./.*.js app config lib server tests",
|
||||
|
@ -25,13 +25,14 @@
|
|||
"start:consul": "ember serve --proxy=${CONSUL_HTTP_ADDR:-http://localhost:8500} --port=${EMBER_SERVE_PORT:-4200} --live-reload-port=${EMBER_LIVE_RELOAD_PORT:-7020}",
|
||||
"start:api": "api-double --dir ./node_modules/@hashicorp/consul-api-double",
|
||||
"test": "ember test --test-port=${EMBER_TEST_PORT:-7357}",
|
||||
"test:lint": "yarn run lint",
|
||||
"test:oss": "CONSUL_NSPACES_ENABLED=0 ember test --test-port=${EMBER_TEST_PORT:-7357}",
|
||||
"test:ci": "ember test --test-port=${EMBER_TEST_PORT:-7357} --path dist --silent --reporter xunit",
|
||||
"test:oss:ci": "CONSUL_NSPACES_ENABLED=0 ember test --test-port=${EMBER_TEST_PORT:-7357} --path dist --silent --reporter xunit",
|
||||
"test:parallel": "EMBER_EXAM_PARALLEL=true ember exam --split=4 --parallel",
|
||||
"test:view": "ember test --server --test-port=${EMBER_TEST_PORT:-7357}",
|
||||
"test:oss:view": "CONSUL_NSPACES_ENABLED=0 ember test --server --test-port=${EMBER_TEST_PORT:-7357}",
|
||||
"test:node": "tape ./node-tests/**/*.js",
|
||||
"test:node": "yarn run test:lint && tape ./node-tests/**/*.js",
|
||||
"test:coverage": "COVERAGE=true ember test --environment test --filter=Unit --test-port=${EMBER_TEST_PORT:-7357}",
|
||||
"test:coverage:ci": "COVERAGE=true ember test --environment test --filter=Unit --path dist --test-port=${EMBER_TEST_PORT:-7357}",
|
||||
"test:coverage:view": "COVERAGE=true ember test --server --environment test --filter=Unit --test-port=${EMBER_TEST_PORT:-7357}",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/*eslint node/no-extraneous-require: "off"*/
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const promisify = require('util').promisify;
|
||||
|
|
|
@ -49,17 +49,6 @@ module('Integration | Serializer | node', function(hooks) {
|
|||
url: `/v1/internal/ui/node/${id}?dc=${dc}`,
|
||||
};
|
||||
return get(request.url).then(function(payload) {
|
||||
const expected = Object.assign({}, payload, {
|
||||
Datacenter: dc,
|
||||
[META]: {
|
||||
[DC.toLowerCase()]: dc,
|
||||
[NSPACE.toLowerCase()]: nspace,
|
||||
},
|
||||
// TODO: default isn't required here, once we've
|
||||
// refactored out our Serializer this can go
|
||||
Namespace: nspace,
|
||||
uid: `["${nspace}","${dc}","${id}"]`,
|
||||
});
|
||||
const actual = serializer.respondForQueryRecord(
|
||||
function(cb) {
|
||||
const headers = {};
|
||||
|
|
|
@ -1,21 +1,17 @@
|
|||
export default function(scenario, assert, find, currentPage) {
|
||||
scenario.then('I see the $property form with yaml\n$yaml', function(property, data) {
|
||||
let obj;
|
||||
try {
|
||||
let obj;
|
||||
try {
|
||||
obj = find(property);
|
||||
} catch (e) {
|
||||
obj = currentPage();
|
||||
}
|
||||
return Object.keys(data).reduce(function(prev, item, i, arr) {
|
||||
const name = `${obj.prefix || property}[${item}]`;
|
||||
const $el = document.querySelector(`[name="${name}"]`);
|
||||
const actual = $el.value;
|
||||
const expected = data[item];
|
||||
assert.strictEqual(actual, expected, `Expected settings to be ${expected} was ${actual}`);
|
||||
}, obj);
|
||||
obj = find(property);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
obj = currentPage();
|
||||
}
|
||||
return Object.keys(data).reduce(function(prev, item, i, arr) {
|
||||
const name = `${obj.prefix || property}[${item}]`;
|
||||
const $el = document.querySelector(`[name="${name}"]`);
|
||||
const actual = $el.value;
|
||||
const expected = data[item];
|
||||
assert.strictEqual(actual, expected, `Expected settings to be ${expected} was ${actual}`);
|
||||
}, obj);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -189,14 +189,12 @@ export default function(scenario, assert, find, currentPage, $) {
|
|||
],
|
||||
function(property, component, containsLike, value) {
|
||||
let target;
|
||||
try {
|
||||
if (typeof component === 'string') {
|
||||
property = `${component}.${property}`;
|
||||
}
|
||||
target = find(property);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
|
||||
if (typeof component === 'string') {
|
||||
property = `${component}.${property}`;
|
||||
}
|
||||
target = find(property);
|
||||
|
||||
if (containsLike === 'like') {
|
||||
assert.equal(
|
||||
target,
|
||||
|
|
|
@ -11,14 +11,10 @@ export default function(scenario, find, click) {
|
|||
'I click $property on the $component component',
|
||||
],
|
||||
function(property, component, next) {
|
||||
try {
|
||||
if (typeof component === 'string') {
|
||||
property = `${component}.${property}`;
|
||||
}
|
||||
return find(property)();
|
||||
} catch (e) {
|
||||
throw e;
|
||||
if (typeof component === 'string') {
|
||||
property = `${component}.${property}`;
|
||||
}
|
||||
return find(property)();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -37,41 +37,37 @@ export default function(scenario, find, fillIn, triggerKeyEvent, currentPage) {
|
|||
`I${dont} fill in the $property on the $component component with yaml\n$yaml`,
|
||||
],
|
||||
function(negative, property, component, data, next) {
|
||||
try {
|
||||
switch (true) {
|
||||
case typeof component === 'string':
|
||||
property = `${component}.${property}`;
|
||||
// fallthrough
|
||||
case typeof data === 'undefined':
|
||||
data = component;
|
||||
// // fallthrough
|
||||
// case typeof property !== 'string':
|
||||
// data = property;
|
||||
}
|
||||
let obj;
|
||||
try {
|
||||
obj = find(property);
|
||||
} catch (e) {
|
||||
obj = currentPage();
|
||||
}
|
||||
return Object.keys(data).reduce(function(prev, item, i, arr) {
|
||||
const name = `${obj.prefix || property}[${item}]`;
|
||||
if (negative) {
|
||||
try {
|
||||
fillInElement(prev, name, data[item]);
|
||||
throw new TypeError(`${item} is editable`);
|
||||
} catch (e) {
|
||||
if (e instanceof TypeError) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return fillInElement(prev, name, data[item]);
|
||||
}
|
||||
}, obj);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
switch (true) {
|
||||
case typeof component === 'string':
|
||||
property = `${component}.${property}`;
|
||||
// fallthrough
|
||||
case typeof data === 'undefined':
|
||||
data = component;
|
||||
// // fallthrough
|
||||
// case typeof property !== 'string':
|
||||
// data = property;
|
||||
}
|
||||
let obj;
|
||||
try {
|
||||
obj = find(property);
|
||||
} catch (e) {
|
||||
obj = currentPage();
|
||||
}
|
||||
return Object.keys(data).reduce(function(prev, item, i, arr) {
|
||||
const name = `${obj.prefix || property}[${item}]`;
|
||||
if (negative) {
|
||||
try {
|
||||
fillInElement(prev, name, data[item]);
|
||||
throw new TypeError(`${item} is editable`);
|
||||
} catch (e) {
|
||||
if (e instanceof TypeError) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return fillInElement(prev, name, data[item]);
|
||||
}
|
||||
}, obj);
|
||||
}
|
||||
)
|
||||
.then(['I type "$text" into "$selector"'], function(text, selector) {
|
||||
|
|
Loading…
Reference in New Issue