Socket
Socket
Sign inDemoInstall

eslint-plugin-flowtype

Package Overview
Dependencies
Maintainers
1
Versions
185
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-flowtype - npm Package Compare versions

Comparing version 2.27.0 to 2.27.1

dist/utilities/fuzzyStringMatch.js

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="2.27.1"></a>
## [2.27.1](https://github.com/gajus/eslint-plugin-flowtype/compare/v2.27.0...v2.27.1) (2016-11-27)
### Bug Fixes
* annotation spell check, better @noflow support ([0fe502b](https://github.com/gajus/eslint-plugin-flowtype/commit/0fe502b))
<a name="2.27.0"></a>

@@ -7,0 +17,0 @@ # [2.27.0](https://github.com/gajus/eslint-plugin-flowtype/compare/v2.26.1...v2.27.0) (2016-11-27)

31

dist/rules/requireValidFileAnnotation.js

@@ -21,3 +21,3 @@ 'use strict';

var looksLikeFlowFileAnnotation = function looksLikeFlowFileAnnotation(comment) {
return (/@(?:no)?flow/i.test(comment)
return (/@(?:no)?f/i.test(comment)
);

@@ -34,2 +34,7 @@ };

var checkAnnotationSpelling = function checkAnnotationSpelling(comment) {
return (/@[a-z]+\b/.test(comment) && (0, _utilities.fuzzyStringMatch)(comment.replace(/no/i, ''), '@flow', 0.20)
);
};
var schema = exports.schema = [{

@@ -40,9 +45,3 @@ enum: ['always']

exports.default = function (context) {
var checkThisFile = !_lodash2.default.get(context, 'settings.flowtype.onlyFilesWithFlowAnnotation') || (0, _utilities.isFlowFile)(context);
if (!checkThisFile) {
return {};
}
var always = context.options[0] === 'always';
var always = context.options[0] === 'always' && !_lodash2.default.get(context, 'settings.flowtype.onlyFilesWithFlowAnnotation', false);
var style = _lodash2.default.get(context, 'options[1].annotationStyle', defaults.annotationStyle);

@@ -63,10 +62,12 @@

if (!(0, _utilities.isFlowFileAnnotation)(potentialFlowFileAnnotation.value)) {
context.report(potentialFlowFileAnnotation, 'Malformed flow file annotation.');
}
if ((0, _utilities.isFlowFileAnnotation)(potentialFlowFileAnnotation.value.trim())) {
if (!isValidAnnotationStyle(potentialFlowFileAnnotation, style)) {
var str = style === 'line' ? '`// ' + potentialFlowFileAnnotation.value.trim() + '`' : '`/* ' + potentialFlowFileAnnotation.value.trim() + ' */`';
if (!isValidAnnotationStyle(potentialFlowFileAnnotation, style)) {
var str = style === 'line' ? '`// @flow`' : '`/* @flow */`';
context.report(potentialFlowFileAnnotation, 'Flow file annotation style must be ' + str);
context.report(potentialFlowFileAnnotation, 'Flow file annotation style must be ' + str);
}
} else if (checkAnnotationSpelling(potentialFlowFileAnnotation.value.trim())) {
context.report(potentialFlowFileAnnotation, 'Misspelled or malformed Flow file annotation.');
} else {
context.report(potentialFlowFileAnnotation, 'Malformed Flow file annotation.');
}

@@ -73,0 +74,0 @@ } else if (always) {

@@ -7,3 +7,3 @@ 'use strict';

});
exports.getTokenAfterParens = exports.getTokenBeforeParens = exports.quoteName = exports.spacingFixers = exports.iterateFunctionNodes = exports.isFlowFileAnnotation = exports.isFlowFile = exports.getParameterName = undefined;
exports.fuzzyStringMatch = exports.getTokenAfterParens = exports.getTokenBeforeParens = exports.quoteName = exports.spacingFixers = exports.iterateFunctionNodes = exports.isFlowFileAnnotation = exports.isFlowFile = exports.getParameterName = undefined;

@@ -42,2 +42,6 @@ var _getParameterName2 = require('./getParameterName.js');

var _fuzzyStringMatch2 = require('./fuzzyStringMatch');
var _fuzzyStringMatch3 = _interopRequireDefault(_fuzzyStringMatch2);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

@@ -54,2 +58,3 @@

exports.getTokenBeforeParens = _getTokenBeforeParens3.default;
exports.getTokenAfterParens = _getTokenAfterParens3.default;
exports.getTokenAfterParens = _getTokenAfterParens3.default;
exports.fuzzyStringMatch = _fuzzyStringMatch3.default;

@@ -22,5 +22,5 @@ 'use strict';

return (0, _isFlowFileAnnotation2.default)(firstComment.value);
return (0, _isFlowFileAnnotation2.default)(firstComment.value) && !/no/.test(firstComment.value);
};
module.exports = exports['default'];
{
"name": "eslint-plugin-flowtype",
"description": "Flowtype linting rules for ESLint.",
"version": "2.27.0",
"version": "2.27.1",
"main": "./dist/index.js",

@@ -6,0 +6,0 @@ "repository": {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc