standard-engine
Advanced tools
Comparing version 6.0.0 to 7.0.0
@@ -96,9 +96,3 @@ #!/usr/bin/env node | ||
stdinText = text | ||
var result | ||
try { | ||
result = standard.lintText(text, lintOpts) | ||
} catch (err) { | ||
return onResult(err) | ||
} | ||
onResult(null, result) | ||
standard.lintText(text, lintOpts, onResult) | ||
}) | ||
@@ -105,0 +99,0 @@ } else { |
@@ -5,2 +5,65 @@ # standard-engine Change Log | ||
## 7.0.0 - 2017-04-04 | ||
- BREAKING: rename the synchronous `lintText` method to `lintTextSync` | ||
- Add an asyncronous `lintText` method (that just calls `lintTextSync` internally) | ||
This effectively undoes the breaking change introduced in 6.0.0, making it safe to | ||
upgrade from `standard-engine` 5.x to 7.x without introducing any breaking changes. | ||
Related issues: | ||
- https://github.com/feross/standard/issues/807 | ||
- https://github.com/Flet/standard-engine/issues/156 | ||
## 6.0.0 - 2017-02-20 | ||
- BREAKING: make `lintText` into a sync method | ||
Before: `standardEngine.lintText(text, [opts], callback)` | ||
After: `results = standardEngine.lintText(text, [opts])` | ||
If an error occurs, an exception is thrown. Otherwise, a `results` object is | ||
returned. | ||
## 5.4.0 - 2017-02-08 | ||
- Replace find-root and pkg-config by pkg-conf | ||
- Support parseOpts() option | ||
- Improve help message | ||
- add missing ignored files | ||
- add note about .gitignore files | ||
- Prevent package.json `parser` option from overriding explicit option | ||
## 5.3.0 - 2016-11-23 | ||
- Resolve ignore options in standard-engine, not deglob | ||
## 5.2.0 - 2016-11-22 | ||
- Support filename option in lintText() | ||
- Update dependencies | ||
## 5.1.1 - 2016-10-11 | ||
- Fix crash when 'stdin' and 'fix' options are used on code with no errors | ||
## 5.1.0 - 2016-08-19 | ||
- Add ESLint `cache` option | ||
## 5.0.3 - 2016-08-18 | ||
- Remove unneeded `xtend`, `defaults`, `multiline` dependencies | ||
- Re-order help commands | ||
## 5.0.2 - 2016-08-12 | ||
- Clarify it's only *some* problems that get fixed | ||
## 5.0.1 - 2016-08-12 | ||
- Only recommend `--fix` when fixable rules are present | ||
## 5.0.0 - 2016-08-10 | ||
@@ -7,0 +70,0 @@ |
19
index.js
@@ -6,6 +6,8 @@ module.exports.cli = require('./bin/cmd') | ||
var deglob = require('deglob') | ||
var homeOrTmp = require('home-or-tmp') | ||
var os = require('os') | ||
var path = require('path') | ||
var pkgConf = require('pkg-conf') | ||
var HOME_OR_TMP = os.homedir() || os.tmpdir() | ||
var DEFAULT_PATTERNS = [ | ||
@@ -36,3 +38,3 @@ '**/*.js', | ||
cache: true, | ||
cacheLocation: path.join(homeOrTmp, '.standard-cache/'), | ||
cacheLocation: path.join(HOME_OR_TMP, '.standard-cache/'), | ||
envs: [], | ||
@@ -59,3 +61,3 @@ fix: false, | ||
*/ | ||
Linter.prototype.lintText = function (text, opts) { | ||
Linter.prototype.lintTextSync = function (text, opts) { | ||
opts = this.parseOpts(opts) | ||
@@ -65,2 +67,13 @@ return new this.eslint.CLIEngine(opts.eslintConfig).executeOnText(text, opts.filename) | ||
Linter.prototype.lintText = function (text, opts, cb) { | ||
if (typeof opts === 'function') return this.lintText(text, null, opts) | ||
var result | ||
try { | ||
result = this.lintTextSync(text, opts) | ||
} catch (err) { | ||
return process.nextTick(cb, err) | ||
} | ||
process.nextTick(cb, null, result) | ||
} | ||
/** | ||
@@ -67,0 +80,0 @@ * Lint files to enforce JavaScript Style. |
{ | ||
"name": "standard-engine", | ||
"description": "Wrap your standards in a tortilla and cover it in special sauce.", | ||
"version": "6.0.0", | ||
"version": "7.0.0", | ||
"author": "Dan Flettre <flettre@gmail.com> (http://twitter.com/flettre/)", | ||
@@ -12,3 +12,2 @@ "bugs": { | ||
"get-stdin": "^5.0.1", | ||
"home-or-tmp": "^2.0.0", | ||
"minimist": "^1.1.0", | ||
@@ -21,4 +20,6 @@ "pkg-conf": "^2.0.0" | ||
"eslint": "^3.0.1", | ||
"eslint-config-standard": "^6.0.0-beta.0", | ||
"eslint-config-standard": "^8.0.0-beta.2", | ||
"eslint-config-standard-jsx": "^3.0.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-node": "^4.2.2", | ||
"eslint-plugin-promise": "^3.4.0", | ||
@@ -25,0 +26,0 @@ "eslint-plugin-react": "^6.0.0", |
@@ -1,12 +0,11 @@ | ||
# Standard Engine | ||
[![travis][travis-image]][travis-url] | ||
[![npm][npm-image]][npm-url] | ||
[![downloads][downloads-image]][downloads-url] | ||
# standard-engine [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] | ||
[travis-image]: https://img.shields.io/travis/Flet/standard-engine.svg?style=flat | ||
[travis-image]: https://img.shields.io/travis/Flet/standard-engine/master.svg | ||
[travis-url]: https://travis-ci.org/Flet/standard-engine | ||
[npm-image]: https://img.shields.io/npm/v/standard-engine.svg?style=flat | ||
[npm-image]: https://img.shields.io/npm/v/standard-engine.svg | ||
[npm-url]: https://npmjs.org/package/standard-engine | ||
[downloads-image]: https://img.shields.io/npm/dm/standard-engine.svg?style=flat | ||
[downloads-image]: https://img.shields.io/npm/dm/standard-engine.svg | ||
[downloads-url]: https://npmjs.org/package/standard-engine | ||
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg | ||
[standard-url]: https://standardjs.com | ||
@@ -24,3 +23,3 @@ ## Overview | ||
- [standard](https://github.com/feross/standard) - JavaScript Standard Style. | ||
- [standard](https://standardjs.com) - JavaScript Standard Style. | ||
- [semistandard](https://github.com/Flet/semistandard) - Its `standard` with semicolons sprinkled on top. | ||
@@ -247,3 +246,3 @@ - [happiness](https://github.com/JedWatson/happiness) - JavaScript Happiness Style (semicolons and tabs) | ||
### `results = standardEngine.lintText(text, [opts])` | ||
### `engine.lintText(text, [opts], callback)` | ||
@@ -267,4 +266,6 @@ Lint the provided source `text` to enforce your defined style. An `opts` object may | ||
If an error occurs, an exception is thrown. Otherwise, a `results` object is returned: | ||
The `callback` will be called with an `Error` and `results` object. | ||
The `results` object will contain the following properties: | ||
```js | ||
@@ -288,4 +289,9 @@ { | ||
### `standardEngine.lintFiles(files, [opts], callback)` | ||
### `results = engine.lintTextSync(text, [opts])` | ||
Synchronous version of `engine.lintText()`. If an error occurs, an exception is | ||
thrown. Otherwise, a `results` object is returned. | ||
### `engine.lintFiles(files, [opts], callback)` | ||
Lint the provided `files` globs. An `opts` object may be provided: | ||
@@ -311,2 +317,4 @@ | ||
**NOTE: There is no synchronous version of `engine.lintFiles()`.** | ||
### Full set of `opts` | ||
@@ -313,0 +321,0 @@ |
@@ -23,5 +23,15 @@ var eslint = require('eslint') | ||
test('api: lintText', function (t) { | ||
t.plan(3) | ||
var standard = getStandard() | ||
standard.lintText('console.log("hi there")\n', function (err, result) { | ||
t.error(err, 'no error while linting') | ||
t.equal(typeof result, 'object', 'result is an object') | ||
t.equal(result.errorCount, 1, 'should have used single quotes') | ||
}) | ||
}) | ||
test('api: lintTextSync', function (t) { | ||
t.plan(2) | ||
var standard = getStandard() | ||
var result = standard.lintText('console.log("hi there")\n') | ||
var result = standard.lintTextSync('console.log("hi there")\n') | ||
t.equal(typeof result, 'object', 'result is an object') | ||
@@ -28,0 +38,0 @@ t.equal(result.errorCount, 1, 'should have used single quotes') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37041
4
476
345
15
- Removedhome-or-tmp@^2.0.0
- Removedhome-or-tmp@2.0.0(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedos-tmpdir@1.0.2(transitive)