File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22/yarn.lock
33/package-lock.json
44/pnpm-lock.yaml
5- /bun.lockb
5+ /bun.lockb
6+ /types
Original file line number Diff line number Diff line change 11{
22 "name" : " eslint-plugin-only-warn" ,
3- "version" : " 1.1 .0" ,
3+ "version" : " 1.2 .0" ,
44 "license" : " MIT" ,
55 "description" : " Downgrade errors to warnings" ,
66 "keywords" : [
1616 },
1717 "type" : " commonjs" ,
1818 "main" : " src/only-warn.js" ,
19+ "types" : " types/only-warn.d.ts" ,
1920 "prettier" : {},
2021 "scripts" : {
21- "lint" : " prettier --check . && eslint ." ,
22+ "lint" : " prettier --check . && eslint . && tsc " ,
2223 "format" : " eslint --fix . && prettier --write ." ,
2324 "test" : " vitest run" ,
24- "test:watch" : " vitest"
25+ "test:watch" : " vitest" ,
26+ "prepublish" : " rm -rf types && tsc"
2527 },
2628 "devDependencies" : {
27- "eslint" : " ^9.4.0" ,
28- "eslint-config-prettier" : " ^9.1.0" ,
29- "prettier" : " ^3.2.5" ,
30- "vitest" : " ^1.6.0"
29+ "@eslint/js" : " ^10.0.1" ,
30+ "@types/node" : " ^25.3.2" ,
31+ "eslint" : " ^10.0.2" ,
32+ "eslint-config-prettier" : " ^10.1.8" ,
33+ "prettier" : " ^3.8.1" ,
34+ "typescript" : " ^5.9.3" ,
35+ "vitest" : " ^4.0.18"
3136 }
3237}
Original file line number Diff line number Diff line change 1+ // @ts -check
12const path = require ( "path" ) ;
23
34const SEARCH_STR = `${ path . sep } node_modules${ path . sep } eslint${ path . sep } ` ;
45
56module . exports = function getEslintModules ( ) {
7+ /** @type {Record<string, any> } */
68 const map = { } ;
79 Object . keys ( require . cache ) . forEach ( ( modulePath ) => {
810 const pos = modulePath . indexOf ( SEARCH_STR ) ;
Original file line number Diff line number Diff line change 1+ // @ts -check
12const getEslintModules = require ( "./get-eslint-modules" ) ;
23
34const unpatchedVerify = Symbol ( "verify" ) ;
45
56/**
67 * Patch the verify method and downgrade the errors to warnings.
8+ * @param {Record<string | symbol, any> } LinterPrototype
79 */
810function patch ( LinterPrototype ) {
911 if ( LinterPrototype [ unpatchedVerify ] ) {
1012 return ;
1113 }
1214 LinterPrototype [ unpatchedVerify ] = LinterPrototype . verify ;
1315 LinterPrototype . verify = function ( ) {
16+ /** @type ReturnType<import("eslint").Linter["verify"]> */
1417 const messages = LinterPrototype [ unpatchedVerify ] . apply ( this , arguments ) ;
1518 messages . forEach ( ( message ) => {
1619 if ( ! message . fatal && message . severity === 2 ) {
@@ -23,6 +26,7 @@ function patch(LinterPrototype) {
2326
2427/**
2528 * Remove the patch
29+ * @param {Record<string | symbol, any> } LinterPrototype
2630 */
2731function unpatch ( LinterPrototype ) {
2832 if ( LinterPrototype [ unpatchedVerify ] ) {
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "module" : " nodenext" ,
4+ "target" : " esnext" ,
5+ "declaration" : true ,
6+ "noUncheckedIndexedAccess" : true ,
7+ "exactOptionalPropertyTypes" : true ,
8+ "strict" : true ,
9+ "skipLibCheck" : true ,
10+ "allowJs" : true ,
11+ "emitDeclarationOnly" : true ,
12+ "outDir" : " ./types"
13+ },
14+ "include" : [" ./src" ]
15+ }
You can’t perform that action at this time.
0 commit comments