Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom webpack.config linting #90

Closed
stewartduffy opened this issue Apr 10, 2016 · 4 comments
Closed

Custom webpack.config linting #90

stewartduffy opened this issue Apr 10, 2016 · 4 comments

Comments

@stewartduffy
Copy link
Contributor

Has anyone had any using eslint-loader in the custom webpack.config? I have the following set up, however eslint-loader is not running

const path = require('path')

module.exports = {
  module: {
    preLoaders: [
      {
        test: /\.js$/,
        loader: 'eslint-loader',
        include: path.resolve(__dirname, '../'),
        exclude: path.resolve(__dirname, '../node_modules/')
      }
    ],
    loaders: [
      {
        test: /\.css?$/,
        loaders: [ 'style', 'raw' ],
        include: path.resolve(__dirname, '../')
      }
    ]
  }
}
@arunoda
Copy link
Member

arunoda commented Apr 10, 2016

May be it cant read the .eslintrc this way. See if you can can pass that in a different way.

@psimyn
Copy link
Member

psimyn commented Apr 12, 2016

@stewartduffy you can try passing the .eslintrc location explicitly

module.exports = {
  eslint: {
    configFile: '../.eslintrc'
  },
  module: {
    preLoaders: [
      {
        test: /\.js$/,
        loader: 'eslint-loader',
        include: path.resolve(__dirname, '../'),
        exclude: path.resolve(__dirname, '../node_modules/')
      }
    ],
  etc...

@stewartduffy
Copy link
Contributor Author

OK so looks like it is an issue with webpack preLoaders rather than eslint-loader.
This config works:

const path = require('path')

module.exports = {
  module: {
    loaders: [
      {
        test: /\.js$/,
        loaders: [ 'eslint-loader' ],
        include: path.resolve(__dirname, '../components/'),
        exclude: /node_modules/
      },
      {
        test: /\.css?$/,
        loaders: [ 'style', 'raw', 'eslint-loader' ],
        include: path.resolve(__dirname, '../')
      }
    ]
  }
}

this config does not work:

const path = require('path')

module.exports = {
  module: {
    preLoaders: [
      {
        test: /\.js$/,
        loaders: [ 'eslint-loader' ],
        include: path.resolve(__dirname, '../components/'),
        exclude: /node_modules/
      }
    ],
    loaders: [
      {
        test: /\.css?$/,
        loaders: [ 'style', 'raw', 'eslint-loader' ],
        include: path.resolve(__dirname, '../')
      }
    ]
  }
}

@stewartduffy
Copy link
Contributor Author

Looked into this more, can confirm that ti does not support preLoaders. Have made a PR #107 to add support for this.

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

No branches or pull requests

3 participants