Skip to content
This repository has been archived by the owner on Dec 6, 2021. It is now read-only.

Commit

Permalink
feat(eslint): Pass loaderOptions to eslint-loader (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimyr committed Apr 30, 2020
1 parent 823c0c2 commit 9401965
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 9 additions & 0 deletions plugins/eslint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ module.exports = {
```

Now ESLint will check your JS files at compile time.


## Options

### loaderOptions

- Type: `any`

Addtional [options](https://github.com/webpack-contrib/eslint-loader#options) for `eslint-loader`.
9 changes: 5 additions & 4 deletions plugins/eslint/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exports.name = 'eslint'

exports.apply = api => {
exports.apply = (api, options = {}) => {
api.hook('createWebpackChain', config => {
const { cacheIdentifier } = api.getCacheConfig('eslint-loader', {}, [
'.eslintrc.js',
Expand All @@ -19,10 +19,11 @@ exports.apply = api => {
.use('eslint-loader')
.loader(require.resolve('eslint-loader'))
.options({
cache: api.config.cache,
cacheKey: cacheIdentifier,
formatter: require('eslint/lib/formatters/codeframe'),
eslintPath: api.localResolve('eslint') || require.resolve('eslint')
eslintPath: api.localResolve('eslint') || require.resolve('eslint'),
...options.loaderOptions,
cache: api.config.cache,
cacheKey: cacheIdentifier
})
})
}

0 comments on commit 9401965

Please sign in to comment.