Skip to content

Commit f536199

Browse files
authored
fix(eslint-plugin-query): add footer workaround for CJS default export in modernConfig (TanStack#8991)
1 parent ba18d2a commit f536199

File tree

5 files changed

+24
-128
lines changed

5 files changed

+24
-128
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2+
"parser": "@typescript-eslint/parser",
3+
"plugins": ["@typescript-eslint"],
24
"extends": ["plugin:@tanstack/query/recommended"]
35
}

examples/react/eslint-legacy/package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dev": "vite",
77
"build": "vite build",
88
"preview": "vite preview",
9-
"test:eslint": "eslint ./src"
9+
"test:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint ./src/**/*.tsx"
1010
},
1111
"dependencies": {
1212
"@tanstack/query-sync-storage-persister": "^5.73.1",
@@ -18,11 +18,19 @@
1818
},
1919
"devDependencies": {
2020
"@tanstack/eslint-plugin-query": "^5.72.2",
21-
"eslint": "^8.16.0",
2221
"@types/react": "^18.2.79",
2322
"@types/react-dom": "^18.2.25",
2423
"@vitejs/plugin-react": "^4.3.4",
2524
"typescript": "5.8.2",
2625
"vite": "^6.2.4"
26+
},
27+
"nx": {
28+
"targets": {
29+
"test:eslint": {
30+
"dependsOn": [
31+
"^build"
32+
]
33+
}
34+
}
2735
}
2836
}

examples/react/eslint-legacy/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
"noUnusedParameters": true,
2121
"noFallthroughCasesInSwitch": true
2222
},
23-
"include": ["src", "eslint.config.js"]
23+
"include": ["src"]
2424
}

packages/eslint-plugin-query/root.tsup.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ export function modernConfig(opts) {
1515
sourcemap: true,
1616
clean: true,
1717
external: ['typescript'],
18+
footer: ({ format }) => {
19+
if (format === 'cjs') {
20+
// workaround for CJS default export
21+
// @see https://github.com/evanw/esbuild/issues/1182#issuecomment-1011414271
22+
return { js: `module.exports = module.exports.default` }
23+
}
24+
25+
return
26+
},
1827
}
1928
}
2029

pnpm-lock.yaml

Lines changed: 2 additions & 125 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)