12
.eslintrc.js
12
.eslintrc.js
@@ -1,3 +1,4 @@
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const { createConfig } = require('@edx/frontend-build');
|
||||
|
||||
const config = createConfig('eslint', {
|
||||
@@ -6,19 +7,22 @@ const config = createConfig('eslint', {
|
||||
'import/no-named-as-default-member': 'off',
|
||||
'import/no-self-import': 'off',
|
||||
'spaced-comment': ['error', 'always', { 'block': { 'exceptions': ['*'] } }],
|
||||
|
||||
|
||||
// TOD: Remove this rule once we have a better way to handle this.
|
||||
'import/no-import-module-exports': 'off',
|
||||
'no-import-assign': 'off',
|
||||
'default-param-last': 'off',
|
||||
},
|
||||
overrides: [{
|
||||
files: ['*.test.js'], rules: { 'no-import-assign': 'off' },
|
||||
}],
|
||||
});
|
||||
|
||||
config.settings = {
|
||||
"import/resolver": {
|
||||
'import/resolver': {
|
||||
node: {
|
||||
paths: ["src", "node_modules"],
|
||||
extensions: [".js", ".jsx"],
|
||||
paths: ['src', 'node_modules'],
|
||||
extensions: ['.js', '.jsx'],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
16954
package-lock.json
generated
16954
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -2,20 +2,23 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import * as constants from 'data/constants/filters';
|
||||
import FilterBadges from '.';
|
||||
import FilterBadge from './FilterBadge';
|
||||
|
||||
jest.mock('./FilterBadge', () => 'FilterBadge');
|
||||
|
||||
const order = ['filter1', 'filter2', 'filter3'];
|
||||
jest.mock('data/constants/filters', () => ({
|
||||
...jest.requireActual('data/constants/filters'),
|
||||
badgeOrder: order,
|
||||
}));
|
||||
|
||||
describe('FilterBadges', () => {
|
||||
describe('component', () => {
|
||||
let el;
|
||||
let handleClose;
|
||||
const order = ['filter1', 'filter2', 'filter3'];
|
||||
beforeEach(() => {
|
||||
handleClose = jest.fn().mockName('this.props.handleClose');
|
||||
constants.badgeOrder = order;
|
||||
el = shallow(<FilterBadges handleClose={handleClose} />);
|
||||
});
|
||||
test('snapshot - has a filterbadge with handleClose for each filter in badgeOrder', () => {
|
||||
|
||||
@@ -33,9 +33,7 @@ Username.propTypes = {
|
||||
* Simple label field for email value.
|
||||
* @param {string} email - email for display
|
||||
*/
|
||||
const Email = ({ email }) => (
|
||||
<span className="wrap-text-in-cell">{email}</span>
|
||||
);
|
||||
const Email = ({ email }) => <span className="wrap-text-in-cell">{email}</span>;
|
||||
Email.propTypes = {
|
||||
email: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ const initialState = {
|
||||
searchValue: '',
|
||||
};
|
||||
|
||||
const app = (state = initialState, { type, payload }) => {
|
||||
const app = (state = initialState, { type, payload } = {}) => {
|
||||
switch (type) {
|
||||
case actions.closeModal.toString():
|
||||
return { ...state, modalState: { ...initialState.modalState } };
|
||||
|
||||
@@ -6,7 +6,7 @@ const initialState = {
|
||||
errorFetching: false,
|
||||
};
|
||||
|
||||
const assignmentTypes = (state = initialState, { type, payload }) => {
|
||||
const assignmentTypes = (state = initialState, { type, payload } = {}) => {
|
||||
switch (type) {
|
||||
case actions.fetching.started.toString():
|
||||
return {
|
||||
|
||||
@@ -6,7 +6,7 @@ const initialState = {
|
||||
errorFetching: false,
|
||||
};
|
||||
|
||||
const cohorts = (state = initialState, action) => {
|
||||
const cohorts = (state = initialState, action = {}) => {
|
||||
switch (action.type) {
|
||||
case actions.fetching.started.toString():
|
||||
return {
|
||||
|
||||
@@ -2,7 +2,7 @@ import actions from '../actions/config';
|
||||
|
||||
const initialState = {};
|
||||
|
||||
const reducer = (state = initialState, action) => {
|
||||
const reducer = (state = initialState, action = {}) => {
|
||||
switch (action.type) {
|
||||
case actions.gotBulkManagementConfig.toString():
|
||||
return {
|
||||
|
||||
@@ -5,7 +5,7 @@ import initialFilters from '../constants/filters';
|
||||
|
||||
const initialState = {};
|
||||
|
||||
const reducer = (state = initialState, { type: actionType, payload }) => {
|
||||
const reducer = (state = initialState, { type: actionType, payload } = {}) => {
|
||||
switch (actionType) {
|
||||
case actions.initialize.toString():
|
||||
return {
|
||||
|
||||
@@ -30,7 +30,7 @@ const initialState = {
|
||||
isDownloadGradesActive: false,
|
||||
};
|
||||
|
||||
const grades = (state = initialState, { type, payload }) => {
|
||||
const grades = (state = initialState, { type, payload } = {}) => {
|
||||
switch (type) {
|
||||
case actions.banner.open.toString():
|
||||
return {
|
||||
|
||||
@@ -4,7 +4,7 @@ const initialState = {
|
||||
canUserViewGradebook: true,
|
||||
};
|
||||
|
||||
const roles = (state = initialState, action) => {
|
||||
const roles = (state = initialState, action = {}) => {
|
||||
switch (action.type) {
|
||||
case actions.fetching.received.toString():
|
||||
return {
|
||||
|
||||
@@ -6,7 +6,7 @@ const initialState = {
|
||||
errorFetching: false,
|
||||
};
|
||||
|
||||
const tracks = (state = initialState, action) => {
|
||||
const tracks = (state = initialState, action = {}) => {
|
||||
switch (action.type) {
|
||||
case actions.fetching.started.toString():
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user