mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Chore: update ESLint config
This commit is contained in:
@@ -182,7 +182,7 @@ function matchWithRegExpArray(input, regexps = []) {
|
||||
|
||||
function escapeRegExp(string = '') {
|
||||
const reRegExpChar = /[$()*+.?[\\\]^{|}]/g;
|
||||
const reHasRegExpChar = RegExp(reRegExpChar.source);
|
||||
const reHasRegExpChar = new RegExp(reRegExpChar.source);
|
||||
|
||||
return string && reHasRegExpChar.test(string)
|
||||
? string.replaceAll(reRegExpChar, '\\$&')
|
||||
|
||||
@@ -44,7 +44,7 @@ const buildRejectDomainSet = task(__filename, async () => {
|
||||
})),
|
||||
...ADGUARD_FILTERS.map(input => {
|
||||
const promise = typeof input === 'string'
|
||||
? processFilterRules(input, undefined)
|
||||
? processFilterRules(input)
|
||||
: processFilterRules(input[0], input[1] || undefined);
|
||||
|
||||
return promise.then((i) => {
|
||||
@@ -133,9 +133,11 @@ const buildRejectDomainSet = task(__filename, async () => {
|
||||
|
||||
const trie1 = createTrie(domainSets);
|
||||
domainSuffixSet.forEach(suffix => {
|
||||
// eslint-disable-next-line sukka/unicorn/no-array-method-this-argument -- this is not array
|
||||
trie1.find(suffix, true).forEach(f => domainSets.delete(f));
|
||||
});
|
||||
filterRuleWhitelistDomainSets.forEach(suffix => {
|
||||
// eslint-disable-next-line sukka/unicorn/no-array-method-this-argument -- this is not array
|
||||
trie1.find(suffix, true).forEach(f => domainSets.delete(f));
|
||||
});
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ const CLASH_SUPPORTED_RULE_TYPE = [
|
||||
*/
|
||||
const surgeRulesetToClashClassicalTextRuleset = (rules) => {
|
||||
const trie = Trie.from(rules);
|
||||
return CLASH_SUPPORTED_RULE_TYPE.map(
|
||||
return CLASH_SUPPORTED_RULE_TYPE.flatMap(
|
||||
type => trie.find(`${type},`)
|
||||
).flat();
|
||||
);
|
||||
};
|
||||
module.exports.surgeRulesetToClashClassicalTextRuleset = surgeRulesetToClashClassicalTextRuleset;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ const domainDeduper = (inputDomains) => {
|
||||
}
|
||||
|
||||
// delete all included subdomains (ends with `.example.com`)
|
||||
// eslint-disable-next-line sukka/unicorn/no-array-method-this-argument -- it is not an array
|
||||
trie.find(d, false).forEach(f => sets.delete(f));
|
||||
|
||||
// if `.example.com` exists, then `example.com` should also be removed
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Suffix Trie based on Mnemonist Trie
|
||||
*/
|
||||
|
||||
const SENTINEL = String.fromCharCode(0);
|
||||
const SENTINEL = String.fromCodePoint(0);
|
||||
|
||||
/**
|
||||
* @param {string[] | Set<string>} [from]
|
||||
|
||||
Reference in New Issue
Block a user