-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flow compatibility #20
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = { | ||
parser: 'babel-eslint', | ||
extends: 'mixmax/node', | ||
plugins: [ | ||
// Allows correct parsing of flow annotated files. | ||
'flowtype' | ||
], | ||
rules: { | ||
'space-infix-ops': 0, | ||
'no-duplicate-imports': 0, | ||
// Makes flow `type` definitions defines | ||
'flowtype/define-flow-type': 1, | ||
// Do not allow spaces before type declarations, i.e. let a: number, not let a : number | ||
'flowtype/space-before-type-colon': [ | ||
1, | ||
'never' | ||
], | ||
// Marks flow type declarations as used to prevent no-unused-vars for types | ||
'flowtype/use-flow-type': 1, | ||
// Enforces camelcase for type definitions | ||
'flowtype/type-id-match': [ | ||
2, | ||
'^([A-Z]+[a-z0-9A-Z]*)$' | ||
] | ||
}, | ||
settings: { | ||
// Only use the flow linter for files with `@flow` | ||
flowtype: { | ||
onlyFilesWithFlowAnnotation: true | ||
} | ||
}, | ||
parserOptions: { | ||
// Required to support import/export syntax when using types | ||
sourceType: 'module', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if we want to use this server-side with i'm wondering if we want a base There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To the first point, this works with server-side code just fine as far as I can tell (https://github.com/mixmaxhq/event-logging/pull/1 this correctly enforces rules using this config). On the other point, we could not extend |
||
ecmaFeatures: { | ||
experimentalObjectRestSpread: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what do you think about breaking out a new config to be used by transpiled, node-run code and here, maybe we want to combine two different configs like |
||
}, | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,14 +30,15 @@ | |
}, | ||
"homepage": "https://github.com/mixmaxhq/eslint-config-mixmax#readme", | ||
"optionalDependencies": { | ||
"babel-eslint": "^7.2.3", | ||
"babel-eslint": "^8.2.1", | ||
"eslint-plugin-flowtype": "^2.41.0", | ||
"eslint-plugin-react": "^7.1.0" | ||
}, | ||
"peerDependencies": { | ||
"eslint": ">= 3" | ||
"eslint": ">=4.14.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you please update the README with updated dependency installation instructions? (describing the optional separately, it looks like the README is outdated in other ways - mentioning forthcoming configs that have already been added, not including the |
||
}, | ||
"devDependencies": { | ||
"eslint": ">=3", | ||
"eslint": ">=4.14.0", | ||
"eslint-config-mixmax": "^0.7.0", | ||
"pre-commit": "^1.2.2" | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this go in our base config? same Q on
no-duplicate-imports