Skip to content

Commit a513bf5

Browse files
authored
Merge pull request #160 from evcohen/more-flow-configuration
Add eslint-flowtypes plugin. Add flow tpe definitions for ESLint
2 parents cac0693 + fc6744a commit a513bf5

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

.eslintrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
{
2-
extends: "airbnb-base",
2+
extends: [
3+
"airbnb-base",
4+
"plugin:flowtype/recommended"
5+
],
36
parser: "babel-eslint",
7+
plugins: [
8+
"flowtype"
9+
],
410
rules: {
511
'no-template-curly-in-string': 'off'
612
}

.flowconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
<PROJECT_ROOT>/lib/.*
33
<PROJECT_ROOT>/docs/.*
44
<PROJECT_ROOT>/reports/.*
5+
6+
[libs]
7+
flow

flow/eslint.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
type ESLintReport = {
2+
node: any,
3+
message: string,
4+
};
5+
6+
type ESLintContext = {
7+
report: (ESLintReport) => void,
8+
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"coveralls": "^2.11.8",
4040
"eslint": "^3.12.2",
4141
"eslint-config-airbnb-base": "^11.0.0",
42+
"eslint-plugin-flowtype": "^2.29.2",
4243
"eslint-plugin-import": "^2.2.0",
4344
"expect": "^1.20.2",
4445
"flow-bin": "^0.38.0",

scripts/boilerplate/rule.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
const ruleBoilerplate = (author, description) => `/**
22
* @fileoverview ${description}
33
* @author ${author}
4+
* @flow
45
*/
56
67
// ----------------------------------------------------------------------------
78
// Rule Definition
89
// ----------------------------------------------------------------------------
910
11+
import { JSXOpeningElement } from 'ast-types-flow';
1012
import { generateObjSchema } from '../util/schemas';
1113
1214
const errorMessage = '';
@@ -19,8 +21,8 @@ module.exports = {
1921
schema: [schema],
2022
},
2123
22-
create: context => ({
23-
JSXOpeningElement: (node) => {
24+
create: (context: ESLintContext) => ({
25+
JSXOpeningElement: (node: JSXOpeningElement) => {
2426
context.report({
2527
node,
2628
message: errorMessage,

0 commit comments

Comments
 (0)