Skip to content

Commit

Permalink
Migrate eslint config edx (#346)
Browse files Browse the repository at this point in the history
* fix: fixed issue of build and installation

* refactor: added @edx/eslint-config and fixed auto linting issues

* fix: fixed default-param-last and some other errors

* fix: build dependency fixed

* fix: added babel eslint config and auto fixed errors

* fix: fixed spacing and forammting errors

* refactor: added proptypes of asstes and asset list types

* refactor: added remaining proptype details

* refactor: fixed import issues

* refactor: fixed unused refs issue

* fix: fixed crashing unit tests

* fix: reverted pagination component to class to fix unit test

* refactor: added acorn dependency

* refactor: improved coverage

* refactor: moved enzyme from depencies to devDependency

* fix: removed unnecessary acorn package
  • Loading branch information
abdullahwaheed authored Jul 26, 2022
1 parent 13e614a commit 410c0e6
Show file tree
Hide file tree
Showing 77 changed files with 19,747 additions and 5,004 deletions.
14 changes: 12 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "eslint-config-edx",
"parser": "babel-eslint",
"extends": "@edx/eslint-config",
"parser": "@babel/eslint-parser",
"rules": {
"import/no-extraneous-dependencies": [
"error",
Expand All @@ -19,6 +19,16 @@
"quote-props": [
"error",
"consistent-as-needed"
],
"default-param-last": [
"off"
],
"comma-dangle": ["off"],
"react/function-component-definition": [
2,
{
"namedComponents": ["function-declaration", "arrow-function"]
}
]
},
"env": {
Expand Down
8 changes: 2 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ RUN npm i -g [email protected]

WORKDIR /prebuilt
COPY config/ config/
COPY src/accessibilityIndex.jsx src/accessibilityIndex.jsx
COPY src/courseHealthCheckIndex.jsx src/courseHealthCheckIndex.jsx
COPY src/courseOutlineHealthCheckIndex.jsx src/courseOutlineHealthCheckIndex.jsx
COPY src/data/i18n/locales src/data/i18n/locales
COPY src/editImageModalIndex.jsx src/editImageModalIndex.jsx
COPY src/index.jsx src/index.jsx
COPY src/ src/
COPY package.json .
COPY package-lock.json .
RUN npm install

WORKDIR /studio-frontend
Expand Down
25 changes: 14 additions & 11 deletions config/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ const Merge = require('webpack-merge');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const apiEndpoints = require('../src/data/api/endpoints.js');
const commonConfig = require('./webpack.common.config.js');
const apiEndpoints = require('../src/data/api/endpoints');
const commonConfig = require('./webpack.common.config');

const targetUrl = 'http://edx.devstack.studio:18010';
// we should move it to ENV
const targetUrl = 'http://localhost:18010';

module.exports = Merge.smart(commonConfig, {
mode: 'development',
Expand Down Expand Up @@ -45,7 +46,7 @@ module.exports = Merge.smart(commonConfig, {
plugins: () => [
/* eslint-disable global-require */
require('autoprefixer'),
require('../src/utils/matches-prefixer.js'),
require('../src/utils/matches-prefixer'),
require('postcss-pseudo-class-any-link'),
require('postcss-initial')(),
require('postcss-prepend-selector')({ selector: '#root.SFE ' }),
Expand Down Expand Up @@ -109,13 +110,15 @@ module.exports = Merge.smart(commonConfig, {
headers: {
'Access-Control-Allow-Origin': '*',
},
publicPath: 'http://0.0.0.0:18011',
contentBase: './public',
hot: true,
overlay: true,
proxy: Object.keys(apiEndpoints).reduce(
(map, endpoint) => {
map[apiEndpoints[endpoint]] = { // eslint-disable-line no-param-reassign
target: targetUrl,
};
return map;
}, {}),
proxy: Object.keys(apiEndpoints).reduce((map, endpoint) => {
map[apiEndpoints[endpoint]] = { // eslint-disable-line no-param-reassign
target: targetUrl,
};
return map;
}, {}),
},
});
4 changes: 2 additions & 2 deletions config/webpack.prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const path = require('path');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const webpack = require('webpack');

const commonConfig = require('./webpack.common.config.js');
const commonConfig = require('./webpack.common.config');

module.exports = Merge.smart(commonConfig, {
devtool: 'source-map',
Expand Down Expand Up @@ -61,7 +61,7 @@ module.exports = Merge.smart(commonConfig, {
plugins: () => [
/* eslint-disable global-require */
require('autoprefixer'),
require('../src/utils/matches-prefixer.js'),
require('../src/utils/matches-prefixer'),
require('postcss-pseudo-class-any-link'),
require('postcss-initial')(),
require('postcss-prepend-selector')({ selector: '#root.SFE ' }),
Expand Down
Loading

0 comments on commit 410c0e6

Please sign in to comment.