diff --git a/eslint.config.mjs b/eslint.config.mjs index fe98dad1..b4c32bcc 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -2,31 +2,19 @@ import antfu from '@antfu/eslint-config' import harlanzw from 'eslint-plugin-harlanzw' export default antfu( + { type: 'lib', vue: true }, + ...harlanzw({ + base: { ignores: ['docs/**'] }, + link: true, + nuxt: true, + vue: true, + }), { - type: 'lib', - ignores: [ - 'CLAUDE.md', - 'test/fixtures/**', - 'playground/**', - 'docs/**', - ], rules: { - 'no-use-before-define': 'off', - 'node/prefer-global/process': 'off', - 'node/prefer-global/buffer': 'off', - 'ts/explicit-function-return-type': 'off', + // bot matchers and robots.txt rules are built from user config at runtime 'e18e/prefer-static-regex': 'off', }, }, - { - files: ['**/test/**/*.ts', '**/test/**/*.js'], - rules: { - 'ts/no-unsafe-function-type': 'off', - 'no-console': 'off', - 'antfu/no-top-level-await': 'off', - }, - }, - ...harlanzw({ link: true, nuxt: true, vue: true }), { files: ['**/server/**/*.ts', '**/src/**/*.ts'], rules: { @@ -34,12 +22,4 @@ export default antfu( 'harlanzw/vue-require-composable-prefix': 'off', }, }, - { - files: ['examples/**/package.json'], - rules: { - 'pnpm/json-enforce-catalog': 'off', - 'pnpm/json-valid-catalog': 'off', - 'pnpm/json-prefer-workspace-settings': 'off', - }, - }, ) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 086681ca..70d7e602 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,8 +58,8 @@ catalogs: specifier: ^10.8.0 version: 10.8.0 eslint-plugin-harlanzw: - specifier: ^0.17.1 - version: 0.17.1 + specifier: ^0.19.2 + version: 0.19.2 firebase-functions: specifier: ^7.3.2 version: 7.3.2 @@ -264,7 +264,7 @@ importers: version: 10.8.0(jiti@2.7.0)(supports-color@10.2.2) eslint-plugin-harlanzw: specifier: 'catalog:' - version: 0.17.1(eslint@10.8.0(jiti@2.7.0)(supports-color@10.2.2)) + version: 0.19.2(eslint@10.8.0(jiti@2.7.0)(supports-color@10.2.2)) execa: specifier: catalog:dev version: 10.0.1 @@ -4910,8 +4910,8 @@ packages: peerDependencies: eslint: '>=8' - eslint-plugin-harlanzw@0.17.1: - resolution: {integrity: sha512-JTqWyTYDdMGvo5RDQ1ugq8Y2hGhcSL432WZX3ls52Ie5e+L2MncacI5OrArWB6/8pO7pK3qdm+hgiaFVXmmHxw==} + eslint-plugin-harlanzw@0.19.2: + resolution: {integrity: sha512-aXVG5dupBlq2Nn94ffBcxw6iSK7OoFoPriWQW2RlE2FHP8PiQt2hfOU1AxuYk0GqgNMIL9c3cKwdhw1RgyeRcw==} peerDependencies: eslint: '>=9.0.0' @@ -14510,7 +14510,7 @@ snapshots: eslint: 10.8.0(jiti@2.7.0)(supports-color@10.2.2) eslint-compat-utils: 0.5.1(eslint@10.8.0(jiti@2.7.0)(supports-color@10.2.2)) - eslint-plugin-harlanzw@0.17.1(eslint@10.8.0(jiti@2.7.0)(supports-color@10.2.2)): + eslint-plugin-harlanzw@0.19.2(eslint@10.8.0(jiti@2.7.0)(supports-color@10.2.2)): dependencies: '@eslint/plugin-kit': 0.7.2 eslint: 10.8.0(jiti@2.7.0)(supports-color@10.2.2) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 20679c39..fe5fb4db 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -54,7 +54,7 @@ catalog: consola: ^3.4.2 defu: ^6.1.7 eslint: ^10.8.0 - eslint-plugin-harlanzw: ^0.17.1 + eslint-plugin-harlanzw: ^0.19.2 firebase-functions: ^7.3.2 h3: ^1.15.11 happy-dom: ^20.11.1 diff --git a/scripts/generate-bot-matcher.ts b/scripts/generate-bot-matcher.ts index 7c65d5f9..2e32b83f 100644 --- a/scripts/generate-bot-matcher.ts +++ b/scripts/generate-bot-matcher.ts @@ -60,7 +60,7 @@ export function generateBotMatcherModule(definitions: readonly BotCategoryDefini return `// Generated by build.config.ts. Do not edit. -const defaultBotPattern = /(?=(?:${alternatives}))/g +const defaultBotPattern = /(?=${alternatives})/g const botTargets: number[] = [${botTargets.join(', ')}] export function matchDefaultBotTarget(value: string): number | undefined { diff --git a/src/generated-bot-matcher.ts b/src/generated-bot-matcher.ts index f49f1295..bf1302cb 100644 --- a/src/generated-bot-matcher.ts +++ b/src/generated-bot-matcher.ts @@ -1,6 +1,6 @@ // Generated by build.config.ts. Do not edit. -const defaultBotPattern = /(?=(?:(googlebot)|(google\.com\/bot\.html)|(bingbot)|(msnbot)|(yandexbot)|(baiduspider)|(baidu\.com)|(duckduckbot)|(duckduckgo\.com)|(slurp)|(applebot)|(twitterbot)|(twitter)|(facebookexternalhit)|(facebook\.com)|(linkedinbot)|(linkedin)|(pinterestbot)|(pinterest)|(discordbot)|(discordapp)|(mj12bot)|(majestic12\.co\.uk\/bot)|(ahrefsbot)|(ahrefs\.com)|(semrushbot)|(semrush\.com\/bot)|(screaming frog)|(screamingfrog\.co\.uk)|(rogerbot)|(anthropic)|(claude)|(gptbot)|(openai\.com)|(google-extended)|(bytespider)|(diffbot)|(cohere)|(ccbot)|(commoncrawl\.org)|(perplexitybot)|(perplexity\.ai)|(bot)|(spider)|(crawler)|(scraper)|(phantomjs)|(headless)|(playwright)|(selenium)|(webdriver)|(puppeteer)|(python-requests)|(python)|(wget)|(curl)|(zgrab)|(masscan)|(nmap)|(insecure\.org)|(nikto)|(wpscan)|(scrapy)))/g +const defaultBotPattern = /(?=(googlebot)|(google\.com\/bot\.html)|(bingbot)|(msnbot)|(yandexbot)|(baiduspider)|(baidu\.com)|(duckduckbot)|(duckduckgo\.com)|(slurp)|(applebot)|(twitterbot)|(twitter)|(facebookexternalhit)|(facebook\.com)|(linkedinbot)|(linkedin)|(pinterestbot)|(pinterest)|(discordbot)|(discordapp)|(mj12bot)|(majestic12\.co\.uk\/bot)|(ahrefsbot)|(ahrefs\.com)|(semrushbot)|(semrush\.com\/bot)|(screaming frog)|(screamingfrog\.co\.uk)|(rogerbot)|(anthropic)|(claude)|(gptbot)|(openai\.com)|(google-extended)|(bytespider)|(diffbot)|(cohere)|(ccbot)|(commoncrawl\.org)|(perplexitybot)|(perplexity\.ai)|(bot)|(spider)|(crawler)|(scraper)|(phantomjs)|(headless)|(playwright)|(selenium)|(webdriver)|(puppeteer)|(python-requests)|(python)|(wget)|(curl)|(zgrab)|(masscan)|(nmap)|(insecure\.org)|(nikto)|(wpscan)|(scrapy))/g const botTargets: number[] = [0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 256, 256, 257, 257, 258, 258, 259, 259, 260, 260, 512, 512, 513, 513, 514, 514, 515, 515, 516, 768, 769, 770, 770, 771, 773, 774, 776, 777, 777, 778, 778, 1024, 1025, 1026, 1027, 1280, 1284, 1282, 1283, 1283, 1284, 1536, 1536, 1537, 1538, 1792, 1793, 1794, 1794, 1795, 1796, 2048] export function matchDefaultBotTarget(value: string): number | undefined {