eslint-plugin-deprecation
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -48,5 +48,15 @@ "use strict"; | ||
return function identifierRule(id) { | ||
// Don't consider deprecations in certain cases: | ||
var _a; | ||
const services = experimental_utils_1.ESLintUtils.getParserServices(context); | ||
// Don't consider deprecations in certain cases: | ||
// - On JSX closing elements (only flag the opening element) | ||
const isClosingElement = id.type === 'JSXIdentifier' && ((_a = id.parent) === null || _a === void 0 ? void 0 : _a.type) === 'JSXClosingElement'; | ||
if (isClosingElement) { | ||
return; | ||
} | ||
// - At the spot where something is declared | ||
const isIdDeclaration = (id.type === 'Identifier' || id.type === 'JSXIdentifier') && | ||
isDeclaration(id, context); | ||
if (isIdDeclaration) { | ||
return; | ||
} | ||
// - Inside an import | ||
@@ -56,10 +66,6 @@ const isInsideImport = context | ||
.some((anc) => anc.type.includes('Import')); | ||
// - At the spot where something is declared | ||
const isIdDeclaration = (id.type === 'Identifier' || id.type === 'JSXIdentifier') && | ||
isDeclaration(id, context); | ||
// - On JSX closing elements (only flag the opening element) | ||
const isClosingElement = id.type === 'JSXIdentifier' && ((_a = id.parent) === null || _a === void 0 ? void 0 : _a.type) === 'JSXClosingElement'; | ||
if (isInsideImport || isIdDeclaration || isClosingElement) { | ||
if (isInsideImport) { | ||
return; | ||
} | ||
const services = experimental_utils_1.ESLintUtils.getParserServices(context); | ||
const deprecation = getDeprecation(id, services, context); | ||
@@ -66,0 +72,0 @@ if (deprecation) { |
{ | ||
"name": "eslint-plugin-deprecation", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "ESLint rule that reports usage of deprecated code", | ||
@@ -5,0 +5,0 @@ "author": "Alex Malkevich <malkevich.alex@gmail.com>", |
Sorry, the diff of this file is not supported yet
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
43764
330