Skip to content

Instantly share code, notes, and snippets.

@ravasthi
Last active May 2, 2018 03:06
Show Gist options
  • Save ravasthi/abcfee465411fc45a8bc28decb9d8e5e to your computer and use it in GitHub Desktop.
Save ravasthi/abcfee465411fc45a8bc28decb9d8e5e to your computer and use it in GitHub Desktop.
eslint-plugin-import issue 238 configuration
{
"parser": "babel-eslint",
"extends": "airbnb",
"plugins": [
"babel",
"import",
"react"
],
"rules": {
"indent": ["error", 4],
"sort-imports": ["error", {
"ignoreCase": true
}],
"no-underscore-dangle": ["error", {
"allowAfterThis": true
}]
},
"settings" : {
"import/resolver": {
"webpack": {
"config": "webpack.config.js"
}
}
},
"env": {
"mocha": true,
"jquery": true
},
"globals": {
"chai": true,
"sinon": true
}
}
/* abbreviated */
{
"engines": {
"node": ">= 5.11.0"
},
"main": "index.js",
"scripts": {
"test": "gulp test"
},
"dependencies": {
"babel-core": "~6.7.7",
"babel-eslint": "~6.0.4",
"babel-loader": "~6.2.4",
"babel-polyfill": "~6.7.4",
"babel-preset-airbnb": "^1.1.1",
"babel-preset-es2015": "~6.6.0",
"babel-preset-react": "~6.5.0",
"babel-preset-stage-0": "~6.5.0",
"babel-register": "~6.7.2",
"babel-relay-plugin": "~0.8.1",
"babel-relay-plugin-loader": "~0.8.0",
"eslint": "~2.9.0",
"eslint-config-airbnb": "~8.0.0",
"eslint-import-resolver-webpack": "~0.2.4",
"eslint-plugin-babel": "~3.2.0",
"eslint-plugin-import": "~1.6.1",
"eslint-plugin-jsx-a11y": "~1.0.4",
"eslint-plugin-react": "~5.0.1",
"estraverse": "~4.2.0",
"estraverse-fb": "~1.3.1",
"karma": "=0.13.18",
"karma-babel-preprocessor": "~6.0.1",
"karma-sourcemap-loader": "~0.3.7",
"karma-webpack": "~1.7.0",
"webpack": "~1.13.0",
"webpack-stream": "~3.2.0",
}
}
import path from 'path';
import webpack from 'webpack';
const webpackConfig = {
entry: {
app: path.resolve(__dirname, 'public', 'app.js'),
'app-header': path.resolve(__dirname, 'public', 'app-header.js'),
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
},
{
test: /\.svg$/,
include: [
path.resolve(__dirname, 'public', 'images'),
],
exclude: /(node_modules|bower_components)/,
loader: 'svg-inline',
},
],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, '.build'),
},
plugins: [
new webpack.ResolverPlugin(
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin(
'bower.json', ['main']
)
),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.$': 'jquery',
'window.jQuery': 'jquery',
}),
],
resolve: {
root: [
path.resolve(__dirname),
],
alias: {
charts: 'public/charts',
components: 'public/components',
jquery: 'jquery/dist/jquery.slim',
uikit: 'uikit/js/uikit',
},
modulesDirectories: [
'bower_components',
'node_modules',
'web_modules',
],
},
};
export { webpackConfig };
@benmosher
Copy link

Ah, yeah: the config needs to be the module.exports.

@ravasthi
Copy link
Author

ravasthi commented May 3, 2016

Okay, explicitly doing a module.exports = webpackConfig fixes this issue for me. Thanks for looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment