refactor: upgraded frontend-build version to v12

PR #254
This commit is contained in:
Bilal Qamar
2023-01-26 17:57:49 +05:00
committed by GitHub
parent 85607d7e97
commit 6be4aac16e
12 changed files with 9481 additions and 7514 deletions

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -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', () => {

View File

@@ -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,
};

View File

@@ -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 } };

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {