-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from Turbo87/backport
Backport commits from master to 2.x
- Loading branch information
Showing
16 changed files
with
148 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
extends: 'eslint:recommended', | ||
parserOptions: { | ||
ecmaVersion: 6 | ||
}, | ||
env: { | ||
node: true | ||
}, | ||
rules: { | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,96 @@ | ||
# [broccoli](https://github.com/joliss/broccoli)-lint-eslint | ||
# broccoli-lint-eslint | ||
|
||
[![build status](https://secure.travis-ci.org/jonathanKingston/broccoli-lint-eslint.svg)](http://travis-ci.org/jonathanKingston/broccoli-lint-eslint) | ||
[![npm status](http://img.shields.io/npm/v/broccoli-lint-eslint.svg)](https://www.npmjs.org/package/broccoli-lint-eslint) | ||
[![dependency status](https://david-dm.org/jonathanKingston/broccoli-lint-eslint.svg)](https://david-dm.org/jonathanKingston/broccoli-lint-eslint) | ||
[![Latest NPM release][npm-badge]][npm-badge-url] | ||
[![TravisCI Build Status][travis-badge]][travis-badge-url] | ||
[![License][license-badge]][license-badge-url] | ||
[![Dependencies][dependencies-badge]][dependencies-badge-url] | ||
[![Dev Dependencies][devDependencies-badge]][devDependencies-badge-url] | ||
|
||
|
||
> Lint JavaScript with [ESLint][eslint] as part of your [Broccoli][broccoli] build pipeline. | ||
> Lint JavaScript using [Eslint](http://eslint.org/) | ||
|
||
This is a fork of [makepanic/broccoli-eslint](https://github.com/makepanic/broccoli-eslint) used to add new features and keep up to date with the latest ESLint. This fork may go away however it will track any API changes made to it's fork as long as possible. | ||
Most of the test setup and the build configuration is based on [sindresorhus/grunt-eslint](https://github.com/sindresorhus/grunt-eslint). | ||
The internal validation is heavily inspired by [eslint cli.js](https://github.com/eslint/eslint/blob/master/lib/cli.js) | ||
The internal validation is heavily inspired by [eslint cli.js](https://github.com/eslint/eslint/blob/master/lib/cli.js). | ||
|
||
## Install | ||
## Installation | ||
|
||
```bash | ||
npm install --save broccoli-lint-eslint | ||
npm install broccoli-lint-eslint@2 | ||
``` | ||
|
||
## Example | ||
## Usage | ||
|
||
Note: The API will change in subsequent 0.x versions. | ||
|
||
```js | ||
```javascript | ||
var eslint = require('broccoli-lint-eslint'); | ||
tree = eslint(tree, options); | ||
var outputNode = eslint(inputNode, options); | ||
``` | ||
|
||
## API | ||
|
||
### eslint(tree, options) | ||
### API | ||
|
||
#### options | ||
* `inputNode` A [Broccoli node](https://github.com/broccolijs/broccoli/blob/master/docs/node-api.md) | ||
|
||
##### format | ||
* `options` {Object} | ||
* `format` {string|function}: The path, or function reference, to a custom formatter (See [eslint/tree/master/lib/formatters](https://github.com/eslint/eslint/tree/master/lib/formatters) for alternatives). | ||
|
||
Type: `String` | ||
Default: `'eslint/lib/formatters/stylish'` | ||
Default: `'eslint/lib/formatters/stylish'` | ||
|
||
Path path to a custom formatter (See [eslint/tree/master/lib/formatters](https://github.com/eslint/eslint/tree/master/lib/formatters) for alternatives). | ||
* `testGenerator` {`string|function(relativePath, errors), returns reporter output string`}: The function used to generate test modules. You can provide a custom function for your client side testing framework of choice. | ||
|
||
##### testGenerator | ||
Default: `null` | ||
|
||
Type: `function` or `string` | ||
Default: `null` | ||
If you provide a `string` one of the [predefined test generators](lib/test-generators.js) is used. Currently supported are `qunit` and `mocha`. | ||
|
||
The function used to generate test modules. You can provide a custom function for your client side testing framework of choice. | ||
Example usage: | ||
|
||
The function receives the following arguments: | ||
```javascript | ||
var path = require('path'); | ||
|
||
- relativePath - The relative path to the file being tested. | ||
- errors - An array of eslint error objects found. | ||
function testGenerator(relativePath, errors) { | ||
return "module('" + path.dirname(relativePath) + "');\n"; | ||
"test('" + relativePath + "' should pass ESLint', function() {\n" + | ||
" ok(" + passed + ", '" + moduleName + " should pass ESLint." + (errors ? "\\n" + errors : '') + "');\n" + | ||
"});\n"; | ||
}; | ||
|
||
If you provide a `string` one of the [predefined test generators](lib/test-generators.js) is used. Currently supported are `qunit` and `mocha`. | ||
|
||
Example usage: | ||
``` | ||
var path = require('path'); | ||
function testGenerator(relativePath, errors) { | ||
return "module('" + path.dirname(relativePath) + "');"; | ||
"test('" + relativePath + "' should pass ESLint', function() { " + | ||
" ok(" + passed + ", " + moduleName + " should pass ESLint." + (errors ? "\n" + errors : '')); " + | ||
"}); | ||
}; | ||
return eslint(tree, { | ||
options: { | ||
configFile: this.jshintrc.app + '/eslint.json', | ||
rulesdir: this.jshintrc.app | ||
}, | ||
testGenerator: testGenerator | ||
}); | ||
``` | ||
return eslint(inputNode, { | ||
options: { | ||
configFile: this.jshintrc.app + '/eslint.json', | ||
rulesdir: this.jshintrc.app | ||
}, | ||
testGenerator: testGenerator | ||
}); | ||
``` | ||
|
||
##### throwOnError | ||
* `throwOnError` {boolean}: Cause exception error on first severe error. | ||
|
||
Type: `Boolean` | ||
Default: `false` | ||
|
||
Cause exception error on first severe error | ||
* `options` {options}: [Options native to ESLint CLI](http://eslint.org/docs/developer-guide/nodejs-api#cliengine) that `broccoli-lint-eslint` makes use of: | ||
|
||
##### options | ||
Options native to ESLint CLI: [CLIEngine options](http://eslint.org/docs/developer-guide/nodejs-api#cliengine) | ||
* `configFile` {string}: Path to eslint configuration file. | ||
|
||
###### configFile | ||
Default: `./eslintrc` | ||
|
||
Type: `String` | ||
Default: `./.eslintrc` | ||
* `rulePaths` {Array}: Paths to a directory with custom rules. Your custom rules will be used in addition to the built-in ones. Recommended read: [Working with Rules](https://github.com/eslint/eslint/blob/master/docs/developer-guide/working-with-rules.md). | ||
|
||
Path to eslint configuration file. | ||
Default: [built-in rules directory](https://github.com/eslint/eslint/tree/master/lib/rules) | ||
|
||
###### rulePaths | ||
* `ignore` {boolean}: `false` disables use of `.eslintignore`, `ignorePath` and `ignorePattern` | ||
|
||
Type: `Array` | ||
Default: [built-in rules directory](https://github.com/eslint/eslint/tree/master/lib/rules) | ||
Default: `true` | ||
|
||
Paths to a directory with custom rules. Your custom rules will be used in addition to the built-in ones. | ||
[eslint]: http://eslint.org/ | ||
[broccoli]: https://github.com/joliss/broccoli | ||
|
||
Recommended read: [Working with Rules](https://github.com/eslint/eslint/blob/master/docs/developer-guide/working-with-rules.md) | ||
<!-- Badging --> | ||
[npm-badge]: https://img.shields.io/npm/v/broccoli-lint-eslint.svg | ||
[npm-badge-url]: https://www.npmjs.com/package/broccoli-lint-eslint | ||
[travis-badge]: https://img.shields.io/travis/ember-cli/broccoli-lint-eslint/2.x.svg?label=TravisCI | ||
[travis-badge-url]: https://travis-ci.org/ember-cli/broccoli-lint-eslint | ||
[license-badge]: https://img.shields.io/npm/l/broccoli-lint-eslint.svg | ||
[license-badge-url]: LICENSE.md | ||
[dependencies-badge]: https://img.shields.io/david/ember-cli/broccoli-lint-eslint.svg | ||
[dependencies-badge-url]: https://david-dm.org/ember-cli/broccoli-lint-eslint | ||
[devDependencies-badge]: https://img.shields.io/david/dev/ember-cli/broccoli-lint-eslint.svg | ||
[devDependencies-badge-url]: https://david-dm.org/ember-cli/broccoli-lint-eslint#info=devDependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
extends: 'eslint:recommended', | ||
rules: { | ||
'no-console': 'off', | ||
quotes: ['warn', 'double'] | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
env: { | ||
mocha: true | ||
}, | ||
globals: { | ||
chai: false, | ||
expect: false | ||
}, | ||
rules: { | ||
'no-invalid-this': 'off', | ||
'arrow-body-style': ['off', "as-needed"] | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
env: { | ||
mocha: true | ||
}, | ||
globals: { | ||
chai: false, | ||
expect: false | ||
}, | ||
rules: { | ||
'quotes': 'off', | ||
'no-invalid-this': 'off', | ||
'arrow-body-style': ['off', "as-needed"] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.