1 | metalsmith-eslint
|
2 | ===============
|
3 | [![Build Status](https://travis-ci.org/ubenzer/metalsmith-eslint.svg?branch=master)](https://travis-ci.org/ubenzer/metalsmith-eslint)
|
4 | [![Dependency Status](https://david-dm.org/ubenzer/metalsmith-eslint.svg)](https://david-dm.org/ubenzer/metalsmith-eslint)
|
5 | [![devDependency Status](https://david-dm.org/ubenzer/metalsmith-eslint/dev-status.svg)](https://david-dm.org/ubenzer/metalsmith-eslint#info=devDependencies)
|
6 |
|
7 | An [Eslint](http://eslint.org/) plugin for Metalsmith.
|
8 |
|
9 | ## Installation
|
10 |
|
11 | ```sh
|
12 | npm install --save metalsmith-eslint
|
13 | ```
|
14 |
|
15 | ## Getting Started
|
16 |
|
17 | If you haven't checked out [Metalsmith](http://metalsmith.io/) before, head over to their website and check out the
|
18 | documentation.
|
19 |
|
20 | ## Usage
|
21 |
|
22 | ```js
|
23 | var eslint = require("metalsmith-elint");
|
24 |
|
25 | metalsmith
|
26 | .use(eslint({
|
27 | src: ["**/*.js", "!**/vendor/**/*.js"],
|
28 | formatter: "unix",
|
29 | eslintConfig: JSON.parse(fs.readFileSync(path.join(process.cwd(), ".eslintrc"), "utf8"))
|
30 | }))
|
31 | ```
|
32 |
|
33 | ## Options
|
34 | You can check the tests out to see some usage examples.
|
35 |
|
36 | ### src
|
37 | A [multimatch](https://www.npmjs.com/package/multimatch) expression that can be used to limit the files that will be eslinted. Default is `["**/*.js"]`
|
38 |
|
39 | ### formatter
|
40 | One of the formatter name that is integrated to eslint. See the list [here](http://eslint.org/docs/developer-guide/nodejs-api#getformatter). Default is `stylish`.
|
41 |
|
42 | ### eslintConfig
|
43 | A valid eslint config that will be passed to eslint. You can also read an `.eslintrc` file and pass the contents to this key directly. **Default none, a configuration is required**
|
44 |
|
45 | To read `.eslintrc` you can use the following: `JSON.parse(fs.readFileSync(path.join(process.cwd(), ".eslintrc"), "utf8"))`
|
46 |
|
47 | ## Contributing
|
48 | Just open an issue or prepare a pull request.
|