├── .npmrc ├── .gitattributes ├── .gitignore ├── .editorconfig ├── .github └── workflows │ └── main.yml ├── test └── test.js ├── license ├── package.json ├── readme.md └── index.js /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | yarn.lock 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.yml] 11 | indent_style = space 12 | indent_size = 2 13 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | - push 4 | - pull_request 5 | jobs: 6 | test: 7 | name: Node.js ${{ matrix.node-version }} 8 | runs-on: ubuntu-latest 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | node-version: 13 | - 14 14 | - 12 15 | - 10 16 | steps: 17 | - uses: actions/checkout@v2 18 | - uses: actions/setup-node@v1 19 | with: 20 | node-version: ${{ matrix.node-version }} 21 | - run: npm install 22 | - run: npm test 23 | -------------------------------------------------------------------------------- /test/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import tempWrite from 'temp-write'; 3 | import eslint from 'eslint'; 4 | import config from '..'; 5 | 6 | const hasRule = (errors, ruleId) => errors.some(x => x.ruleId === ruleId); 7 | 8 | function runEslint(string, config) { 9 | const linter = new eslint.CLIEngine({ 10 | useEslintrc: false, 11 | configFile: tempWrite.sync(JSON.stringify(config)) 12 | }); 13 | 14 | return linter.executeOnText(string).results[0].messages; 15 | } 16 | 17 | test('main', t => { 18 | const errors = runEslint('// @flow\nconst foo: Array = [];', config); 19 | t.true(hasRule(errors, 'flowtype/array-style-simple-type')); 20 | }); 21 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint-config-xo-flow", 3 | "version": "0.2.0", 4 | "description": "ESLint shareable config for Flow to be used with eslint-config-xo", 5 | "license": "MIT", 6 | "repository": "xojs/eslint-config-xo-flow", 7 | "funding": "https://github.com/sponsors/sindresorhus", 8 | "author": { 9 | "name": "Sindre Sorhus", 10 | "email": "sindresorhus@gmail.com", 11 | "url": "https://sindresorhus.com" 12 | }, 13 | "engines": { 14 | "node": ">=10" 15 | }, 16 | "scripts": { 17 | "test": "ava" 18 | }, 19 | "files": [ 20 | "index.js" 21 | ], 22 | "keywords": [ 23 | "flow", 24 | "eslintconfig", 25 | "xo", 26 | "code", 27 | "quality", 28 | "style", 29 | "lint", 30 | "linter", 31 | "jscs", 32 | "jshint", 33 | "jslint", 34 | "eslint", 35 | "validate", 36 | "standard", 37 | "strict", 38 | "check", 39 | "checker", 40 | "verify", 41 | "enforce", 42 | "hint", 43 | "simple" 44 | ], 45 | "devDependencies": { 46 | "ava": "^0.25.0", 47 | "babel-eslint": "^10.0.1", 48 | "eslint": "^6.8.0", 49 | "eslint-plugin-flowtype": "^4.6.0", 50 | "temp-write": "^4.0.0" 51 | }, 52 | "peerDependencies": { 53 | "babel-eslint": ">=10.0.1", 54 | "eslint": ">=6.8.0", 55 | "eslint-plugin-flowtype": ">=4.6.0" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | This package is deprecated as it's clear that Flow has no future outside of Facebook. 2 | 3 | --- 4 | 5 | # eslint-config-xo-flow 6 | 7 | > ESLint [shareable config](https://eslint.org/docs/developer-guide/shareable-configs.html) for [Flow](https://flow.org) to be used with [eslint-config-xo](https://github.com/xojs/eslint-config-xo) 8 | 9 | ## Install 10 | 11 | ``` 12 | $ npm install --save-dev eslint-config-xo eslint-config-xo-flow babel-eslint eslint-plugin-flowtype 13 | ``` 14 | 15 | ## Usage 16 | 17 | Add some ESLint config to your package.json: 18 | 19 | ```json 20 | { 21 | "name": "my-awesome-project", 22 | "eslintConfig": { 23 | "extends": [ 24 | "xo", 25 | "xo-flow" 26 | ] 27 | } 28 | } 29 | ``` 30 | 31 | Or to .eslintrc: 32 | 33 | ```json 34 | { 35 | "extends": [ 36 | "xo", 37 | "xo-flow" 38 | ] 39 | } 40 | ``` 41 | 42 | ## Tip 43 | 44 | ### Use with XO 45 | 46 | ``` 47 | $ npm install --save-dev eslint-config-xo-flow babel-eslint eslint-plugin-flowtype 48 | ``` 49 | 50 | ```json 51 | { 52 | "name": "my-awesome-project", 53 | "xo": { 54 | "extends": "xo-flow" 55 | } 56 | } 57 | ``` 58 | 59 | ## Related 60 | 61 | - [eslint-config-xo](https://github.com/xojs/eslint-config-xo) - ESLint shareable config for XO 62 | - [XO](https://github.com/xojs/xo) 63 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | parser: require.resolve('babel-eslint'), 5 | plugins: [ 6 | 'flowtype' 7 | ], 8 | rules: { 9 | 'flowtype/array-style-complex-type': [ 10 | 'error', 11 | 'shorthand' 12 | ], 13 | 'flowtype/array-style-simple-type': [ 14 | 'error', 15 | 'shorthand' 16 | ], 17 | 'flowtype/boolean-style': [ 18 | 'error', 19 | 'boolean' 20 | ], 21 | 'flowtype/define-flow-type': 'error', 22 | 'flowtype/delimiter-dangle': [ 23 | 'error', 24 | 'never' 25 | ], 26 | 'flowtype/generic-spacing': [ 27 | 'error', 28 | 'never' 29 | ], 30 | 'flowtype/newline-after-flow-annotation': [ 31 | 'error', 32 | 'never' 33 | ], 34 | 'flowtype/no-dupe-keys': 'error', 35 | 'flowtype/no-flow-fix-me-comments': 'warn', 36 | 'flowtype/no-primitive-constructor-types': 'error', 37 | 'flowtype/no-types-missing-file-annotation': 'error', 38 | 'flowtype/no-unused-expressions': 'error', 39 | 'flowtype/no-weak-types': [ 40 | 'error', 41 | { 42 | any: false, 43 | Object: true, 44 | Function: true 45 | } 46 | ], 47 | 'flowtype/object-type-delimiter': [ 48 | 'error', 49 | 'comma' 50 | ], 51 | 'flowtype/require-indexer-name': 'error', 52 | 'flowtype/require-parameter-type': 'error', 53 | 'flowtype/require-return-type': 'error', 54 | 'flowtype/require-types-at-top': [ 55 | 'error', 56 | 'always' 57 | ], 58 | 'flowtype/require-valid-file-annotation': [ 59 | 'error', 60 | 'always', 61 | { 62 | annotationStyle: 'line' 63 | } 64 | ], 65 | 'flowtype/semi': [ 66 | 'error', 67 | 'always' 68 | ], 69 | 'flowtype/space-after-type-colon': [ 70 | 'error', 71 | 'always' 72 | ], 73 | 'flowtype/space-before-generic-bracket': [ 74 | 'error', 75 | 'never' 76 | ], 77 | 'flowtype/space-before-type-colon': [ 78 | 'error', 79 | 'never' 80 | ], 81 | 'flowtype/type-import-style': [ 82 | 'error', 83 | 'identifier' 84 | ], 85 | 'flowtype/union-intersection-spacing': [ 86 | 'error', 87 | 'always' 88 | ], 89 | 'flowtype/use-flow-type': 'error' 90 | } 91 | }; 92 | --------------------------------------------------------------------------------