@beemo/driver-eslint
Advanced tools
Comparing version 0.11.0 to 0.12.0
@@ -7,18 +7,2 @@ 'use strict'; | ||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); | ||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
var _inherits2 = require('babel-runtime/helpers/inherits'); | ||
var _inherits3 = _interopRequireDefault(_inherits2); | ||
var _fs = require('fs'); | ||
@@ -46,17 +30,7 @@ | ||
var ESLintDriver = function (_Driver) { | ||
(0, _inherits3.default)(ESLintDriver, _Driver); | ||
class ESLintDriver extends _core.Driver { | ||
constructor(...args) { | ||
var _temp; | ||
function ESLintDriver() { | ||
var _ref; | ||
var _temp, _this, _ret; | ||
(0, _classCallCheck3.default)(this, ESLintDriver); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = ESLintDriver.__proto__ || Object.getPrototypeOf(ESLintDriver)).call.apply(_ref, [this].concat(args))), _this), _this.handleCreateIgnoreFile = function (event, configPath, config) { | ||
return _temp = super(...args), this.handleCreateIgnoreFile = (event, configPath, config) => { | ||
if (config.ignore) { | ||
@@ -67,34 +41,30 @@ if (!Array.isArray(config.ignore)) { | ||
var ignorePath = _path2.default.join(_path2.default.dirname(configPath), '.eslintignore'); | ||
const ignorePath = _path2.default.join(_path2.default.dirname(configPath), '.eslintignore'); | ||
_fs2.default.writeFileSync(ignorePath, config.ignore.join('\n')); | ||
_this.context.configPaths.push(ignorePath); | ||
this.context.configPaths.push(ignorePath); | ||
delete config.ignore; | ||
} | ||
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret); | ||
}, _temp; | ||
} | ||
(0, _createClass3.default)(ESLintDriver, [{ | ||
key: 'bootstrap', | ||
value: function bootstrap() { | ||
this.setMetadata({ | ||
bin: 'eslint', | ||
configName: '.eslintrc.json', | ||
description: 'Lint files with ESLint.', | ||
title: 'ESLint' | ||
}); | ||
bootstrap() { | ||
this.setMetadata({ | ||
bin: 'eslint', | ||
configName: '.eslintrc', | ||
description: 'Lint files with ESLint.', | ||
filterOptions: true, | ||
title: 'ESLint' | ||
}); | ||
this.on('eslint.create-config-file', this.handleCreateIgnoreFile); | ||
} | ||
}, { | ||
key: 'mergeConfig', | ||
value: function mergeConfig(prev, next) { | ||
return _configOps2.default.merge(prev, next); | ||
} | ||
}]); | ||
return ESLintDriver; | ||
}(_core.Driver); | ||
this.on('eslint.create-config-file', this.handleCreateIgnoreFile); | ||
} | ||
mergeConfig(prev, next) { | ||
return _configOps2.default.merge(prev, next); | ||
} | ||
} | ||
exports.default = ESLintDriver; |
{ | ||
"name": "@beemo/driver-eslint", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"description": "ESLint driver for Beemo.", | ||
@@ -23,8 +23,8 @@ "keywords": [ | ||
"devDependencies": { | ||
"eslint": "^4.17.0" | ||
"eslint": "^4.18.2" | ||
}, | ||
"peerDependencies": { | ||
"@beemo/core": "^0.11.0", | ||
"eslint": "^4.10.0" | ||
"@beemo/core": "^0.12.0", | ||
"eslint": "^4.0.0" | ||
} | ||
} |
@@ -13,36 +13,1 @@ # ESLint Driver | ||
``` | ||
## Usage | ||
In your configuration module, install the driver, ESLint, and any plugins. Create a file at | ||
`configs/eslint.js` in which to house your ESLint configuration. | ||
In your consuming project, enable the driver by adding `eslint` to your `drivers` config. | ||
More information on how to get started can be found in the | ||
[official documentation](https://github.com/milesj/beemo). | ||
### Ignoring Paths | ||
Instead of using an `.eslintignore` dotfile, you can define an `ignore` property in your | ||
`configs/eslint.js` file. This property accepts an array of strings. For example: | ||
```bash | ||
# dotfiles/eslintignore | ||
lib/ | ||
*.min.js | ||
*.map | ||
``` | ||
Becomes... | ||
```js | ||
// configs/eslint.js | ||
module.exports = { | ||
// ... | ||
ignore: ['lib/', '*.min.js', '*.map'], | ||
}; | ||
``` | ||
This feature follows the same configuration lifecycle as `.eslintrc`, with the added benefit of | ||
conditional logic, and being generated at runtime! |
3022
57
13