mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-28 09:59:50 -04:00
add regex optimization eslint
This commit is contained in:
parent
e22668640e
commit
8ae4cd7046
@ -8,7 +8,7 @@
|
||||
"project": "./tsconfig.json" // <-- Point to your project's "tsconfig.json" or create a new one.
|
||||
},
|
||||
|
||||
"plugins": ["unused-imports"],
|
||||
"plugins": ["unused-imports", "optimize-regex"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts"],
|
||||
@ -48,7 +48,8 @@
|
||||
"args": "after-used",
|
||||
"argsIgnorePattern": "^_"
|
||||
}
|
||||
]
|
||||
],
|
||||
"optimize-regex/optimize-regex": "warn"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -177,8 +177,7 @@
|
||||
"schematicCollections": [
|
||||
"@cypress/schematic",
|
||||
"@angular-eslint/schematics",
|
||||
"@angular-eslint/schematics",
|
||||
"@schematics/angular"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
22
src/package-lock.json
generated
22
src/package-lock.json
generated
@ -54,6 +54,7 @@
|
||||
"cypress": "latest",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-deprecation": "^2.0.0",
|
||||
"eslint-plugin-optimize-regex": "^1.2.1",
|
||||
"eslint-plugin-unused-imports": "^3.1.0",
|
||||
"firebase-tools": "^13.4.0",
|
||||
"fuzzy": "^0.1.3",
|
||||
@ -11980,6 +11981,18 @@
|
||||
"typescript": "^4.2.4 || ^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-optimize-regex": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-optimize-regex/-/eslint-plugin-optimize-regex-1.2.1.tgz",
|
||||
"integrity": "sha512-fUaU7Tj1G/KSTDTABJw4Wp427Rl7RPl9ViYTu1Jrv36fJw4DFhd4elPdXiuYtdPsNsvzn9GcVlKEssGIVjw0UQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"regexp-tree": "^0.1.21"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-unused-imports": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.1.0.tgz",
|
||||
@ -21225,6 +21238,15 @@
|
||||
"integrity": "sha512-TVILVSz2jY5D47F4mA4MppkBrafEaiUWJO/TcZHEIuI13AqoZMkK1WMA4Om1YkYbTx+9Ki1/tSUXbceyr9saRg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/regexp-tree": {
|
||||
"version": "0.1.27",
|
||||
"resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.27.tgz",
|
||||
"integrity": "sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"regexp-tree": "bin/regexp-tree"
|
||||
}
|
||||
},
|
||||
"node_modules/regexpu-core": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz",
|
||||
|
@ -62,6 +62,7 @@
|
||||
"cypress": "latest",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-deprecation": "^2.0.0",
|
||||
"eslint-plugin-optimize-regex": "^1.2.1",
|
||||
"eslint-plugin-unused-imports": "^3.1.0",
|
||||
"firebase-tools": "^13.4.0",
|
||||
"fuzzy": "^0.1.3",
|
||||
|
@ -747,7 +747,7 @@ export class AppService extends createReducingService(initialState) {
|
||||
|
||||
qry = qry.split('"').join(''); // remove any quotes, just in case
|
||||
|
||||
if (qry.search(/[0-9]/i) === -1) {
|
||||
if (qry.search(/\d/i) === -1) {
|
||||
// its a word
|
||||
for (const item of BibleReference.Books) {
|
||||
if (
|
||||
@ -772,7 +772,7 @@ export class AppService extends createReducingService(initialState) {
|
||||
}
|
||||
|
||||
this.dispatch(updateAutoCompleteAction(words));
|
||||
} else if (qry.search(/(H|G)[0-9]/i) !== -1) {
|
||||
} else if (qry.search(/(h|g)\d/i) !== -1) {
|
||||
// its a strongs lookup
|
||||
if (qry.substring(0, 1).toUpperCase() === 'H') {
|
||||
const num = parseInt(qry.substring(1), 10);
|
||||
@ -852,7 +852,7 @@ export class AppService extends createReducingService(initialState) {
|
||||
type: CardType.Note,
|
||||
data,
|
||||
} as CardItem;
|
||||
} else if (qry.search(/[0-9]/i) === -1) {
|
||||
} else if (qry.search(/\d/i) === -1) {
|
||||
// // its a search term.
|
||||
const data = await this.getWordsFromApi(qry);
|
||||
if (!data) {
|
||||
@ -863,7 +863,7 @@ export class AppService extends createReducingService(initialState) {
|
||||
type: CardType.Word,
|
||||
data,
|
||||
} as CardItem;
|
||||
} else if (qry.search(/(H|G)[0-9]/i) !== -1) {
|
||||
} else if (qry.search(/(h|g)\d/i) !== -1) {
|
||||
// its a strongs lookup
|
||||
const dict = qry.substring(0, 1).search(/h/i) !== -1 ? 'heb' : 'grk';
|
||||
const strongsNumber = qry.substring(1, qry.length);
|
||||
|
Loading…
x
Reference in New Issue
Block a user