eslint-plugin-regexp
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -5,2 +5,3 @@ "use strict"; | ||
}; | ||
var _a, _b, _c; | ||
const eslint_1 = __importDefault(require("eslint")); | ||
@@ -15,3 +16,3 @@ module.exports = { | ||
"prefer-regex-literals": "error", | ||
[parseInt(eslint_1.default.Linter.version[0], 10) >= 7 | ||
[parseInt((_c = (_b = (_a = eslint_1.default.Linter) === null || _a === void 0 ? void 0 : _a.version) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : "6", 10) >= 7 | ||
? "no-useless-backreference" | ||
@@ -18,0 +19,0 @@ : "regexp/no-useless-backreference"]: "error", |
@@ -41,2 +41,3 @@ "use strict"; | ||
}, | ||
additionalProperties: false, | ||
}, | ||
@@ -43,0 +44,0 @@ ], |
@@ -46,3 +46,5 @@ "use strict"; | ||
onBackreferenceEnter(bref) { | ||
const group = bref.resolved, brefPath = getPathToRoot(bref), groupPath = getPathToRoot(group); | ||
const group = bref.resolved; | ||
const brefPath = getPathToRoot(bref); | ||
const groupPath = getPathToRoot(group); | ||
let messageId = null; | ||
@@ -53,3 +55,4 @@ if (brefPath.includes(group)) { | ||
else { | ||
let i = brefPath.length - 1, j = groupPath.length - 1; | ||
let i = brefPath.length - 1; | ||
let j = groupPath.length - 1; | ||
do { | ||
@@ -59,3 +62,7 @@ i--; | ||
} while (brefPath[i] === groupPath[j]); | ||
const indexOfLowestCommonAncestor = j + 1, groupCut = groupPath.slice(0, indexOfLowestCommonAncestor), commonPath = groupPath.slice(indexOfLowestCommonAncestor), lowestCommonLookaround = commonPath.find(isLookaround), isMatchingBackward = lowestCommonLookaround && | ||
const indexOfLowestCommonAncestor = j + 1; | ||
const groupCut = groupPath.slice(0, indexOfLowestCommonAncestor); | ||
const commonPath = groupPath.slice(indexOfLowestCommonAncestor); | ||
const lowestCommonLookaround = commonPath.find(isLookaround); | ||
const isMatchingBackward = lowestCommonLookaround && | ||
lowestCommonLookaround.kind === "lookbehind"; | ||
@@ -62,0 +69,0 @@ if (!isMatchingBackward && bref.end <= group.start) { |
@@ -24,4 +24,3 @@ "use strict"; | ||
ccrNode.max.value === utils_1.CP_DIGIT_NINE) { | ||
let reportNode; | ||
let instead; | ||
let reportNode, instead; | ||
const ccNode = ccrNode.parent; | ||
@@ -28,0 +27,0 @@ if (ccNode.elements.length === 1) { |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -20,2 +20,3 @@ "use strict"; | ||
const prefer_plus_quantifier_1 = __importDefault(require("../rules/prefer-plus-quantifier")); | ||
const prefer_quantifier_1 = __importDefault(require("../rules/prefer-quantifier")); | ||
const prefer_question_quantifier_1 = __importDefault(require("../rules/prefer-question-quantifier")); | ||
@@ -39,2 +40,3 @@ const prefer_star_quantifier_1 = __importDefault(require("../rules/prefer-star-quantifier")); | ||
prefer_plus_quantifier_1.default, | ||
prefer_quantifier_1.default, | ||
prefer_question_quantifier_1.default, | ||
@@ -41,0 +43,0 @@ prefer_star_quantifier_1.default, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.invisibleEscape = exports.isInvisible = exports.isWord = exports.isSpace = exports.isDigit = exports.CP_RANGES_WORDS = exports.CP_RANGE_SPACES = exports.CP_RANGE_CAPITAL_LETTER = exports.CP_RANGE_SMALL_LETTER = exports.CP_RANGE_DIGIT = exports.CPS_SINGLE_SPACES = exports.CP_LOW_LINE = exports.CP_CAPITAL_Z = exports.CP_CAPITAL_A = exports.CP_SMALL_Z = exports.CP_SMALL_A = exports.CP_DIGIT_NINE = exports.CP_DIGIT_ZERO = exports.CP_BOM = exports.CP_IDEOGRAPHIC_SPACE = exports.CP_BRAILLE_PATTERN_BLANK = exports.CP_MMSP = exports.CP_NNBSP = exports.CP_PARAGRAPH_SEPARATOR = exports.CP_LINE_SEPARATOR = exports.CP_RLM = exports.CP_LRM = exports.CP_ZWJ = exports.CP_ZWNJ = exports.CP_ZWSP = exports.CP_HAIR_SPACE = exports.CP_EN_QUAD = exports.CP_MONGOLIAN_VOWEL_SEPARATOR = exports.CP_OGHAM_SPACE_MARK = exports.CP_NBSP = exports.CP_NEL = exports.CP_SPACE = exports.CP_CR = exports.CP_FF = exports.CP_VT = exports.CP_LF = exports.CP_TAB = void 0; | ||
exports.invisibleEscape = exports.isInvisible = exports.isWord = exports.isSpace = exports.isLetter = exports.isDigit = exports.CP_RANGES_WORDS = exports.CP_RANGE_SPACES = exports.CP_RANGE_CAPITAL_LETTER = exports.CP_RANGE_SMALL_LETTER = exports.CP_RANGE_DIGIT = exports.CPS_SINGLE_SPACES = exports.CP_LOW_LINE = exports.CP_CAPITAL_Z = exports.CP_CAPITAL_A = exports.CP_SMALL_Z = exports.CP_SMALL_A = exports.CP_DIGIT_NINE = exports.CP_DIGIT_ZERO = exports.CP_BOM = exports.CP_IDEOGRAPHIC_SPACE = exports.CP_BRAILLE_PATTERN_BLANK = exports.CP_MMSP = exports.CP_NNBSP = exports.CP_PARAGRAPH_SEPARATOR = exports.CP_LINE_SEPARATOR = exports.CP_RLM = exports.CP_LRM = exports.CP_ZWJ = exports.CP_ZWNJ = exports.CP_ZWSP = exports.CP_HAIR_SPACE = exports.CP_EN_QUAD = exports.CP_MONGOLIAN_VOWEL_SEPARATOR = exports.CP_OGHAM_SPACE_MARK = exports.CP_NBSP = exports.CP_NEL = exports.CP_SPACE = exports.CP_CR = exports.CP_FF = exports.CP_VT = exports.CP_LF = exports.CP_TAB = void 0; | ||
exports.CP_TAB = 9; | ||
@@ -68,2 +68,7 @@ exports.CP_LF = 10; | ||
exports.isDigit = isDigit; | ||
function isLetter(codePoint) { | ||
return (isCodePointInRange(codePoint, exports.CP_RANGE_SMALL_LETTER) || | ||
isCodePointInRange(codePoint, exports.CP_RANGE_CAPITAL_LETTER)); | ||
} | ||
exports.isLetter = isLetter; | ||
function isSpace(codePoint) { | ||
@@ -70,0 +75,0 @@ return (exports.CPS_SINGLE_SPACES.has(codePoint) || |
159
package.json
{ | ||
"name": "eslint-plugin-regexp", | ||
"version": "0.1.1", | ||
"description": "ESLint plugin for finding RegExp mistakes and RegExp style guide violations.", | ||
"main": "dist/index.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"prebuild": "npm run -s clean", | ||
"build": "tsc --project ./tsconfig.build.json", | ||
"clean": "rimraf .nyc_output dist coverage", | ||
"lint": "eslint \"tests\" \"lib\" \"docs/.vuepress\" --ext .js,.vue,.ts", | ||
"eslint-fix": "eslint \"tests\" \"lib\" \"docs/.vuepress\" --ext .js,.vue,.ts --fix", | ||
"pretest": "npm run build", | ||
"test:base": "mocha --require ts-node/register \"tests/**/*.ts\" --reporter dot --timeout 60000", | ||
"test": "npm run test:nyc", | ||
"test:nyc": "nyc --reporter=lcov npm run test:base", | ||
"test:debug": "mocha --require ts-node/register --inspect-brk \"tests/**/*.ts\" --reporter dot", | ||
"test:watch": "npm run test:base -- --watch", | ||
"update": "ts-node ./tools/update.ts && npm run eslint-fix && npm run test:nyc", | ||
"new": "ts-node ./tools/new-rule.ts", | ||
"docs:watch": "vuepress dev --debug docs", | ||
"docs:build": "npm run build && vuepress build docs --no-cache", | ||
"docs-deploysetup": "npm run docs:build && npm run docs-deploysetup:clean && npm run docs-deploysetup:copy", | ||
"docs-deploysetup:clean": "rimraf assets", | ||
"docs-deploysetup:copy": "npx cpx \"docs/\\.vuepress/dist/**\" . -u", | ||
"preversion": "npm test && npm run update && git add .", | ||
"version": "npm run eslint-fix && git add ." | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ota-meshi/eslint-plugin-regexp.git" | ||
}, | ||
"keywords": [ | ||
"eslint", | ||
"eslintplugin", | ||
"eslint-plugin", | ||
"regexp", | ||
"regex" | ||
], | ||
"author": "Yosuke Ota", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ota-meshi/eslint-plugin-regexp/issues" | ||
}, | ||
"homepage": "https://github.com/ota-meshi/eslint-plugin-regexp#readme", | ||
"peerDependencies": { | ||
"eslint": ">=6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@mysticatea/eslint-plugin": "^13.0.0", | ||
"@types/eslint": "^7.2.0", | ||
"@types/estree": "0.0.44", | ||
"@types/mocha": "^7.0.2", | ||
"@types/node": "^14.0.13", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^7.3.0", | ||
"eslint4b": "^7.3.1", | ||
"mocha": "^7.0.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.0.5", | ||
"raw-loader": "^4.0.1", | ||
"stylelint": "^13.6.1", | ||
"stylelint-config-standard": "^20.0.0", | ||
"stylelint-plugin-stylus": "^0.9.0", | ||
"ts-node": "^8.10.2", | ||
"typescript": "^3.9.5", | ||
"vue-eslint-editor": "^1.1.0", | ||
"vuepress": "^1.5.2" | ||
}, | ||
"dependencies": { | ||
"eslint-utils": "^2.1.0", | ||
"regexpp": "^3.1.0" | ||
} | ||
"name": "eslint-plugin-regexp", | ||
"version": "0.2.0", | ||
"description": "ESLint plugin for finding RegExp mistakes and RegExp style guide violations.", | ||
"main": "dist/index.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"prebuild": "npm run -s clean", | ||
"build": "tsc --project ./tsconfig.build.json", | ||
"clean": "rimraf .nyc_output dist coverage", | ||
"lint": "eslint . --ext .js,.vue,.ts,.json,.yaml,.yml", | ||
"eslint-fix": "eslint . --ext .js,.vue,.ts,.json,.yaml,.yml --fix", | ||
"pretest": "npm run build", | ||
"test:base": "mocha --require ts-node/register \"tests/**/*.ts\" --reporter dot --timeout 60000", | ||
"test": "npm run test:nyc", | ||
"test:nyc": "nyc --reporter=lcov npm run test:base", | ||
"test:debug": "mocha --require ts-node/register/transpile-only \"tests/**/*.ts\" --reporter dot", | ||
"test:watch": "npm run test:base -- --watch", | ||
"update": "ts-node --transpile-only ./tools/update.ts && npm run eslint-fix && npm run test:nyc", | ||
"new": "ts-node ./tools/new-rule.ts", | ||
"docs:watch": "vuepress dev --debug docs", | ||
"docs:build": "npm run build && vuepress build docs --no-cache", | ||
"preversion": "npm test && git add .", | ||
"version": "env-cmd -e version npm run update && git add ." | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ota-meshi/eslint-plugin-regexp.git" | ||
}, | ||
"keywords": [ | ||
"eslint", | ||
"eslintplugin", | ||
"eslint-plugin", | ||
"regexp", | ||
"regex" | ||
], | ||
"author": "Yosuke Ota", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ota-meshi/eslint-plugin-regexp/issues" | ||
}, | ||
"homepage": "https://github.com/ota-meshi/eslint-plugin-regexp#readme", | ||
"peerDependencies": { | ||
"eslint": ">=6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@ota-meshi/eslint-plugin": "^0.0.16", | ||
"@types/eslint": "^7.2.0", | ||
"@types/estree": "~0.0.45", | ||
"@types/mocha": "^8.0.0", | ||
"@types/node": "^14.0.13", | ||
"@typescript-eslint/eslint-plugin": "^4.14.0", | ||
"@typescript-eslint/parser": "^4.14.0", | ||
"babel-eslint": "^10.1.0", | ||
"env-cmd": "^10.1.0", | ||
"eslint": "^7.3.0", | ||
"eslint-config-prettier": "^8.0.0", | ||
"eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-eslint-plugin": "^2.3.0", | ||
"eslint-plugin-json-schema-validator": "^0.4.0", | ||
"eslint-plugin-jsonc": "^1.0.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"eslint-plugin-regexp": "^0.1.1", | ||
"eslint-plugin-vue": "^7.5.0", | ||
"eslint-plugin-yml": "^0.7.0", | ||
"eslint4b": "^7.3.1", | ||
"mocha": "^8.0.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.0.5", | ||
"raw-loader": "^4.0.1", | ||
"stylelint": "^13.6.1", | ||
"stylelint-config-standard": "^20.0.0", | ||
"stylelint-plugin-stylus": "^0.10.0", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.0.0", | ||
"vue-eslint-editor": "^1.1.0", | ||
"vue-eslint-parser": "^7.4.1", | ||
"vuepress": "^1.5.2" | ||
}, | ||
"dependencies": { | ||
"eslint-utils": "^2.1.0", | ||
"regexpp": "^3.1.0" | ||
} | ||
} |
@@ -35,3 +35,3 @@ # Introduction | ||
> | ||
> - ESLint v5.0.0 and above | ||
> - ESLint v6.0.0 and above | ||
> - Node.js v8.10.0 and above | ||
@@ -96,2 +96,3 @@ | ||
| [regexp/prefer-plus-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-plus-quantifier.html) | enforce using `+` quantifier | :star::wrench: | | ||
| [regexp/prefer-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-quantifier.html) | enforce using quantifier | :wrench: | | ||
| [regexp/prefer-question-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-question-quantifier.html) | enforce using `?` quantifier | :star::wrench: | | ||
@@ -98,0 +99,0 @@ | [regexp/prefer-star-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-star-quantifier.html) | enforce using `*` quantifier | :star::wrench: | |
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
87013
27
1904
122
33