diff --git a/package.json b/package.json index 9c823b40..682f4b0a 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "devDependencies": { "@types/node": "catalog:", "cspell-ban-words": "catalog:", + "globals": "catalog:", "heading-case": "catalog:", "prettier": "catalog:", "rstack": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b1d9b06d..c3ad4f86 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,8 +23,8 @@ catalogs: specifier: ~1.0.0-beta.2 version: 1.0.0-beta.2 '@rslint/core': - specifier: ~0.7.3 - version: 0.7.3 + specifier: ~0.8.0 + version: 0.8.0 '@rspress/core': specifier: ^2.0.19 version: 2.0.19 @@ -85,6 +85,9 @@ catalogs: fast-json-stable-stringify: specifier: 2.1.0 version: 2.1.0 + globals: + specifier: ^17.7.0 + version: 17.9.0 happy-dom: specifier: ^20.11.2 version: 20.11.2 @@ -159,6 +162,9 @@ importers: cspell-ban-words: specifier: 'catalog:' version: 0.0.4 + globals: + specifier: 'catalog:' + version: 17.9.0 heading-case: specifier: 'catalog:' version: 1.1.5 @@ -366,7 +372,7 @@ importers: version: 1.0.0-beta.2(typescript@7.0.2) '@rslint/core': specifier: 'catalog:' - version: 0.7.3 + version: 0.8.0 '@rstest/core': specifier: 'catalog:' version: 0.11.6(happy-dom@20.11.2) @@ -1298,8 +1304,8 @@ packages: typescript: optional: true - '@rslint/core@0.7.3': - resolution: {integrity: sha512-vRg6dOzyTie/fMOfvQ+4v3CoZ+IMyAfWyFC9bYf2QiKOV+csE/JHTV+yvh68YAEZvsDuQr35+8yerJFYLaFMPw==} + '@rslint/core@0.8.0': + resolution: {integrity: sha512-MfMC6lxiXoKPWsYRu9fuAxWA9mCD/I4E5Aa6Sl20a6q5w8r2C12fJM+bceC01AMGYuvWygKHqS3QBJdJHjniRw==} hasBin: true peerDependencies: jiti: ^2.7.0 @@ -1307,47 +1313,47 @@ packages: jiti: optional: true - '@rslint/native-darwin-arm64@0.7.3': - resolution: {integrity: sha512-BJOWoF5lD+6Kyigxfo38rXviS5cvHgZwQJ2zOjAal2Xiv2mn8Il88KGs8M/KwWNryFcQPGp5wjk6i6uPHwYb1w==} + '@rslint/native-darwin-arm64@0.8.0': + resolution: {integrity: sha512-Bo6kXL1/TkjVUl6maZ3Sw+JEnZUkgpUD35v06jyBTcjpxlXE6yqFj66NAzB/G2CVu220ADp/FEE7l2Kocrefhg==} cpu: [arm64] os: [darwin] - '@rslint/native-darwin-x64@0.7.3': - resolution: {integrity: sha512-3WIJocfinQs9YkzqgNXBIQNOylpz4IUI6LPzARE4tUJz9GgZF9Q7IEuscpVgkVUkh/P+Pr4CUplivggzXiBFBw==} + '@rslint/native-darwin-x64@0.8.0': + resolution: {integrity: sha512-F5pabdH7dluxoj7PGuQjPYuoNU+yxnctcJzqrb/CZ122FLP3uJPrbiLufh+ZF9e5ui700rNyb7macJqnHlBV2w==} cpu: [x64] os: [darwin] - '@rslint/native-linux-arm64-gnu@0.7.3': - resolution: {integrity: sha512-lLKQ+A/GiTvzOjtiK0euWul40nmQziR925JXznqcXgT0g1UdU7FwWdcy6l/UCQW8aVgzycV8yJMdaKmz+6H7Vg==} + '@rslint/native-linux-arm64-gnu@0.8.0': + resolution: {integrity: sha512-SSgSjyaeXI032Wk8bq6VmkLQTWOEqHZH5MWAk3831pd/G2rWr2XcoDi5Wf6w0o2rSCeYzkYbIejOePYwIKT4Lg==} cpu: [arm64] os: [linux] libc: [glibc] - '@rslint/native-linux-arm64-musl@0.7.3': - resolution: {integrity: sha512-i6jVTIii8eIHFfb/UNMNRvZGPiW/yH4ZgfX/+77kxAnAYHm0wx2qXakW9M8LDTdtCz1UBqV0UL7NB4gBQyDPwQ==} + '@rslint/native-linux-arm64-musl@0.8.0': + resolution: {integrity: sha512-50VDZQFAc9kp6rbOUOjyppVjC3d3AdbOJyA6JxlhK3mp8a/8sPIqWG0BlfcN/7ZpwdZrFsQt2Ds+0yMXITfu5A==} cpu: [arm64] os: [linux] libc: [musl] - '@rslint/native-linux-x64-gnu@0.7.3': - resolution: {integrity: sha512-Qta8uiB4c3zuLK/1pCgx9DzhtCvQ/i31TDoNSA3WpY17Tsa82CGXho1l6bCA1/9dbuOz5lwCsYALQLVe8/o/rQ==} + '@rslint/native-linux-x64-gnu@0.8.0': + resolution: {integrity: sha512-wfc/UfnuTBAofwLPK5MLB2Hus1YYnsxP2MVchp380fUvMfQuGFPzz1WOAUY66zqrsrDKpUJsh3V1bx7c8DTlJA==} cpu: [x64] os: [linux] libc: [glibc] - '@rslint/native-linux-x64-musl@0.7.3': - resolution: {integrity: sha512-urpqLlJISIFAtiXCGGwRZgfnSYpFDi5lzk6ibSgBPvJmv94yhxMpDoutpHTA3UyVDeH33axYGRonImLf7UfBSA==} + '@rslint/native-linux-x64-musl@0.8.0': + resolution: {integrity: sha512-MTYcAMz6IZWb6ZmLo12pakCBA8mS3EW9cOI0jd3At6vs0Yia9YbeOAUiWbIC4Z9yyp75b8ZQCQMRSnY6rDnbaA==} cpu: [x64] os: [linux] libc: [musl] - '@rslint/native-win32-arm64-msvc@0.7.3': - resolution: {integrity: sha512-jcxjgUPMl725p0wjXLPIPMeARK41FwHXiWVmg4AqIHJBfpXpwM+xozVn4Dd5GL3TO38zjmP881bKOvtPwnFl0Q==} + '@rslint/native-win32-arm64-msvc@0.8.0': + resolution: {integrity: sha512-hids2jgNWBxZf2mSBLZJxubWRLWlJapEfeJHVokzjpRpBZZNv7O06enoyXSb4Lswff9WaHssIqu1sfZIc9lC2g==} cpu: [arm64] os: [win32] - '@rslint/native-win32-x64-msvc@0.7.3': - resolution: {integrity: sha512-R87nmvTUZry9DPF8Cz6TGLLAikIyUxHDPwzonrYaJ0kTLeJAgDMfVIY1s5pUxF3heQD6G2QXjhpU/uPwqnvmzg==} + '@rslint/native-win32-x64-msvc@0.8.0': + resolution: {integrity: sha512-bun7uURKl6NdChwmw/i2mk3Yj9klZQyh1uRbIQG0RDEJ9oTIbU5M3c7K5sd/Rukat0TVCGgbBAzR+YB0DAXPZQ==} cpu: [x64] os: [win32] @@ -2141,6 +2147,10 @@ packages: git-hooks-list@4.2.1: resolution: {integrity: sha512-WNvqJjOxxs/8ZP9+DWdwWJ7cDsd60NHf39XnD82pDVrKO5q7xfPqpkK6hwEAmBa/ZSEE4IOoR75EzbbIuwGlMw==} + globals@17.9.0: + resolution: {integrity: sha512-m/MvAW61QVU5VDNF1Vj8axt016h8w7L5TU1e9zlab7XIttAT2YAlCwl75K1fOqvMM9apmD7lbCIRhpfkhmxhCg==} + engines: {node: '>=18'} + happy-dom@20.11.2: resolution: {integrity: sha512-7MB+bJLkxu3SowAfBJbjW+c55kNz5tkR45gu2qzrxznezhLeN5YIlJbwUgSzlGc+qWoZ8Ykg71H5ezz69xixrw==} engines: {node: '>=20.0.0'} @@ -3786,41 +3796,41 @@ snapshots: - '@module-federation/runtime-tools' - core-js - '@rslint/core@0.7.3': + '@rslint/core@0.8.0': dependencies: picomatch: 4.0.5 optionalDependencies: - '@rslint/native-darwin-arm64': 0.7.3 - '@rslint/native-darwin-x64': 0.7.3 - '@rslint/native-linux-arm64-gnu': 0.7.3 - '@rslint/native-linux-arm64-musl': 0.7.3 - '@rslint/native-linux-x64-gnu': 0.7.3 - '@rslint/native-linux-x64-musl': 0.7.3 - '@rslint/native-win32-arm64-msvc': 0.7.3 - '@rslint/native-win32-x64-msvc': 0.7.3 + '@rslint/native-darwin-arm64': 0.8.0 + '@rslint/native-darwin-x64': 0.8.0 + '@rslint/native-linux-arm64-gnu': 0.8.0 + '@rslint/native-linux-arm64-musl': 0.8.0 + '@rslint/native-linux-x64-gnu': 0.8.0 + '@rslint/native-linux-x64-musl': 0.8.0 + '@rslint/native-win32-arm64-msvc': 0.8.0 + '@rslint/native-win32-x64-msvc': 0.8.0 - '@rslint/native-darwin-arm64@0.7.3': + '@rslint/native-darwin-arm64@0.8.0': optional: true - '@rslint/native-darwin-x64@0.7.3': + '@rslint/native-darwin-x64@0.8.0': optional: true - '@rslint/native-linux-arm64-gnu@0.7.3': + '@rslint/native-linux-arm64-gnu@0.8.0': optional: true - '@rslint/native-linux-arm64-musl@0.7.3': + '@rslint/native-linux-arm64-musl@0.8.0': optional: true - '@rslint/native-linux-x64-gnu@0.7.3': + '@rslint/native-linux-x64-gnu@0.8.0': optional: true - '@rslint/native-linux-x64-musl@0.7.3': + '@rslint/native-linux-x64-musl@0.8.0': optional: true - '@rslint/native-win32-arm64-msvc@0.7.3': + '@rslint/native-win32-arm64-msvc@0.8.0': optional: true - '@rslint/native-win32-x64-msvc@0.7.3': + '@rslint/native-win32-x64-msvc@0.8.0': optional: true '@rspack/binding-darwin-arm64@2.1.8': @@ -4492,6 +4502,8 @@ snapshots: git-hooks-list@4.2.1: {} + globals@17.9.0: {} + happy-dom@20.11.2: dependencies: '@types/node': 24.13.3 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index d91cd99d..460655d2 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -17,7 +17,7 @@ catalog: '@rsbuild/plugin-react': '^2.1.0' '@rsbuild/plugin-sass': '^2.0.1' '@rslib/core': '~1.0.0-beta.2' - '@rslint/core': '~0.7.3' + '@rslint/core': '~0.8.0' '@rspress/core': '^2.0.19' '@rspress/plugin-client-redirects': '^2.0.19' '@rspress/plugin-sitemap': '^2.0.19' @@ -38,6 +38,7 @@ catalog: '@shikijs/transformers': '^4.4.2' 'cspell-ban-words': '^0.0.4' 'fast-json-stable-stringify': '2.1.0' + globals: '^17.7.0' 'happy-dom': '^20.11.2' 'heading-case': '^1.1.5' 'import-meta-resolve': '4.2.0' diff --git a/rstack.config.ts b/rstack.config.ts index 9ffac863..0ad535cf 100644 --- a/rstack.config.ts +++ b/rstack.config.ts @@ -2,10 +2,23 @@ import { define } from 'rstack'; define.lint(async () => { + const { default: globals } = await import('globals'); const { js, ts } = await import('rstack/lint'); return [ js.configs.recommended, ts.configs.recommended, + { + files: ['**/*.{js,jsx,cjs,mjs}'], + languageOptions: { + globals: { + ...globals.browser, + ...globals.nodeBuiltin, + DEFINE_APP_TEST_VALUE: 'readonly', + DEFINE_LIB_TEST_VALUE: 'readonly', + DEFINE_VALUE: 'readonly', + }, + }, + }, // Source imports use .ts for Node.js native TypeScript execution; builds rewrite them to .js. { files: ['packages/rstack/src/**/*.ts'],