Skip to content

[WIP] 3.x upgrade #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 22 additions & 53 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,29 @@ module.exports = {
sourceType: 'module'
},
plugins: ['ember'],
extends: 'eslint:recommended',
extends: ['eslint:recommended', 'plugin:ember/recommended'],
env: {
'browser': true
browser: true
},
globals: {
'heimdall': true,
'FastBoot': true
},
rules: {
'ember/no-jquery': 'off',
'no-unused-vars': ['error', {
'args': 'none',
}],

// from JSHint
'no-cond-assign': ['error', 'except-parens'],
'eqeqeq': 'error',
'no-eval': 'error',
'new-cap': ['error', {
'capIsNew': false,
}],
'no-caller': 'error',
'no-irregular-whitespace': 'error',
'no-undef': 'error',
'no-eq-null': 'error',

// from JSCS
'array-bracket-spacing': ['error', 'never'],
'comma-style': ['error', 'last'],
'brace-style': ['error', '1tbs', {
'allowSingleLine': true,
}],
'no-spaced-func': 'error',
'no-empty': 'error',
'curly': ['error', 'all'],
'eol-last': 'error',
'no-trailing-spaces': 'error',
'comma-dangle': ['error', 'never'],
'space-before-blocks': ['error', 'always'],
'indent': ['error', 2, {
'SwitchCase': 1,
}],
'keyword-spacing': ['error', {
'overrides': {
'else': {
'before': true,
},
'while': {
'before': true,
},
'catch': {
'before': true,
},
rules: {},
overrides: [
// node files
{
files: [
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js'
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015
},
}],
}
env: {
browser: false,
node: true
}
}
]
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ testem.log
public/json-docs/
public/rev-index/
jsconfig.json
package-lock.json
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.hbs
*.html
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"semi": true,
"printWidth": 100
}
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ addons:
cache:
yarn: true

