├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── bin └── cmd.js ├── eslintrc.json ├── index.js ├── options.js ├── package.json └── test ├── api.js └── cmd.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '4' 4 | - 'node' 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Irakli Gozalishvili 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # standard-flow 2 | [![travis][travis-image]][travis-url] 3 | [![npm][npm-image]][npm-url] 4 | [![downloads][downloads-image]][downloads-url] 5 | 6 | [travis-image]: https://travis-ci.org/Gozala/standard-flow.svg?branch=master 7 | [travis-url]: https://travis-ci.org/Gozala/standard-flow 8 | [npm-image]: https://img.shields.io/npm/v/standard-flow.svg 9 | [npm-url]: https://npmjs.org/package/standard-flow 10 | [downloads-image]: https://img.shields.io/npm/dm/standard-flow.svg 11 | [downloads-url]: https://npmjs.org/package/standard-flow 12 | 13 | The extra rules come from [eslint-config-standard-flow](https://github.com/Gozala/eslint-config-standard-flow). 14 | 15 | ## Install 16 | 17 | ```bash 18 | npm install standard-flow 19 | ``` 20 | 21 | ## Rules 22 | 23 | See [Rules](http://standardjs.com/rules) 24 | 25 | ## Usage 26 | 27 | See [Usage](http://standardjs.com/#usage). 28 | 29 | ## Badge 30 | 31 | Use this in one of your projects? Include one of these badges in your readme to let people know that your code is using the standard style. 32 | 33 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](http://standardjs.com) 34 | 35 | ```markdown 36 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](http://standardjs.com) 37 | ``` 38 | 39 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) 40 | 41 | ```markdown 42 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) 43 | ``` 44 | -------------------------------------------------------------------------------- /bin/cmd.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var opts = require('../options.js') 4 | require('standard-engine').cli(opts) 5 | -------------------------------------------------------------------------------- /eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["standard-flow"] 3 | } 4 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | // programmatic usage 2 | var Linter = require('standard-engine').linter 3 | 4 | var opts = require('./options.js') 5 | 6 | module.exports = new Linter(opts) 7 | -------------------------------------------------------------------------------- /options.js: -------------------------------------------------------------------------------- 1 | var eslint = require('eslint') 2 | var path = require('path') 3 | var pkg = require('./package.json') 4 | 5 | module.exports = { 6 | bugs: pkg.bugs.url, 7 | cmd: 'standard-flow', 8 | eslint: eslint, 9 | eslintConfig: { 10 | configFile: path.join(__dirname, 'eslintrc.json') 11 | }, 12 | formatter: '`standard-format` is no longer included with `standard`. Try using --fix instead.', 13 | homepage: pkg.homepage, 14 | tagline: 'Use JavaScript Standard Style (with Flow types)', 15 | version: pkg.version 16 | } 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "standard-flow", 3 | "description": "JavaScript Standard Style (with Flow types)", 4 | "version": "1.0.0", 5 | "author": { 6 | "email": "rfobic@gmail.com", 7 | "name": "Irakli Gozalishvili", 8 | "url": "http://jeditoolkit.com" 9 | }, 10 | "bin": "./bin/cmd.js", 11 | "bugs": { 12 | "url": "https://github.com/Gozala/standard-flow/issues" 13 | }, 14 | "dependencies": { 15 | "eslint": "3.3.1", 16 | "eslint-config-standard-flow": "1.0.1", 17 | "standard-engine": "5.1.0", 18 | "xtend": "4.0.1", 19 | "babel-eslint": "6.1.2", 20 | "eslint-config-standard": "5.3.5", 21 | "eslint-plugin-flowtype": "2.7.1", 22 | "eslint-plugin-import": "1.13.0", 23 | "eslint-plugin-promise": "2.0.1", 24 | "eslint-plugin-standard": "2.0.0" 25 | }, 26 | "devDependencies": { 27 | "cross-spawn": "4.0.0", 28 | "tape": "4.6.0" 29 | }, 30 | "homepage": "https://github.com/gozala/standard-flow", 31 | "keywords": [ 32 | "JavaScript Standard Style", 33 | "check", 34 | "checker", 35 | "code", 36 | "code checker", 37 | "code linter", 38 | "code standards", 39 | "code style", 40 | "enforce", 41 | "eslint", 42 | "hint", 43 | "jscs", 44 | "jshint", 45 | "lint", 46 | "policy", 47 | "quality", 48 | "simple", 49 | "standard", 50 | "standard style", 51 | "style", 52 | "style checker", 53 | "style linter", 54 | "verify", 55 | "flow" 56 | ], 57 | "license": "MIT", 58 | "main": "index.js", 59 | "repository": { 60 | "type": "git", 61 | "url": "git://github.com/Gozala/standard-flow.git" 62 | }, 63 | "scripts": { 64 | "test": "./bin/cmd.js && tape test/*.js" 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /test/api.js: -------------------------------------------------------------------------------- 1 | var standard = require('../') 2 | var test = require('tape') 3 | 4 | test('api: lintFiles', function (t) { 5 | t.plan(3) 6 | standard.lintFiles([], { cwd: 'bin' }, function (err, result) { 7 | t.error(err, 'no error while linting') 8 | t.equal(typeof result, 'object', 'result is an object') 9 | t.equal(result.errorCount, 0) 10 | }) 11 | }) 12 | 13 | test('api: lintText', function (t) { 14 | t.plan(3) 15 | standard.lintText('console.log("hi there")\n', function (err, result) { 16 | t.error(err, 'no error while linting') 17 | t.equal(typeof result, 'object', 'result is an object') 18 | t.equal(result.errorCount, 1, 'should have used single quotes') 19 | }) 20 | }) 21 | -------------------------------------------------------------------------------- /test/cmd.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var test = require('tape') 3 | var crossSpawn = require('cross-spawn') 4 | 5 | var CMD_PATH = path.join(__dirname, '..', 'bin', 'cmd.js') 6 | 7 | test('command line usage: --help', function (t) { 8 | t.plan(1) 9 | 10 | var child = crossSpawn(CMD_PATH, ['--help']) 11 | child.on('error', function (err) { 12 | t.fail(err) 13 | }) 14 | child.on('close', function (code) { 15 | t.equal(code, 0, 'zero exit code') 16 | }) 17 | }) 18 | --------------------------------------------------------------------------------