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

Support for ESLint #254

Merged
merged 8 commits into from
Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ Check out the [sample app](./packages/sample-app) to see a webpack config in act
- [babel](./packages/babel)
- [dev-server](./packages/dev-server)
- [elm](./packages/elm)
- [eslint](./packages/eslint)
- [extract-text](./packages/extract-text)
- [postcss](./packages/postcss)
- [sass](./packages/sass)
Expand Down
5 changes: 5 additions & 0 deletions packages/eslint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @webpack-blocks/eslint - Changelog

## Next release
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case we can enter the version number already, since we will publish right away.


Initial release.
35 changes: 35 additions & 0 deletions packages/eslint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# webpack-blocks - TSLint
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy 🍝 - needs to be ESLint as well 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks :) These packages are very similar, so I've decided to copy files from the tslint block.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that's how I would have done as well 😉


[![Gitter chat](https://badges.gitter.im/webpack-blocks.svg)](https://gitter.im/webpack-blocks)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
[![NPM Version](https://img.shields.io/npm/v/@webpack-blocks/eslint.svg)](https://www.npmjs.com/package/@webpack-blocks/eslint)

This is the `eslint` block providing JavaScript linting support for webpack. Uses `eslint` via `eslint-loader`.


## Usage

```js
const { createConfig } = require('@webpack-blocks/webpack')
const eslint = require('@webpack-blocks/eslint')

module.exports = createConfig([
eslint(/* eslint options */)
])
```

Use `match()` to explicitly specify the files to lint.


## Options

You can pass any `eslint-loader` options as an object to the `eslint` block. See [eslint-loader options](https://github.com/webpack-contrib/eslint-loader#options).


## webpack-blocks

Check out the

👉 [Main documentation](https://github.com/andywer/webpack-blocks)

Released under the terms of the MIT license.
26 changes: 26 additions & 0 deletions packages/eslint/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* ESLint webpack block.
*
* @see https://github.com/webpack-contrib/eslint-loader
*/

module.exports = eslint

/**
* @param {object} [options] See https://github.com/webpack-contrib/eslint-loader#options
* @return {Function}
*/
function eslint (options = {}) {
return (context, util) =>
util.addLoader(
Object.assign(
{
test: /\.(js|jsx)$/,
use: ['eslint-loader'],
enforce: 'pre',
options
},
context.match
)
)
}
27 changes: 27 additions & 0 deletions packages/eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@webpack-blocks/eslint",
"version": "1.0.0-rc",
"description": "Webpack block for JavaScript linting.",
"main": "index.js",
"license": "MIT",
"author": "Dmytro Meleshko <dmytro.meleshko@gmail.com>",
"scripts": {
"test": "standard",
"prepublishOnly": "npm test"
},
"engines": {
"node": ">= 6.0"
},
"keywords": [
"webpack",
"webpack-blocks"
],
"repository": "andywer/webpack-blocks",
"bugs": "https://github.com/andywer/webpack-blocks/issues",
"dependencies": {
"eslint-loader": "^1.9.0"
},
"peerDependencies": {
"@webpack-blocks/core": "^1.0.0-rc"
}
}