Skip to content

Commit

Permalink
Fixed eslint, ordered files
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredsgenkins committed Sep 29, 2022
1 parent 72d33bc commit b20f95b
Show file tree
Hide file tree
Showing 607 changed files with 5,396 additions and 5,447 deletions.
876 changes: 512 additions & 364 deletions build-packages/eslint-config/index.js

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions build-packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@
"access": "public"
},
"dependencies": {
"@scandipwa/eslint-plugin-scandipwa-guidelines": "2.0.36",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"babel-eslint": "^10.1.0",
"eslint-config-airbnb": "^18.2.0",
"@babel/eslint-parser": "^7.19.1",
"@scandipwa/eslint-plugin-scandipwa-guidelines": "^2.0.36",
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-array-func": "^3.1.7",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-fp": "^2.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^22.1.3",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.0.0",
"eslint-plugin-simple-import-sort": "^5.0.3",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.0.4",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^8.0.0",
"typescript": "^4.0.3"
},
"gitHead": "187276597fcf17521bcccdac1238b4e0061e5418"
Expand Down
21 changes: 17 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
"csa": "create-scandipwa-app runtime-packages/csa",
"csa-blank": "create-scandipwa-app runtime-packages/csa-blank --template blank",
"csa-cra": "create-scandipwa-app runtime-packages/csa-cra --template cra",
"postinstall": "lerna bootstrap && lerna run compile",
"postinstall": "lerna bootstrap",
"compile:lockfile": "node build-tasks/compile-lockfile.js"
},
"devDependencies": {
"@scandipwa/eslint-config": "^0.1.6",
"eslint": "^7.11.0",
"eslint": "^8.24.0",
"fs-extra": "^9.0.1",
"husky": "^4.3.0",
"lerna": "^3.22.1",
"fs-extra": "^9.0.1"
"lerna": "^3.22.1"
},
"resolutions": {
"**/@typescript-eslint/eslint-plugin": "^5.26.0",
"**/@typescript-eslint/parser": "^5.26.0"
},
"husky": {
"hooks": {
Expand All @@ -26,7 +30,16 @@
},
"eslintConfig": {
"extends": "@scandipwa",
"parserOptions": {
"requireConfigFile": false,
"project": "./packages/scandipwa/tsconfig.json",
"babelOptions": {
"presets": ["@babel/preset-react"]
}
},
"ignorePatterns": [
"**/.*",
"**/bin/**",
"**/node_modules/**",
"**/Magento_Theme/**",
"**/build/**",
Expand Down
8 changes: 4 additions & 4 deletions packages/bundle-analyzer/build-config/analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { choosePort } = require('react-dev-utils/WebpackDevServerUtils');
module.exports = {
plugin: {
overrideCracoConfig: async ({
cracoConfig
cracoConfig,
}) => {
if (process.env.NODE_ENV === 'production') {
return cracoConfig;
Expand All @@ -16,10 +16,10 @@ module.exports = {

cracoConfig.webpack.plugins.push(new BundleAnalyzerPlugin({
analyzerHost: HOST,
analyzerPort
analyzerPort,
}));

return cracoConfig;
}
}
},
},
};
42 changes: 22 additions & 20 deletions packages/chunk-optimizer/build-config/craco.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

const fetchModuleParent = (issuer) => {
const { type } = issuer;

if (type === 'css/mini-extract') {
const { issuer: parent } = issuer;

return fetchModuleParent(parent);
}

Expand All @@ -29,7 +31,7 @@ const isPlugin = (module) => {
}

const {
_chunks: chunks
_chunks: chunks,
} = fetchModuleParent(module);

// Check if plugin need to go to the main chunk.
Expand Down Expand Up @@ -61,9 +63,9 @@ const isChunkOptimizationDisabled = (module) => {
_chunks: chunks,
issuer: {
_source: {
_value: value
} = {}
}
_value: value,
} = {},
},
} = fetchModuleParent(module);

if (!rawRequest || !chunks || !value) {
Expand Down Expand Up @@ -103,7 +105,7 @@ module.exports = {
filename: 'vendors.[contenthash].js',
priority: 1,
maxInitialRequests: 2, // create only one vendor
minChunks: 1
minChunks: 1,
},
react: {
test(module) {
Expand All @@ -116,39 +118,39 @@ module.exports = {
filename: 'react.[contenthash].js',
priority: 1,
maxInitialRequests: 2,
minChunks: 1
}
}
minChunks: 1,
},
},
};

// Style chunks (SCSS/CSS):
const styleChunks = [{
name: 'main',
match: /\.s?css$/
match: /\.s?css$/,
}, {
name: 'products',
match: /((p|P)roduct).*\.s?css$/
match: /((p|P)roduct).*\.s?css$/,
}, {
name: 'checkout',
match: /((c|C)heckout).*\.s?css$/
match: /((c|C)heckout).*\.s?css$/,
}, {
name: 'cart',
match: /((c|C)art).*\.s?css$/
match: /((c|C)art).*\.s?css$/,
}, {
name: 'widget',
match: /((w|W)idget).*\.s?css$/
match: /((w|W)idget).*\.s?css$/,
}, {
name: 'account',
match: /((a|A)ccount).*\.s?css$/
match: /((a|A)ccount).*\.s?css$/,
}, {
name: 'category',
match: /((c|C)ategory).*\.s?css$/
match: /((c|C)ategory).*\.s?css$/,
}, {
name: 'misc',
match: /(store|query|util)[\\/].*\.s?css$/
match: /(store|query|util)[\\/].*\.s?css$/,
}, {
name: 'wishlist',
match: /((w|W)ish).*\.s?css$/
match: /((w|W)ish).*\.s?css$/,
}];

styleChunks.forEach(({ name, match }, index) => {
Expand All @@ -175,11 +177,11 @@ module.exports = {
chunks: 'all',
priority: styleChunks.length - index,
reuseExistingChunk: true,
enforce: true
enforce: true,
};
});

return webpackConfig;
}
}
},
},
};
4 changes: 2 additions & 2 deletions packages/framework/src/component/App/App.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class AppComponent extends PureComponent {
static propTypes = {
errorDetails: ErrorDetailsType.isRequired,
isSomethingWentWrong: PropTypes.bool.isRequired,
handleErrorReset: PropTypes.func.isRequired
handleErrorReset: PropTypes.func.isRequired,
};

rootComponents = [];
Expand All @@ -34,7 +34,7 @@ export class AppComponent extends PureComponent {
renderSomethingWentWrong() {
const {
handleErrorReset,
errorDetails
errorDetails,
} = this.props;

return (
Expand Down
24 changes: 12 additions & 12 deletions packages/framework/src/component/App/App.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,30 @@ import App from './App.component';
export class AppContainer extends PureComponent {
productionFunctions = [
this.disableReactDevTools.bind(this),
this.injectComment.bind(this)
this.injectComment.bind(this),
];

developmentFunctions = [];

state = {
isSomethingWentWrong: false,
errorDetails: {}
errorDetails: {},
};

containerFunctions = {
handleErrorReset: this.handleErrorReset.bind(this)
handleErrorReset: this.handleErrorReset.bind(this),
};

__construct(props) {
super.__construct(props);

this.configureAppBasedOnEnvironment();
}

componentDidCatch(err, info) {
this.setState({
isSomethingWentWrong: true,
errorDetails: { err, info }
errorDetails: { err, info },
});
}

Expand All @@ -34,21 +40,15 @@ export class AppContainer extends PureComponent {
containerProps() {
const {
isSomethingWentWrong,
errorDetails
errorDetails,
} = this.state;

return {
isSomethingWentWrong,
errorDetails
errorDetails,
};
}

__construct(props) {
super.__construct(props);

this.configureAppBasedOnEnvironment();
}

injectComment() {
const comment = document.createComment('Powered by ScandiPWA (scandipwa.com)');
document.querySelector('html').appendChild(comment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ export class SomethingWentWrongComponent extends PureComponent {
static propTypes = {
onClick: PropTypes.func.isRequired,
trace: PropTypes.string,
error: PropTypes.string
error: PropTypes.string,
};

static defaultProps = {
trace: '',
error: ''
error: '',
};

renderAction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import SomethingWentWrong from './SomethingWentWrong.component';
export class SomethingWentWrongContainer extends PureComponent {
static propTypes = {
onClick: PropTypes.func.isRequired,
errorDetails: ErrorDetailsType.isRequired
errorDetails: ErrorDetailsType.isRequired,
};

containerFunctions = {};
Expand All @@ -20,7 +20,7 @@ export class SomethingWentWrongContainer extends PureComponent {
return {
onClick,
trace,
error
error,
};
}

Expand All @@ -29,14 +29,14 @@ export class SomethingWentWrongContainer extends PureComponent {
errorDetails: {
err,
info: {
componentStack
} = {}
}
componentStack,
} = {},
},
} = this.props;

return {
error: err.toString(),
trace: componentStack
trace: componentStack,
};
}

Expand Down
8 changes: 5 additions & 3 deletions packages/m2-theme/build-config/craco.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-param-reassign, global-require */
const path = require('path');
const FallbackPlugin = require('@scandipwa/webpack-fallback-plugin');
// eslint-disable-next-line import/no-extraneous-dependencies
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { getLoader, loaderByName } = require('@scandipwa/craco');

Expand All @@ -10,7 +11,7 @@ const isMagento = process.env.BUILD_MODE === 'magento';
module.exports = {
plugin: {
overrideCracoConfig: ({
cracoConfig
cracoConfig,
}) => {
if (!isMagento) {
return cracoConfig;
Expand Down Expand Up @@ -40,6 +41,7 @@ module.exports = {

try {
// Optional dependency (if the @scandipwa/service-worker is installed)
// eslint-disable-next-line import/no-extraneous-dependencies
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');

// Yes, another loop, but it is more readable
Expand Down Expand Up @@ -78,6 +80,6 @@ module.exports = {
devServerConfig.writeToDisk = true;

return devServerConfig;
}
}
},
},
};
3 changes: 2 additions & 1 deletion packages/m2-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"license": "OSL-3.0",
"dependencies": {
"@scandipwa/craco": "0.1.1",
"@scandipwa/webpack-fallback-plugin": "^1.2.5"
"@scandipwa/webpack-fallback-plugin": "^1.2.5",
"@scandipwa/scandipwa-dev-utils": "0.1.14"
},
"scandipwa": {
"type": "extension",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ module.exports = {
);

return cracoConfig;
}
}
},
},
};
Loading

0 comments on commit b20f95b

Please sign in to comment.