@arthurgeron/eslint-plugin-react-usememo
Advanced tools
Comparing version 2.1.2 to 2.1.3
@@ -40,2 +40,28 @@ 'use strict'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
var __assign = function() { | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var _a, _b, _c, _d; | ||
@@ -348,4 +374,4 @@ var nameGeneratorUUID = 'b32a4d70-4f64-11eb-89d5-33e6ce8a6c99'; | ||
function addReactImports(context, kind, reactImportData, fixer) { | ||
var _a, _b, _c, _d, _e, _f; | ||
var sourceCode = context.getSourceCode(); | ||
var _a, _b, _c; | ||
context.getSourceCode(); | ||
var importsDisabled = ((_c = (_b = (_a = context.options) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.fix) === null || _c === void 0 ? void 0 : _c.addImports) === false; | ||
@@ -374,5 +400,11 @@ var specifier = undefined; | ||
if (!reactImportData.reactImported && !reactImportData.importDeclaration) { | ||
var importBracket = "import { "; | ||
reactImportData.importDeclaration = { | ||
type: 'ImportDeclaration', | ||
specifiers: [specifier], | ||
specifiers: [ | ||
__assign(__assign({}, specifier), { range: [ | ||
importBracket.length, | ||
importBracket.length + kind.length | ||
] }) | ||
], | ||
source: { type: 'Literal', value: 'react' } | ||
@@ -382,5 +414,4 @@ }; | ||
reactImportData["".concat(kind, "Imported")] = true; | ||
((_f = (_e = (_d = sourceCode.ast.body[0]) === null || _d === void 0 ? void 0 : _d.leadingComments) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.value) || ""; | ||
// Add an extra new line before const component and use indentSpace for proper spacing. | ||
return fixer.insertTextBeforeRange([0, 0], "import { ".concat(kind, " } from 'react';\n")); | ||
return fixer.insertTextBeforeRange([0, 0], "".concat(importBracket).concat(kind, " } from 'react';\n")); | ||
} | ||
@@ -670,28 +701,2 @@ return; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
var __assign = function() { | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var MessagesRequireUseMemo = { | ||
@@ -698,0 +703,0 @@ "object-usememo-props": "Object literal should be wrapped in useMemo() or be static when used as a prop", |
{ | ||
"name": "@arthurgeron/eslint-plugin-react-usememo", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "", | ||
@@ -45,2 +45,2 @@ "main": "dist/index.js", | ||
} | ||
} | ||
} |
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
50116
854