Lint webpack config
This commit is contained in:
parent
de102e2323
commit
7c92149066
6 changed files with 28 additions and 16 deletions
10
.eslintrc.js
10
.eslintrc.js
|
@ -14,5 +14,13 @@ module.exports = {
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'prettier/prettier': 'error'
|
'prettier/prettier': 'error'
|
||||||
}
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['config/webpack/*.js'],
|
||||||
|
env: {
|
||||||
|
node: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||||
|
|
||||||
const environment = require('./environment')
|
const environment = require('./environment');
|
||||||
|
|
||||||
module.exports = environment.toWebpackConfig()
|
module.exports = environment.toWebpackConfig();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { environment } = require('@rails/webpacker')
|
const { environment } = require('@rails/webpacker');
|
||||||
|
|
||||||
// By default don't transpile JS files in ./node_modules – except for some specific modules.
|
// By default don't transpile JS files in ./node_modules – except for some specific modules.
|
||||||
const babelLoader = environment.loaders.get('babel');
|
const babelLoader = environment.loaders.get('babel');
|
||||||
|
@ -6,8 +6,12 @@ babelLoader.exclude = function(modulePath) {
|
||||||
let forcedModules = [
|
let forcedModules = [
|
||||||
'activestorage' // ActiveStorage uses 'class', which is not supported by IE 11 and older Safari version
|
'activestorage' // ActiveStorage uses 'class', which is not supported by IE 11 and older Safari version
|
||||||
];
|
];
|
||||||
return modulePath.includes('node_modules')
|
return (
|
||||||
&& forcedModules.every(forcedModule => !modulePath.includes('node_modules/' + forcedModule));
|
modulePath.includes('node_modules') &&
|
||||||
}
|
forcedModules.every(
|
||||||
|
forcedModule => !modulePath.includes('node_modules/' + forcedModule)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = environment
|
module.exports = environment;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
|
||||||
|
|
||||||
const environment = require('./environment')
|
const environment = require('./environment');
|
||||||
|
|
||||||
// https://github.com/rails/webpacker/issues/1235
|
// https://github.com/rails/webpacker/issues/1235
|
||||||
environment.config.optimization.minimizer[0].options.uglifyOptions.ecma = 5; // for IE 11 support
|
environment.config.optimization.minimizer[0].options.uglifyOptions.ecma = 5; // for IE 11 support
|
||||||
environment.config.optimization.minimizer[0].options.uglifyOptions.safari10 = true;
|
environment.config.optimization.minimizer[0].options.uglifyOptions.safari10 = true;
|
||||||
|
|
||||||
module.exports = environment.toWebpackConfig()
|
module.exports = environment.toWebpackConfig();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||||
|
|
||||||
const environment = require('./environment')
|
const environment = require('./environment');
|
||||||
|
|
||||||
module.exports = environment.toWebpackConfig()
|
module.exports = environment.toWebpackConfig();
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
"webpack-dev-server": "^3.1.4"
|
"webpack-dev-server": "^3.1.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint:js": "eslint ./app/javascript"
|
"lint:js": "eslint ./app/javascript ./config/webpack"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "6.* || 8.* || >= 10.*"
|
"node": "6.* || 8.* || >= 10.*"
|
||||||
|
|
Loading…
Reference in a new issue