eslint-plugin-regexp
Advanced tools
Comparing version
@@ -18,9 +18,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -27,0 +37,0 @@ exports.plugins = exports.rules = void 0; |
@@ -18,9 +18,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -27,0 +37,0 @@ exports.plugins = exports.rules = void 0; |
@@ -18,9 +18,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -27,0 +37,0 @@ exports.rules = exports.configs = exports.meta = void 0; |
@@ -49,6 +49,3 @@ "use strict"; | ||
const sourceCode = context.sourceCode; | ||
const allowList = (_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.allows) !== null && _b !== void 0 ? _b : [ | ||
OPTION_SS1, | ||
OPTION_DOTALL, | ||
]; | ||
const allowList = (_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.allows) !== null && _b !== void 0 ? _b : [OPTION_SS1, OPTION_DOTALL]; | ||
const allows = new Set(allowList); | ||
@@ -55,0 +52,0 @@ const preference = allowList[0] || null; |
@@ -54,3 +54,4 @@ "use strict"; | ||
var _a, _b; | ||
const reportUncertain = ((_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.report) !== null && _b !== void 0 ? _b : "certain") === "potential"; | ||
const reportUncertain = ((_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.report) !== null && _b !== void 0 ? _b : "certain") === | ||
"potential"; | ||
function createVisitor(regexpContext) { | ||
@@ -57,0 +58,0 @@ const { node, patternAst, flags, getRegexpLocation, fixReplaceNode, getUsageOfPattern, } = regexpContext; |
@@ -102,3 +102,4 @@ "use strict"; | ||
var _a, _b, _c, _d, _e, _f; | ||
const reportUncertain = ((_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.report) !== null && _b !== void 0 ? _b : "certain") === "potential"; | ||
const reportUncertain = ((_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.report) !== null && _b !== void 0 ? _b : "certain") === | ||
"potential"; | ||
const ignoreSticky = (_d = (_c = context.options[0]) === null || _c === void 0 ? void 0 : _c.ignoreSticky) !== null && _d !== void 0 ? _d : true; | ||
@@ -105,0 +106,0 @@ const ignorePartial = (_f = (_e = context.options[0]) === null || _e === void 0 ? void 0 : _e.ignorePartial) !== null && _f !== void 0 ? _f : true; |
@@ -51,3 +51,3 @@ "use strict"; | ||
? "never" | ||
: (_d = (_c = context.options[0]) === null || _c === void 0 ? void 0 : _c.allowTop) !== null && _d !== void 0 ? _d : "partial"; | ||
: ((_d = (_c = context.options[0]) === null || _c === void 0 ? void 0 : _c.allowTop) !== null && _d !== void 0 ? _d : "partial"); | ||
function createVisitor({ node, getRegexpLocation, fixReplaceNode, getUsageOfPattern, }) { | ||
@@ -54,0 +54,0 @@ let isIgnored; |
@@ -6,5 +6,6 @@ "use strict"; | ||
class CharBuffer { | ||
constructor(target) { | ||
constructor(target, allows) { | ||
this.target = target; | ||
this.elements = [target]; | ||
this.allows = allows; | ||
this.times = 1; | ||
@@ -36,2 +37,5 @@ if (target.type === "CharacterSet") { | ||
} | ||
get bufferRawContents() { | ||
return this.elements.reduce((acc, element) => acc + element.raw, ""); | ||
} | ||
isValid() { | ||
@@ -41,2 +45,5 @@ if (this.elements.length < 2) { | ||
} | ||
if (this.allows.includes(this.bufferRawContents)) { | ||
return true; | ||
} | ||
let charKind = null; | ||
@@ -83,3 +90,16 @@ for (const element of this.elements) { | ||
fixable: "code", | ||
schema: [], | ||
schema: [ | ||
{ | ||
type: "object", | ||
properties: { | ||
allows: { | ||
type: "array", | ||
items: { | ||
type: "string", | ||
}, | ||
}, | ||
}, | ||
additionalProperties: false, | ||
}, | ||
], | ||
messages: { | ||
@@ -91,2 +111,4 @@ unexpected: "Unexpected consecutive same {{type}}. Use '{{quantifier}}' instead.", | ||
create(context) { | ||
var _a, _b; | ||
const allows = (_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.allows) !== null && _b !== void 0 ? _b : []; | ||
function createVisitor({ node, patternSource, }) { | ||
@@ -104,3 +126,3 @@ return { | ||
validateBuffer(charBuffer); | ||
charBuffer = new CharBuffer(element); | ||
charBuffer = new CharBuffer(element, allows); | ||
} | ||
@@ -107,0 +129,0 @@ } |
@@ -51,1 +51,5 @@ import type { Rule } from "eslint"; | ||
} | ||
export type RegexpSettings = { | ||
allowedCharacterRanges?: string | readonly string[]; | ||
}; | ||
export type ObjectOption = Record<string, never>; |
@@ -18,9 +18,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -27,0 +37,0 @@ exports.getParent = getParent; |
@@ -15,3 +15,4 @@ "use strict"; | ||
var _a; | ||
let target = allowedByRuleOption || ((_a = context.settings.regexp) === null || _a === void 0 ? void 0 : _a.allowedCharacterRanges); | ||
let target = allowedByRuleOption || | ||
((_a = context.settings.regexp) === null || _a === void 0 ? void 0 : _a.allowedCharacterRanges); | ||
if (!target) { | ||
@@ -18,0 +19,0 @@ return ALPHANUMERIC_RANGES; |
@@ -18,9 +18,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -27,0 +37,0 @@ exports.JSDoc = exports.JSDocParam = exports.JSDocParams = void 0; |
@@ -18,9 +18,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -27,0 +37,0 @@ exports.findVariable = findVariable; |
{ | ||
"name": "eslint-plugin-regexp", | ||
"version": "2.7.0", | ||
"version": "2.8.0", | ||
"description": "ESLint plugin for finding RegExp mistakes and RegExp style guide violations.", | ||
@@ -82,11 +82,11 @@ "engines": { | ||
"@types/pako": "^2.0.3", | ||
"@typescript-eslint/eslint-plugin": "~8.14.0", | ||
"@typescript-eslint/parser": "~8.14.0", | ||
"@typescript-eslint/eslint-plugin": "~8.33.0", | ||
"@typescript-eslint/parser": "~8.33.0", | ||
"assert": "^2.0.0", | ||
"chai": "^5.0.0", | ||
"env-cmd": "^10.1.0", | ||
"eslint": "^9.14.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-doc-generator": "^1.7.1", | ||
"eslint-import-resolver-typescript": "^3.6.1", | ||
"eslint": "^9.21.0", | ||
"eslint-config-prettier": "^10.0.0", | ||
"eslint-doc-generator": "^2.0.0", | ||
"eslint-import-resolver-typescript": "^4.0.0", | ||
"eslint-plugin-eslint-plugin": "^6.1.0", | ||
@@ -100,23 +100,24 @@ "eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-regexp": "~2.6.0", | ||
"eslint-plugin-regexp": "~2.7.0", | ||
"eslint-plugin-unicorn": "^59.0.1", | ||
"eslint-plugin-vue": "^9.26.0", | ||
"eslint-plugin-yml": "^1.14.0", | ||
"eslint-snapshot-rule-tester": "^0.1.0", | ||
"markdownlint-cli": "^0.42.0", | ||
"mocha": "^10.0.0", | ||
"markdownlint-cli": "^0.44.0", | ||
"mocha": "^11.0.0", | ||
"mocha-chai-jest-snapshot": "^1.1.3", | ||
"npm-run-all2": "^7.0.0", | ||
"npm-run-all2": "^8.0.0", | ||
"nyc": "^17.0.0", | ||
"pako": "^2.1.0", | ||
"prettier": "~3.3.0", | ||
"prettier": "~3.5.0", | ||
"semver": "^7.5.4", | ||
"stylelint": "^16.0.0", | ||
"stylelint-config-recommended": "^14.0.1", | ||
"stylelint-config-recommended": "^16.0.0", | ||
"stylelint-config-recommended-vue": "^1.5.0", | ||
"ts-node": "^10.9.2", | ||
"typescript": "~5.6.2", | ||
"typescript-eslint": "~8.14.0", | ||
"vite-plugin-eslint4b": "^0.4.6", | ||
"typescript": "~5.8.0", | ||
"typescript-eslint": "~8.33.0", | ||
"vite-plugin-eslint4b": "^0.5.1", | ||
"vitepress": "^1.0.0", | ||
"vue-eslint-parser": "^9.0.0" | ||
"vue-eslint-parser": "^10.0.0" | ||
}, | ||
@@ -123,0 +124,0 @@ "dependencies": { |
833105
0.36%20391
0.42%56
1.82%