Skip to content

Update encoding sniffer to latest version 1.0.2#5163

Closed
ajaymathur wants to merge 1 commit intocheeriojs:mainfrom
ajaymathur:amathur/upgrade-encoding-sniffer
Closed

Update encoding sniffer to latest version 1.0.2#5163
ajaymathur wants to merge 1 commit intocheeriojs:mainfrom
ajaymathur:amathur/upgrade-encoding-sniffer

Conversation

@ajaymathur
Copy link
Copy Markdown

@ajaymathur ajaymathur commented Mar 19, 2026

Fixes: #4977

Upgraded encoding-sniffer to latest version.

Local testing state

I was not able to run unit tests or lint in local due to error:

Error: File 'astro/tsconfigs/strict' not found.
Occurred while linting /Users/.../cheerio/website/astro.config.mjs:1
Rule: "n/file-extension-in-import"
    at resolveExtends (/Users/.../cheerio/node_modules/get-tsconfig/dist/index.cjs:7:7253)
    at _parseTsconfig (/Users/.../cheerio/node_modules/get-tsconfig/dist/index.cjs:7:8146)
    at parseTsconfig (/Users/...cheerio/node_modules/get-tsconfig/dist/index.cjs:7:13141)
    at getTsconfig (/Users/.../cheerio/node_modules/get-tsconfig/dist/index.cjs:7:13697)
    at getTSConfigForFile (/Users/.../cheerio/node_modules/eslint-plugin-n/lib/util/get-tsconfig.js:24:12)
    at getTSConfigForContext (/Users/.../cheerio/node_modules/eslint-plugin-n/lib/util/get-tsconfig.js:36:12)
    at getFromTSConfigFromFile (/Users/.../cheerio/node_modules/eslint-plugin-n/lib/util/get-typescript-extension-map.js:116:35)
    at getTypescriptExtensionMap (/Users/.../cheerio/node_modules/eslint-plugin-n/lib/util/get-typescript-extension-map.js:142:9)
    at convertTsExtensionToJs (/Users/.../cheerio/node_modules/eslint-plugin-n/lib/util/map-typescript-extension.js:20:25)
    at verify (/Users/.../cheerio/node_modules/eslint-plugin-n/lib/rules/file-extension-in-import.js:171:31)

I have raised the PR to verify these in github checks while I try to get local testing up.

@ajaymathur ajaymathur changed the title [NOT READY] Update encoding sniffer to latest version 1.0.2 Update encoding sniffer to latest version 1.0.2 Mar 19, 2026
@ara303
Copy link
Copy Markdown

ara303 commented Mar 19, 2026

This PR is the same as #5157, which has a linting failure because encoding-sniffer has to be included with different sytnax now:

../dist/commonjs/index.d.ts:10:37 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("encoding-sniffer")' call instead.
 
10 import { type SnifferOptions } from 'encoding-sniffer';
                                       ~~~~~~~~~~~~~~~~~~

[error] Found 1 errors and 0 warnings

@fb55
Copy link
Copy Markdown
Member

fb55 commented Mar 20, 2026

Hi @ajaymathur, thanks for raising! encoding-sniffer is esm-only now, and I'm currently working through the dependency tree of cheerio to make all other modules esm-only as well.

@ajaymathur
Copy link
Copy Markdown
Author

Thanks @fb55 , please let me know if I can help in anyway. :)

@ChALkeR
Copy link
Copy Markdown

ChALkeR commented Mar 26, 2026

I left some comments on that PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

NPM deprecation warning due to whatwg-encoding package

4 participants