Skip to content

Commit

Permalink
move t out of webpack as a followup to #2753 (and indirectly to #2752)
Browse files Browse the repository at this point in the history
also defines jquery as global
  • Loading branch information
magicznyleszek committed Nov 16, 2020
1 parent 196dd63 commit b8b581c
Show file tree
Hide file tree
Showing 67 changed files with 68 additions and 129 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"node": true,
"es6": true
},
"globals": {
"t": "readonly",
"$": "readonly"
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/actions.es6
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
log,
notify,
replaceSupportEmail,
} from './utils';
} from 'utils';

// Configure Reflux
Reflux.use(RefluxPromise(window.Promise));
Expand Down
4 changes: 1 addition & 3 deletions jsapp/js/actions/help.es6
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

import Reflux from 'reflux';
import {dataInterface} from '../dataInterface';
import {
notify
} from '../utils';
import {notify} from 'utils';

export const helpActions = Reflux.createActions({
getInAppMessages: {
Expand Down
3 changes: 0 additions & 3 deletions jsapp/js/actions/permissions.es6
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import Reflux from 'reflux';
import RefluxPromise from 'js/libs/reflux-promise';
Reflux.use(RefluxPromise(window.Promise));
import {dataInterface} from 'js/dataInterface';
import {
notify
} from 'js/utils';

export const permissionsActions = Reflux.createActions({
getConfig: {children: ['completed', 'failed']},
Expand Down
5 changes: 1 addition & 4 deletions jsapp/js/app.es6
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* TODO: move routes configuration to separate file for clarity.
*/

import $ from 'jquery';
window.jQuery = $;
window.$ = $;
require('jquery-ui/ui/widgets/sortable');

import React from 'react';
Expand Down Expand Up @@ -49,7 +46,7 @@ import ChangePassword from './components/changePassword';
import {
assign,
currentLang
} from './utils';
} from 'utils';
import LibrarySearchableList from './lists/library';
import FormsSearchableList from './lists/forms';

Expand Down
5 changes: 1 addition & 4 deletions jsapp/js/assetParserUtils.es6
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
parsePermissions,
assign,
} from './utils';
import {assign} from 'utils';

export function parseTags (asset) {
return {
Expand Down
5 changes: 1 addition & 4 deletions jsapp/js/components/RESTServices/RESTServiceLogs.es6
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import $ from 'jquery';
import React from 'react';
import PropTypes from 'prop-types';
import autoBind from 'react-autobind';
Expand All @@ -10,9 +9,7 @@ import {bem} from '../../bem';
import {actions} from '../../actions';
import mixins from '../../mixins';
import {dataInterface} from '../../dataInterface';
import {
formatTime
} from '../../utils';
import {formatTime} from 'utils';
import {
HOOK_LOG_STATUSES,
MODAL_TYPES
Expand Down
1 change: 0 additions & 1 deletion jsapp/js/components/RESTServices/RESTServicesForm.es6
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import $ from 'jquery';
import React from 'react';
import autoBind from 'react-autobind';
import TagsInput from 'react-tagsinput';
Expand Down
5 changes: 1 addition & 4 deletions jsapp/js/components/accountSettings.es6
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import $ from 'jquery';
import React from 'react';
import reactMixin from 'react-mixin';
import autoBind from 'react-autobind';
Expand All @@ -14,9 +13,7 @@ import TextBox from './textBox';
import Checkbox from './checkbox';
import ApiTokenDisplay from './apiTokenDisplay';
import {hashHistory} from 'react-router';
import {
stringToColor,
} from '../utils';
import {stringToColor} from 'utils';

const UNSAVED_CHANGES_WARNING = t('You have unsaved changes. Leave settings without saving?');

Expand Down
5 changes: 1 addition & 4 deletions jsapp/js/components/assetrow.es6
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import PropTypes from 'prop-types';
import reactMixin from 'react-mixin';
import autoBind from 'react-autobind';
import $ from 'jquery';
import { Link } from 'react-router';
import {bem} from '../bem';
import ui from '../ui';
Expand All @@ -13,9 +12,7 @@ import {
ASSET_TYPES
} from 'js/constants';
import TagInput from '../components/tagInput';
import {
formatTime
} from '../utils';
import {formatTime} from 'utils';
import assetUtils from 'js/assetUtils';

class AssetRow extends React.Component {
Expand Down
4 changes: 1 addition & 3 deletions jsapp/js/components/changePassword.es6
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {stores} from '../stores';
import TextBox from './textBox';
import {hashHistory} from 'react-router';
import PasswordStrength from 'js/components/passwordStrength';
import {
stringToColor,
} from '../utils';
import {stringToColor} from 'utils';
import {ROOT_URL} from 'js/constants';

export default class ChangePassword extends React.Component {
Expand Down
4 changes: 1 addition & 3 deletions jsapp/js/components/drawer.es6
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import {

import {MODAL_TYPES} from '../constants';

import {
assign
} from '../utils';
import {assign} from 'utils';

import SidebarFormsList from '../lists/sidebarForms';

Expand Down
3 changes: 1 addition & 2 deletions jsapp/js/components/formEditors.es6
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import $ from 'jquery';
import React from 'react';
import PropTypes from 'prop-types';
import reactMixin from 'react-mixin';
Expand All @@ -15,7 +14,7 @@ import {
log,
redirectTo,
formatTime,
} from '../utils';
} from 'utils';
import {
ROOT_URL,
update_states,
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/formLanding.es6
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {MODAL_TYPES} from '../constants';
import {
formatTime,
notify
} from '../utils';
} from 'utils';

const DVCOUNT_LIMIT_MINIMUM = 20;

Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/formSummary.es6
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
formatTime,
formatDate,
stringToColor
} from '../utils';
} from 'utils';

import {MODAL_TYPES} from '../constants';

Expand Down
5 changes: 1 addition & 4 deletions jsapp/js/components/formViewTabs.es6
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import $ from 'jquery';
import React from 'react';
import PropTypes from 'prop-types';
import reactMixin from 'react-mixin';
Expand All @@ -9,9 +8,7 @@ import {stores} from '../stores';
import { Link, hashHistory } from 'react-router';
import mixins from '../mixins';
import {PERMISSIONS_CODENAMES} from 'js/constants';
import {
assign,
} from '../utils';
import {assign} from 'utils';

class FormViewTabs extends Reflux.Component {
constructor(props){
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/header.es6
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
assign,
currentLang,
stringToColor,
} from '../utils';
} from 'utils';
import {searches} from '../searches';
import {ListSearch} from '../components/list';
import {NAME_MAX_LENGTH} from 'js/constants';
Expand Down
1 change: 0 additions & 1 deletion jsapp/js/components/intercomHandler.es6
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import $ from 'jquery';
import React from 'react';
import reactMixin from 'react-mixin';
import Reflux from 'reflux';
Expand Down
4 changes: 1 addition & 3 deletions jsapp/js/components/librarySidebar.es6
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import $ from 'jquery';
import React from 'react';
import PropTypes from 'prop-types';
import reactMixin from 'react-mixin';
Expand All @@ -24,8 +23,7 @@ import {
validFileTypes,
getAnonymousUserPermission,
buildUserUrl
} from '../utils';

} from 'utils';

class LibrarySidebar extends Reflux.Component {
constructor(props){
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/map.es6
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {MODAL_TYPES, QUESTION_TYPES} from '../constants';
import {
notify,
checkLatLng
} from '../utils';
} from 'utils';
import {getSurveyFlatPaths} from 'js/assetUtils';

import MapSettings from './mapSettings';
Expand Down
1 change: 0 additions & 1 deletion jsapp/js/components/mapSettings.es6
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import $ from 'jquery';
import React from 'react';
import reactMixin from 'react-mixin';
import Reflux from 'reflux';
Expand Down
4 changes: 1 addition & 3 deletions jsapp/js/components/metadataEditor.es6
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import React from 'react';
import autoBind from 'react-autobind';
import Checkbox from 'js/components/checkbox';
import TextBox from 'js/components/textBox';
import {
assign
} from 'js/utils';
import {assign} from 'utils';
import {
META_QUESTION_TYPES,
} from 'js/constants';
Expand Down
1 change: 0 additions & 1 deletion jsapp/js/components/modalForms/encryptForm.es6
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {actions} from 'js/actions';
import {bem} from 'js/bem';
import {MODAL_TYPES} from 'js/constants';
import {stores} from 'js/stores';
import {t} from 'utils';

class EncryptForm extends React.Component {
constructor(props) {
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/modalForms/projectSettings.es6
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
validFileTypes,
isAValidUrl,
escapeHtml
} from 'js/utils';
} from 'utils';
import {
NAME_MAX_LENGTH,
PROJECT_SETTINGS_CONTEXTS
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/modalForms/submission.es6
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {dataInterface} from 'js/dataInterface';
import {actions} from 'js/actions';
import mixins from 'js/mixins';
import {bem} from 'js/bem';
import {notify, launchPrinting} from 'js/utils';
import {notify, launchPrinting} from 'utils';
import {stores} from 'js/stores';
import {
VALIDATION_STATUSES_LIST,
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/modalForms/tableColumnFilter.es6
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ui from 'js/ui';
import {actions} from 'js/actions';
import {stores} from 'js/stores';
import mixins from 'js/mixins';
import {notify} from 'js/utils';
import {notify} from 'utils';
import {SUBMISSION_LINKS_ID} from 'js/components/table';

export class TableColumnFilter extends React.Component {
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/permissions/copyTeamPermissions.es6
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Select from 'react-select';
import alertify from 'alertifyjs';
import {stores} from '../../stores';
import {actions} from '../../actions';
import {notify} from '../../utils';
import {notify} from 'utils';

class CopyTeamPermissions extends React.Component {
constructor(props) {
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/permissions/permConfig.es6
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {actions} from 'js/actions';
import {
notify,
assign
} from 'js/utils';
} from 'utils';

// TODO instead of this use `stateChanges` function from '/js/utils'
// after https://github.com/kobotoolbox/kpi/pull/1959 is merged
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/permissions/permParser.es6
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import {
buildUserUrl,
getUsernameFromUrl
} from 'js/utils';
} from 'utils';

/**
* @typedef {Object} BackendPerm
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/permissions/permValidator.es6
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import _ from 'underscore';
import {
notify,
replaceSupportEmail
} from 'js/utils';
} from 'utils';

const INVALID_PERMS_ERROR = t('The stored permissions are invalid. Please assign them again. If this problem persists, contact [email protected]');

Expand Down
4 changes: 1 addition & 3 deletions jsapp/js/components/permissions/publicShareSettings.es6
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import mixins from 'js/mixins';
import {actions} from 'js/actions';
import {bem} from 'js/bem';
import permConfig from 'js/components/permissions/permConfig';
import {
buildUserUrl
} from 'js/utils';
import {buildUserUrl} from 'utils';
import {
ROOT_URL,
ANON_USERNAME,
Expand Down
4 changes: 1 addition & 3 deletions jsapp/js/components/permissions/sharingForm.es6
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import mixins from 'js/mixins';
import {stores} from 'js/stores';
import {actions} from 'js/actions';
import {bem} from 'js/bem';
import {
buildUserUrl
} from 'js/utils';
import {buildUserUrl} from 'utils';
import {
ASSET_KINDS,
ANON_USERNAME
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/permissions/userAssetPermsEditor.es6
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
assign,
notify,
buildUserUrl
} from 'js/utils';
} from 'utils';
import {
ANON_USERNAME,
KEY_CODES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import permConfig from './permConfig';
import {
notify,
buildUserUrl
} from 'js/utils';
} from 'utils';
import {
ANON_USERNAME,
PERMISSIONS_CODENAMES,
Expand Down
4 changes: 1 addition & 3 deletions jsapp/js/components/permissions/userPermissionRow.es6
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import mixins from 'js/mixins';
import {stores} from 'js/stores';
import {actions} from 'js/actions';
import {bem} from 'js/bem';
import {
stringToColor,
} from 'js/utils';
import {stringToColor} from 'utils';
import {
KEY_CODES,
ASSET_KINDS,
Expand Down
3 changes: 0 additions & 3 deletions jsapp/js/components/reportViewItem.es6
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import ReactDOM from 'react-dom';
import _ from 'underscore';
import Chart from 'chart.js';
import {bem} from '../bem';
import $ from 'jquery';

import {assign} from '../utils';

class ReportTable extends React.Component {
constructor(props) {
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/reports.es6
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import ReportViewItem from './reportViewItem';
import {
assign,
launchPrinting
} from '../utils';
} from 'utils';

function labelVal(label, value) {
return {label: label, value: (value || label.toLowerCase().replace(/\W+/g, '_'))};
Expand Down
Loading

0 comments on commit b8b581c

Please sign in to comment.