Skip to content

Commit

Permalink
Merge pull request #17434 from PierreRambaud/update/eslint-directories
Browse files Browse the repository at this point in the history
Update eslint config to check for hidden directories and files
  • Loading branch information
matks committed Jan 31, 2020
2 parents b11d5ec + 3d54e6f commit e91fcec
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 27 deletions.
2 changes: 2 additions & 0 deletions admin-dev/themes/new-theme/.eslintignore
Expand Up @@ -2,3 +2,5 @@
/public/
/bundle.js
/tests/
!.eslintrc.js
!.webpack
23 changes: 16 additions & 7 deletions admin-dev/themes/new-theme/.eslintrc.js
Expand Up @@ -19,35 +19,44 @@ module.exports = {
},
extends: [
'prestashop',
'plugin:vue/strongly-recommended'
'plugin:vue/strongly-recommended',
],
plugins: [
'import',
'vue',
],
rules: {
'no-new': 0,
'class-methods-use-this': 0,
'func-names': 0,
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'tests/**/*.js',
'.webpack/**/*.js',
],
},
],
'max-len': ['error', {code: 120}],
'no-alert': 0,
'no-bitwise': 0,
'class-methods-use-this': 0,
'max-len': ['error', { code: 120 }],
'no-param-reassign': ['error', { props: false }],
'prefer-destructuring': ['error', {object: true, array: false}],
'no-new': 0,
'no-param-reassign': ['error', {props: false}],
'no-restricted-globals': [
'error',
{
name: 'global',
message: 'Use window variable instead.',
},
],
'prefer-destructuring': ['error', {object: true, array: false}],
'vue/script-indent': [
'error',
2,
{
baseIndent: 1,
switchCase: 1,
}
},
],
},
settings: {
Expand Down
8 changes: 3 additions & 5 deletions admin-dev/themes/new-theme/.webpack/common.js
Expand Up @@ -22,13 +22,11 @@
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const cssExtractedFileName = 'theme';

module.exports = {
externals: {
Expand Down Expand Up @@ -231,15 +229,15 @@ module.exports = {
new ExtractTextPlugin('theme.css'),
new CleanWebpackPlugin(['public'], {
root: path.resolve(__dirname, '../'),
exclude: ['theme.rtlfix']
exclude: ['theme.rtlfix'],
}),
new webpack.ProvidePlugin({
moment: 'moment', // needed for bootstrap datetime picker
$: 'jquery', // needed for jquery-ui
jQuery: 'jquery',
}),
new CopyPlugin([
{ from: 'static' },
])
{from: 'static'},
]),
],
};
4 changes: 2 additions & 2 deletions admin-dev/themes/new-theme/.webpack/dev.js
Expand Up @@ -6,7 +6,7 @@ const common = require('./common.js');
* by merging development specific configuration with the common one.
*/
function devConfig() {
let dev = Object.assign(
const dev = Object.assign(
common,
{
devtool: 'inline-source-map',
Expand All @@ -15,7 +15,7 @@ function devConfig() {
contentBase: path.resolve(__dirname, '/../public'),
publicPath: '/',
},
}
},
);

return dev;
Expand Down
22 changes: 10 additions & 12 deletions admin-dev/themes/new-theme/.webpack/prod.js
@@ -1,40 +1,38 @@
const common = require('./common.js');
const webpack = require('webpack');
const keepLicense = require('uglify-save-license');
const common = require('./common.js');

/**
* Returns the production webpack config,
* by merging production specific configuration with the common one.
*
* @param {Boolean} analyze If true, bundle analyze plugin will launch
*/
function prodConfig(analyze) {
let prod = Object.assign(
function prodConfig() {
const prod = Object.assign(
common,
{
stats: 'minimal',
}
},
);

prod.plugins.push(
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
uglifyOptions: {
compress: {
drop_console: true
drop_console: true,
},
output: {
comments: keepLicense
}
comments: keepLicense,
},
},
})
}),
);

// Required for Vue production environment
prod.plugins.push(
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
})
'process.env.NODE_ENV': JSON.stringify('production'),
}),
);

return prod;
Expand Down
1 change: 0 additions & 1 deletion admin-dev/themes/new-theme/webpack.config.js
Expand Up @@ -27,7 +27,6 @@
/**
* Three mode available:
* build = production mode
* build:analyze = production mode with bundler analyzer
* dev = development mode
*/
const prod = require('./.webpack/prod.js');
Expand Down

0 comments on commit e91fcec

Please sign in to comment.