eslint-plugin-config-itself
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,5 +0,7 @@ | ||
import { rules } from "./rules"; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const rules_1 = require("./rules"); | ||
const plugin = { | ||
rules, | ||
rules: rules_1.rules, | ||
}; | ||
export default plugin; | ||
exports.default = plugin; |
@@ -1,4 +0,7 @@ | ||
import { rule as maxWarnLevelRules } from './max-warn-level-rules'; | ||
export const rules = { | ||
'max-warn-level-rules': maxWarnLevelRules, | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.rules = void 0; | ||
const max_warn_level_rules_1 = require("./max-warn-level-rules"); | ||
exports.rules = { | ||
'max-warn-level-rules': max_warn_level_rules_1.rule, | ||
}; |
@@ -1,12 +0,15 @@ | ||
import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'; | ||
import { getFilename } from '@typescript-eslint/utils/eslint-utils'; | ||
export const name = 'max-warn-level-rules'; | ||
const createRule = ESLintUtils.RuleCreator((name) => 'eslint-plugin-config-itself/' + name); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.rule = exports.name = void 0; | ||
const utils_1 = require("@typescript-eslint/utils"); | ||
const eslint_utils_1 = require("@typescript-eslint/utils/eslint-utils"); | ||
exports.name = 'max-warn-level-rules'; | ||
const createRule = utils_1.ESLintUtils.RuleCreator((name) => 'eslint-plugin-config-itself/' + name); | ||
function countWarnInRules(rules) { | ||
if (rules && rules.type === AST_NODE_TYPES.Property && rules.value.type === AST_NODE_TYPES.ObjectExpression) { | ||
if (rules && rules.type === utils_1.AST_NODE_TYPES.Property && rules.value.type === utils_1.AST_NODE_TYPES.ObjectExpression) { | ||
const warnRulesCount = rules.value.properties.filter((property) => { | ||
if (property.type === AST_NODE_TYPES.Property && property.value.type === AST_NODE_TYPES.Literal && property.value.value === 'warn') { | ||
if (property.type === utils_1.AST_NODE_TYPES.Property && property.value.type === utils_1.AST_NODE_TYPES.Literal && property.value.value === 'warn') { | ||
return true; | ||
} | ||
if (property.type === AST_NODE_TYPES.Property && property.value.type === AST_NODE_TYPES.ArrayExpression && property.value.elements[0]?.type === AST_NODE_TYPES.Literal && property.value.elements[0]?.value === 'warn') { | ||
if (property.type === utils_1.AST_NODE_TYPES.Property && property.value.type === utils_1.AST_NODE_TYPES.ArrayExpression && property.value.elements[0]?.type === utils_1.AST_NODE_TYPES.Literal && property.value.elements[0]?.value === 'warn') { | ||
return true; | ||
@@ -20,4 +23,4 @@ } | ||
} | ||
export const rule = createRule({ | ||
name, | ||
exports.rule = createRule({ | ||
name: exports.name, | ||
meta: { | ||
@@ -48,3 +51,3 @@ type: 'problem', | ||
create(context, [{ max }]) { | ||
if (!['.eslintrc.js', '.eslintrc.cjs'].includes(getFilename(context))) { | ||
if (!['.eslintrc.js', '.eslintrc.cjs'].includes((0, eslint_utils_1.getFilename)(context))) { | ||
return {}; | ||
@@ -57,4 +60,4 @@ } | ||
const rules = properties.find((property) => { | ||
return (property.type === AST_NODE_TYPES.Property && property.key.type === AST_NODE_TYPES.Literal && property.key.value === 'rules') || | ||
(property.type === AST_NODE_TYPES.Property && property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'rules'); | ||
return (property.type === utils_1.AST_NODE_TYPES.Property && property.key.type === utils_1.AST_NODE_TYPES.Literal && property.key.value === 'rules') || | ||
(property.type === utils_1.AST_NODE_TYPES.Property && property.key.type === utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'rules'); | ||
}); | ||
@@ -61,0 +64,0 @@ total += countWarnInRules(rules); |
{ | ||
"name": "eslint-plugin-config-itself", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "ESLint plugin for ESLint config itself", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
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
6029
103