UNPKG

1.89 kBMarkdownView Raw
1metalsmith-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
7An [Eslint](http://eslint.org/) plugin for Metalsmith.
8
9## Installation
10
11```sh
12npm install --save metalsmith-eslint
13```
14
15## Getting Started
16
17If you haven't checked out [Metalsmith](http://metalsmith.io/) before, head over to their website and check out the
18documentation.
19
20## Usage
21
22```js
23var eslint = require("metalsmith-elint");
24
25metalsmith
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
34You can check the tests out to see some usage examples.
35
36### src
37A [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
40One 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
43A 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
45To read `.eslintrc` you can use the following: `JSON.parse(fs.readFileSync(path.join(process.cwd(), ".eslintrc"), "utf8"))`
46
47## Contributing
48Just open an issue or prepare a pull request.