env:
global:
# See https://git.io/vdao3 for details.
- JOBS=1

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.0.1
- export PATH=$HOME/.yarn/bin:$PATH
Expand Down
8 changes: 4 additions & 4 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ export default JSONAPIAdapter.extend({

async findRecord(store, {modelName}, id) {
let url;
let host = this.get('host');
let projectName = this.get('currentProject');
let host = this.host;
let projectName = this.currentProject;

if (['namespace', 'class', 'module'].indexOf(modelName) > -1) {
let [version] = id.replace(`${projectName}-`, '').split('-');
let revId = this.get('metaStore').getRevId(projectName, version, modelName, id);
let revId = this.metaStore.getRevId(projectName, version, modelName, id);
let encodedRevId = encodeURIComponent(revId);
url = `json-docs/${projectName}/${version}/${pluralize(modelName)}/${encodedRevId}`;
} else if (modelName === 'missing') {
let version = this.get('projectService.version');
let revId = this.get('metaStore').getRevId(projectName, version, modelName, id);
let revId = this.metaStore.getRevId(projectName, version, modelName, id);
url = `json-docs/${projectName}/${version}/${pluralize(modelName)}/${revId}`;
} else if (modelName === 'project') {
this.set('currentProject', id);
Expand Down
8 changes: 4 additions & 4 deletions app/components/api-index-filter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { computed } from '@ember/object';
import Component from '@ember/component';
import sortBy from 'npm:lodash.sortby';
import sortBy from 'lodash.sortby';

const filterDataComputedParams = 'filterData.{showInherited,showProtected,showPrivate,showDeprecated}';

Expand Down Expand Up @@ -43,9 +43,9 @@ export default Component.extend({

filteredData: computed('filteredMethods', 'filteredProperties', 'filteredEvents', function() {
return {
methods: this.get('filteredMethods'),
properties: this.get('filteredProperties'),
events: this.get('filteredEvents')
methods: this.filteredMethods,
properties: this.filteredProperties,
events: this.filteredEvents
};
}),

Expand Down
2 changes: 1 addition & 1 deletion app/components/api-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Component from '@ember/component';

export default Component.extend({

sections: computed('itemData.methods', 'itemData.properties', 'itemData.events', function () {
sections: computed('itemData.{methods,properties,events}', function () {
return [
{
title: 'Methods',
Expand Down
9 changes: 6 additions & 3 deletions app/components/class-field-description.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import { computed } from '@ember/object';
export default Component.extend({
legacyModuleMappings: service(),

hasImportExample: computed('field.name', 'field.class', function () {
return this.get('legacyModuleMappings').hasFunctionMapping(this.get('field.name'), this.get('field.class'));
hasImportExample: computed('field.{name,class}', function() {
return this.legacyModuleMappings.hasFunctionMapping(
this.get('field.name'),
this.get('field.class')
);
}),

/**
Expand All @@ -15,5 +18,5 @@ export default Component.extend({
* @method updateAnchor
* @method fieldName String The name representing the field that was clicked.
*/
updateAnchor(fieldName) {}
updateAnchor(/**fieldName**/) {}
});
2 changes: 1 addition & 1 deletion app/components/ember-anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default AnchorComponent.extend({

// This overrides Ember Anchor to support scrolling within a fixed position element
_scrollToElemPosition() {
let qp = this.get('anchorQueryParam');
let qp = this.anchorQueryParam;
let qpVal = this.get(get(this, 'attrs.a') ? 'a' : `controller.${qp}`);
let elem = $(`[data-${qp}="${qpVal}"]`);
let offset = elem.offset() ? elem.offset().top : 0;
Expand Down
16 changes: 8 additions & 8 deletions app/components/search-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { A } from '@ember/array';
import { alias } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import get from 'ember-metal/get';
import set from 'ember-metal/set';
import { get } from '@ember/object';
import { set } from '@ember/object';
import { task, timeout } from 'ember-concurrency';

const SEARCH_DEBOUNCE_PERIOD = 300;
Expand All @@ -22,19 +22,19 @@ export default Component.extend({
_projectVersion: alias('_projectService.version'),
_results: A(),
_focused: false,
_resultTetherConstraints: [
_resultTetherConstraints: Object.freeze([
{
to: 'window',
pin: ['left','right']
}
],
]),

search: task(function * (query) {

yield timeout(SEARCH_DEBOUNCE_PERIOD);

const client = get(this, '_searchClient');
const projectVersion = get(this, '_projectVersion');
const client = this._searchClient;
const projectVersion = this._projectVersion;

// Hide and don't run query if there's no search query
if (!query) {
Expand Down Expand Up @@ -64,7 +64,7 @@ export default Component.extend({
let res = yield searchFn(searchObj, params);

const results = get(res, 'hits');
return get(this, '_results')
return this._results
.clear()
.addObjects(results);
}).restartable(),
Expand All @@ -82,7 +82,7 @@ export default Component.extend({
},

onblur() {
this.get('closeMenu').perform();
this.closeMenu.perform();
}

}
Expand Down
8 changes: 6 additions & 2 deletions app/components/search-input/dropdown-result.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ import { computed } from '@ember/object';
import Component from '@ember/component';

export default Component.extend({
init() {
this._super(...arguments);
this.set("result", {});
},
// Public API
result: {},
result: null,
role: 'option',
groupName: '',
groupPosition: 0, // Index of this result in the grouped results
Expand All @@ -19,7 +23,7 @@ export default Component.extend({
}),
// Left sidebar should only be displayed for the first result in the group
_primaryColumn: computed('groupPosition,groupName', function () {
const { groupName, groupPosition } = this.getProperties('groupName', 'groupPosition');
const { groupName, groupPosition } = this;
return groupPosition === 0? groupName : '';
}),
isSecondary: gt('groupPosition', 0)
Expand Down
2 changes: 1 addition & 1 deletion app/components/search-input/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default Component.extend({
return {};
}

const lvl0Group = get(this, 'results').reduce((previous, current) => {
const lvl0Group = this.results.reduce((previous, current) => {
// Remap all lowercase usages of 'guides' to 'Guides'
let lvl0 = get(current, 'hierarchy.lvl0');
// If lvl0 doesn't exist in the resulting object, create the array
Expand Down
24 changes: 12 additions & 12 deletions app/controllers/project-version.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Controller from '@ember/controller';
import { computed } from '@ember/object';
import { alias } from '@ember/object/computed';
import { alias, readOnly } from '@ember/object/computed';
import { A } from '@ember/array';
import { inject as service } from '@ember/service';
import values from 'npm:lodash.values';
import groupBy from 'npm:lodash.groupby';
import semverCompare from 'npm:semver-compare';
import values from 'lodash.values';
import groupBy from 'lodash.groupby';
import semverCompare from 'semver-compare';
import FilterParams from '../mixins/filter-params';
import getCompactVersion from '../utils/get-compact-version';

Expand All @@ -17,7 +17,7 @@ export default Controller.extend(FilterParams, {

project: service(),

showPrivateClasses: computed.alias('filterData.sideNav.showPrivate'),
showPrivateClasses: alias('filterData.sideNav.showPrivate'),

classesIDs: computed('model', function() {
return this.getRelationshipIDs('classes');
Expand Down Expand Up @@ -49,28 +49,28 @@ export default Controller.extend(FilterParams, {
},

getRelations(relationship) {
return this.get('model').hasMany(relationship).ids().sort();
return this.model.hasMany(relationship).ids().sort();
},

getRelationshipIDs(relationship) {
const splitPoint = 2 + this.get('model.project.id').split('-').length - 1;
const classes = this.get('model').hasMany(relationship);
const classes = this.model.hasMany(relationship);
const sorted = A(classes.ids()).sort();
//ids come in as ember-2.16.0-@ember/object/promise-proxy-mixin
//so we take the string after the 2nd '-'
return A(sorted).toArray().map(id => id.split('-').slice(splitPoint).join('-'));
},

shownClassesIDs: computed('showPrivateClasses', 'classesIDs', 'publicClassesIDs', function() {
return this.get('showPrivateClasses') ? this.get('classesIDs') : this.get('publicClassesIDs');
return this.showPrivateClasses ? this.classesIDs : this.publicClassesIDs;
}),

shownModuleIDs: computed('showPrivateClasses', 'moduleIDs', 'publicModuleIDs', function() {
return this.get('showPrivateClasses') ? this.get('moduleIDs') : this.get('publicModuleIDs');
return this.showPrivateClasses ? this.moduleIDs : this.publicModuleIDs;
}),

shownNamespaceIDs: computed('showPrivateClasses', 'namespaceIDs', 'publicNamespaceIDs', function() {
return this.get('showPrivateClasses') ? this.get('namespaceIDs') : this.get('publicNamespaceIDs');
return this.showPrivateClasses ? this.namespaceIDs : this.publicNamespaceIDs;
}),

projectVersions: computed('metaStore.availableProjectVersions', 'model.project.id', function() {
Expand All @@ -89,8 +89,8 @@ export default Controller.extend(FilterParams, {
urlVersion: alias('project.urlVersion'),

selectedProjectVersion:computed('projectVersions.[]', 'model.version', function() {
return this.get('projectVersions').filter(pV => pV.id === this.get('model.version'))[0];
return this.projectVersions.filter(pV => pV.id === this.get('model.version'))[0];
}),

activeProject: computed.readOnly('model.project.id')
activeProject: readOnly('model.project.id')
});
4 changes: 2 additions & 2 deletions app/controllers/project-version/classes/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export default Controller.extend(ParentNameMixin, {
legacyModuleMappings: service(),

hasImportExample: computed('model.name', 'legacyModuleMappings.mappings', function () {
return this.get('legacyModuleMappings').hasClassMapping(this.get('model.name'), this.get('model.module'));
return this.legacyModuleMappings.hasClassMapping(this.get('model.name'), this.get('model.module'));
}),

module: computed('model.name', 'legacyModulemappings.mappings', function () {
return this.get('legacyModuleMappings').getModule(this.get('model.name'), this.get('model.module'));
return this.legacyModuleMappings.getModule(this.get('model.name'), this.get('model.module'));
}),

actions: {
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/project-version/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading