eslint-plugin-flowtype
Advanced tools
Comparing version 2.19.0 to 2.20.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="2.20.0"></a> | ||
# [2.20.0](https://github.com/gajus/eslint-plugin-flowtype/compare/v2.19.0...v2.20.0) (2016-10-06) | ||
### Features | ||
* add annotation enforcement option ([dd71ce8](https://github.com/gajus/eslint-plugin-flowtype/commit/dd71ce8)) | ||
<a name="2.19.0"></a> | ||
@@ -7,0 +17,0 @@ # [2.19.0](https://github.com/gajus/eslint-plugin-flowtype/compare/v2.18.2...v2.19.0) (2016-09-20) |
@@ -16,2 +16,6 @@ 'use strict'; | ||
var defaults = { | ||
annotationStyle: 'none' | ||
}; | ||
var looksLikeFlowFileAnnotation = function looksLikeFlowFileAnnotation(comment) { | ||
@@ -22,2 +26,10 @@ return (/@(?:no)?flow/i.test(comment) | ||
var isValidAnnotationStyle = function isValidAnnotationStyle(node, style) { | ||
if (style === 'none') { | ||
return true; | ||
} | ||
return style === node.type.toLowerCase(); | ||
}; | ||
var schema = exports.schema = [{ | ||
@@ -35,2 +47,3 @@ enum: ['always'] | ||
var always = context.options[0] === 'always'; | ||
var style = _lodash2.default.get(context, 'options[1].annotationStyle', defaults.annotationStyle); | ||
@@ -53,2 +66,8 @@ return { | ||
} | ||
if (!isValidAnnotationStyle(potentialFlowFileAnnotation, style)) { | ||
var str = style === 'line' ? '`// @flow`' : '`/* @flow */`'; | ||
context.report(potentialFlowFileAnnotation, 'Flow file annotation style must be ' + str); | ||
} | ||
} else if (always) { | ||
@@ -55,0 +74,0 @@ context.report(node, 'Flow file annotation is missing.'); |
{ | ||
"name": "eslint-plugin-flowtype", | ||
"description": "Flowtype linting rules for ESLint.", | ||
"version": "2.19.0", | ||
"version": "2.20.0", | ||
"main": "./dist/index.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
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
142565
1524
2745