From 6df860c1cdb89442c1c096c5f2b91e855e237ce9 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Sat, 15 Jun 2024 20:35:54 +0800 Subject: [PATCH] Test TSSLint --- eslint.config.js | 182 ++++------------------------------------------ package.json | 7 +- pnpm-lock.yaml | 178 +++++++++++++++++++++++++++++++++++++++++++++ tsconfig.json | 11 +-- tsslint.config.ts | 52 +++++++++++++ 5 files changed, 250 insertions(+), 180 deletions(-) create mode 100644 tsslint.config.ts diff --git a/eslint.config.js b/eslint.config.js index 334787fd988..fffbc1eb566 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,174 +1,18 @@ -import importX from 'eslint-plugin-import-x' import tseslint from 'typescript-eslint' -import vitest from 'eslint-plugin-vitest' -import { builtinModules } from 'node:module' -const DOMGlobals = ['window', 'document'] -const NodeGlobals = ['module', 'require'] - -const banConstEnum = { - selector: 'TSEnumDeclaration[const=true]', - message: - 'Please use non-const enums. This project automatically inlines enums.', -} - -export default tseslint.config( - { - files: ['**/*.js', '**/*.ts', '**/*.tsx'], - extends: [tseslint.configs.base], - plugins: { - 'import-x': importX, - }, - rules: { - 'no-debugger': 'error', - 'no-console': ['error', { allow: ['warn', 'error', 'info'] }], - // most of the codebase are expected to be env agnostic - 'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals], - - 'no-restricted-syntax': [ - 'error', - banConstEnum, - { - selector: 'ObjectPattern > RestElement', - message: - 'Our output target is ES2016, and object rest spread results in ' + - 'verbose helpers and should be avoided.', - }, - { - selector: 'ObjectExpression > SpreadElement', - message: - 'esbuild transpiles object spread into very verbose inline helpers.\n' + - 'Please use the `extend` helper from @vue/shared instead.', - }, - { - selector: 'AwaitExpression', - message: - 'Our output target is ES2016, so async/await syntax should be avoided.', - }, - { - selector: 'ChainExpression', - message: - 'Our output target is ES2016, and optional chaining results in ' + - 'verbose helpers and should be avoided.', - }, - ], - 'sort-imports': ['error', { ignoreDeclarationSort: true }], - - 'import-x/no-nodejs-modules': [ - 'error', - { allow: builtinModules.map(mod => `node:${mod}`) }, - ], - // This rule enforces the preference for using '@ts-expect-error' comments in TypeScript - // code to indicate intentional type errors, improving code clarity and maintainability. - '@typescript-eslint/prefer-ts-expect-error': 'error', - // Enforce the use of 'import type' for importing types - '@typescript-eslint/consistent-type-imports': [ - 'error', - { - fixStyle: 'inline-type-imports', - disallowTypeAnnotations: false, - }, - ], - // Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers - '@typescript-eslint/no-import-type-side-effects': 'error', - }, - }, - - // tests, no restrictions (runs in Node / Vitest with jsdom) - { - files: ['**/__tests__/**', 'packages/dts-test/**'], - plugins: { vitest }, - languageOptions: { - globals: { - ...vitest.environments.env.globals, - }, - }, - rules: { - 'no-console': 'off', - 'no-restricted-globals': 'off', - 'no-restricted-syntax': 'off', - 'vitest/no-disabled-tests': 'error', - 'vitest/no-focused-tests': 'error', - }, - }, - - // shared, may be used in any env - { - files: ['packages/shared/**', 'eslint.config.js'], - rules: { - 'no-restricted-globals': 'off', +export default tseslint.config({ + languageOptions: { + parserOptions: { + project: ['tsconfig.json'], }, }, - - // Packages targeting DOM - { - files: ['packages/{vue,vue-compat,runtime-dom}/**'], - rules: { - 'no-restricted-globals': ['error', ...NodeGlobals], - }, - }, - - // Packages targeting Node - { - files: ['packages/{compiler-sfc,compiler-ssr,server-renderer}/**'], - rules: { - 'no-restricted-globals': ['error', ...DOMGlobals], - 'no-restricted-syntax': ['error', banConstEnum], - }, - }, - - // Private package, browser only + no syntax restrictions - { - files: ['packages/template-explorer/**', 'packages/sfc-playground/**'], - rules: { - 'no-restricted-globals': ['error', ...NodeGlobals], - 'no-restricted-syntax': ['error', banConstEnum], - 'no-console': 'off', - }, - }, - - // JavaScript files - { - files: ['*.js'], - rules: { - // We only do `no-unused-vars` checks for js files, TS files are checked by TypeScript itself. - 'no-unused-vars': ['error', { vars: 'all', args: 'none' }], - }, - }, - - // Node scripts - { - files: [ - 'eslint.config.js', - 'rollup*.config.js', - 'scripts/**', - './*.{js,ts}', - 'packages/*/*.js', - 'packages/vue/*/*.js', - ], - rules: { - 'no-restricted-globals': 'off', - 'no-restricted-syntax': ['error', banConstEnum], - 'no-console': 'off', - }, - }, - - // Import nodejs modules in compiler-sfc - { - files: ['packages/compiler-sfc/src/**'], - rules: { - 'import-x/no-nodejs-modules': ['error', { allow: builtinModules }], - }, - }, - - { - ignores: [ - '**/dist/', - '**/temp/', - '**/coverage/', - '.idea/', - 'explorations/', - 'dts-build/packages', - ], + files: ['packages/global.d.ts', 'packages/*/src/**/*.ts'], + extends: [tseslint.configs.base], + rules: { + '@typescript-eslint/no-unnecessary-type-assertion': 'warn', + '@typescript-eslint/prefer-nullish-coalescing': 'warn', + '@typescript-eslint/strict-boolean-expressions': 'warn', + '@typescript-eslint/switch-exhaustiveness-check': 'warn', + '@typescript-eslint/no-unnecessary-condition': 'warn', }, -) +}) diff --git a/package.json b/package.json index ca8efc6835d..e024726f5bc 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,9 @@ "build-ssr-esm": "node scripts/build.js compiler-sfc server-renderer -f esm-browser", "build-sfc-playground-self": "cd packages/sfc-playground && npm run build", "preinstall": "npx only-allow pnpm", - "postinstall": "simple-git-hooks" + "postinstall": "simple-git-hooks", + "eslint-time": "time eslint", + "tsslint-time": "time tsslint --project ./tsconfig.json" }, "simple-git-hooks": { "pre-commit": "pnpm lint-staged && pnpm check", @@ -68,6 +70,9 @@ "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-replace": "5.0.4", "@rollup/plugin-terser": "^0.4.4", + "@tsslint/cli": "^1.0.6", + "@tsslint/config": "^1.0.6", + "@tsslint/eslint": "^1.0.6", "@types/hash-sum": "^1.0.2", "@types/minimist": "^1.2.5", "@types/node": "^20.14.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 83236c68737..dc4e644e0e0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,6 +35,15 @@ importers: '@rollup/plugin-terser': specifier: ^0.4.4 version: 0.4.4(rollup@4.18.0) + '@tsslint/cli': + specifier: ^1.0.6 + version: 1.0.6(typescript@5.4.5) + '@tsslint/config': + specifier: ^1.0.6 + version: 1.0.6 + '@tsslint/eslint': + specifier: ^1.0.6 + version: 1.0.6(typescript@5.4.5) '@types/hash-sum': specifier: ^1.0.2 version: 1.0.2 @@ -511,6 +520,14 @@ packages: resolution: {integrity: sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==} engines: {node: '>=6.9.0'} + '@clack/core@0.3.4': + resolution: {integrity: sha512-H4hxZDXgHtWTwV3RAVenqcC4VbJZNegbBjlPvzOzCouXtS2y3sDvlO3IsbrPNWuLWPPlYVYPghQdSF64683Ldw==} + + '@clack/prompts@0.7.0': + resolution: {integrity: sha512-0MhX9/B4iL6Re04jPrttDm+BsP8y6mS7byuv0BvXgdXhbV5PdlsHt55dvNsuBCPZ7xq1oTAOOuotR9NFbQyMSA==} + bundledDependencies: + - is-unicode-supported + '@codspeed/core@3.1.0': resolution: {integrity: sha512-oYd7X46QhnRkgRbZkqAoX9i3Fwm17FpunK4Ee5RdrvRYR0Xr93ewH8/O5g6uyTPDOOqDEv1v2KRYtWhVgN+2VQ==} @@ -1056,6 +1073,24 @@ packages: '@tootallnate/quickjs-emscripten@0.23.0': resolution: {integrity: sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==} + '@tsslint/cli@1.0.6': + resolution: {integrity: sha512-HcF75pnClCAjDbrSZBkg9Odf4jf83pewRqhzZh0fkmobODUUPEh+BtD9cIYLoJjFgAFIWzP8yFr9RA443JO+1Q==} + hasBin: true + peerDependencies: + typescript: '*' + + '@tsslint/config@1.0.6': + resolution: {integrity: sha512-gMXplKcpzxXCPxP4JsPQwoXHL1VLSTxmUl7uDj3F5Y4GbwtR8rZ/Zx5IuU0IKfdCK8rre2sMuAlacmWWQRU6dQ==} + + '@tsslint/core@1.0.6': + resolution: {integrity: sha512-I9ANrn0FWU0D7jozOxgYDj6vuBTMWSDAWk3sJSv1IoWiJOFZW7iWftzkji0FSEtNs5eoSpykZPgF+VmzDg26Mg==} + + '@tsslint/eslint@1.0.6': + resolution: {integrity: sha512-YYldAasBNI4qpiV5M6MGoq7jR4LXsP8DW80l0crhbLL2/Q8S0zj8RJAcJ9AArsJc4TXc8xn4QahPj0rHBI2wVg==} + + '@tsslint/types@1.0.6': + resolution: {integrity: sha512-4gyjUk04YF153S0TS7YoDGT92e+lf+OhlyKa4kGp/8sS2LH6LmzhBryY78LSI7Y5SCzSaNcSNd3dN0YfJXiQVA==} + '@types/estree@1.0.5': resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} @@ -1108,6 +1143,10 @@ packages: resolution: {integrity: sha512-itF1pTnN6F3unPak+kutH9raIkL3lhH1YRPGgt7QQOh43DQKVJXmWkpb+vpc/TiDHs6RSd9CTbDsc/Y+Ygq7kg==} engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/scope-manager@7.13.0': + resolution: {integrity: sha512-ZrMCe1R6a01T94ilV13egvcnvVJ1pxShkE0+NDjDzH4nvG1wXpwsVI5bZCvE7AEDH1mXEx5tJSVR68bLgG7Dng==} + engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/scope-manager@7.8.0': resolution: {integrity: sha512-viEmZ1LmwsGcnr85gIq+FCYI7nO90DVbE37/ll51hjv9aG+YZMb4WDE2fyWpUR4O/UrhGRpYXK/XajcGTk2B8g==} engines: {node: ^18.18.0 || >=20.0.0} @@ -1126,6 +1165,10 @@ packages: resolution: {integrity: sha512-o+0Te6eWp2ppKY3mLCU+YA9pVJxhUJE15FV7kxuD9jgwIAa+w/ycGJBMrYDTpVGUM/tgpa9SeMOugSabWFq7bg==} engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/types@7.13.0': + resolution: {integrity: sha512-QWuwm9wcGMAuTsxP+qz6LBBd3Uq8I5Nv8xb0mk54jmNoCyDspnMvVsOxI6IsMmway5d1S9Su2+sCKv1st2l6eA==} + engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/types@7.8.0': resolution: {integrity: sha512-wf0peJ+ZGlcH+2ZS23aJbOv+ztjeeP8uQ9GgwMJGVLx/Nj9CJt17GWgWWoSmoRVKAX2X+7fzEnAjxdvK2gqCLw==} engines: {node: ^18.18.0 || >=20.0.0} @@ -1139,6 +1182,15 @@ packages: typescript: optional: true + '@typescript-eslint/typescript-estree@7.13.0': + resolution: {integrity: sha512-cAvBvUoobaoIcoqox1YatXOnSl3gx92rCZoMRPzMNisDiM12siGilSM4+dJAekuuHTibI2hVC2fYK79iSFvWjw==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + '@typescript-eslint/typescript-estree@7.8.0': resolution: {integrity: sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg==} engines: {node: ^18.18.0 || >=20.0.0} @@ -1164,6 +1216,10 @@ packages: resolution: {integrity: sha512-uZk7DevrQLL3vSnfFl5bj4sL75qC9D6EdjemIdbtkuUmIheWpuiiylSY01JxJE7+zGrOWDZrp1WxOuDntvKrHQ==} engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/visitor-keys@7.13.0': + resolution: {integrity: sha512-nxn+dozQx+MK61nn/JP+M4eCkHDSxSLDpgE3WcQo0+fkjEolnaB5jswvIKC4K56By8MMgIho7f1PVxERHEo8rw==} + engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/visitor-keys@7.8.0': resolution: {integrity: sha512-q4/gibTNBQNA0lGyYQCmWRS5D15n8rXh4QjK3KV+MBPlTYHpfBUT3D3PaPR/HeNiI9W6R7FvlkcGhNyAoP+caA==} engines: {node: ^18.18.0 || >=20.0.0} @@ -1737,6 +1793,9 @@ packages: error-ex@1.3.2: resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} + error-stack-parser@2.1.4: + resolution: {integrity: sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==} + es-define-property@1.0.0: resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} engines: {node: '>= 0.4'} @@ -2025,6 +2084,11 @@ packages: engines: {node: '>=16 || 14 >=14.17'} hasBin: true + glob@10.4.1: + resolution: {integrity: sha512-2jelhlq3E4ho74ZyVLN03oKdAZVUa6UDZzFLVH1H7dnoax+y9qyaq8zBkfDIggjniU19z0wU18y16jMB2eyVIw==} + engines: {node: '>=16 || 14 >=14.18'} + hasBin: true + glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -2301,6 +2365,10 @@ packages: resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} engines: {node: '>=14'} + jackspeak@3.4.0: + resolution: {integrity: sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==} + engines: {node: '>=14'} + js-stringify@1.0.2: resolution: {integrity: sha512-rtS5ATOo2Q5k1G+DADISilDA6lv79zIiwFd6CcjuIxGKLFm5C+RLImRscVap9k55i+MOZwgliw+NejvkLuGD5g==} @@ -2537,6 +2605,10 @@ packages: resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} engines: {node: '>=16 || 14 >=14.17'} + minipass@7.1.2: + resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} + engines: {node: '>=16 || 14 >=14.17'} + mitt@3.0.1: resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} @@ -2712,6 +2784,10 @@ packages: resolution: {integrity: sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==} engines: {node: '>=16 || 14 >=14.17'} + path-scurry@1.11.1: + resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} + engines: {node: '>=16 || 14 >=14.18'} + path-to-regexp@2.2.1: resolution: {integrity: sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==} @@ -3074,6 +3150,9 @@ packages: resolution: {integrity: sha512-tgqwPUMDcNDhuf1Xf6KTUsyeqGdgKMhzaH4PAZZuzguOgTl5uuyeYe/8mWgAr6IBxB5V06uqEf6Dy37gIWDtDg==} hasBin: true + sisteransi@1.0.5: + resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -3138,6 +3217,9 @@ packages: stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + stackframe@1.3.4: + resolution: {integrity: sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==} + std-env@3.7.0: resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==} @@ -3693,6 +3775,17 @@ snapshots: '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 + '@clack/core@0.3.4': + dependencies: + picocolors: 1.0.1 + sisteransi: 1.0.5 + + '@clack/prompts@0.7.0': + dependencies: + '@clack/core': 0.3.4 + picocolors: 1.0.1 + sisteransi: 1.0.5 + '@codspeed/core@3.1.0': dependencies: axios: 1.6.8 @@ -4075,6 +4168,35 @@ snapshots: '@tootallnate/quickjs-emscripten@0.23.0': {} + '@tsslint/cli@1.0.6(typescript@5.4.5)': + dependencies: + '@clack/prompts': 0.7.0 + '@tsslint/config': 1.0.6 + '@tsslint/core': 1.0.6 + glob: 10.4.1 + typescript: 5.4.5 + + '@tsslint/config@1.0.6': + dependencies: + '@tsslint/types': 1.0.6 + esbuild: 0.21.5 + + '@tsslint/core@1.0.6': + dependencies: + error-stack-parser: 2.1.4 + source-map-support: 0.5.21 + + '@tsslint/eslint@1.0.6(typescript@5.4.5)': + dependencies: + '@typescript-eslint/scope-manager': 7.13.0 + '@typescript-eslint/typescript-estree': 7.13.0(typescript@5.4.5) + eslint: 9.4.0 + transitivePeerDependencies: + - supports-color + - typescript + + '@tsslint/types@1.0.6': {} + '@types/estree@1.0.5': {} '@types/hash-sum@1.0.2': {} @@ -4134,6 +4256,11 @@ snapshots: '@typescript-eslint/types': 7.12.0 '@typescript-eslint/visitor-keys': 7.12.0 + '@typescript-eslint/scope-manager@7.13.0': + dependencies: + '@typescript-eslint/types': 7.13.0 + '@typescript-eslint/visitor-keys': 7.13.0 + '@typescript-eslint/scope-manager@7.8.0': dependencies: '@typescript-eslint/types': 7.8.0 @@ -4153,6 +4280,8 @@ snapshots: '@typescript-eslint/types@7.12.0': {} + '@typescript-eslint/types@7.13.0': {} + '@typescript-eslint/types@7.8.0': {} '@typescript-eslint/typescript-estree@7.12.0(typescript@5.4.5)': @@ -4170,6 +4299,21 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/typescript-estree@7.13.0(typescript@5.4.5)': + dependencies: + '@typescript-eslint/types': 7.13.0 + '@typescript-eslint/visitor-keys': 7.13.0 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.4 + semver: 7.6.2 + ts-api-utils: 1.3.0(typescript@5.4.5) + optionalDependencies: + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/typescript-estree@7.8.0(typescript@5.4.5)': dependencies: '@typescript-eslint/types': 7.8.0 @@ -4215,6 +4359,11 @@ snapshots: '@typescript-eslint/types': 7.12.0 eslint-visitor-keys: 3.4.3 + '@typescript-eslint/visitor-keys@7.13.0': + dependencies: + '@typescript-eslint/types': 7.13.0 + eslint-visitor-keys: 3.4.3 + '@typescript-eslint/visitor-keys@7.8.0': dependencies: '@typescript-eslint/types': 7.8.0 @@ -4798,6 +4947,10 @@ snapshots: dependencies: is-arrayish: 0.2.1 + error-stack-parser@2.1.4: + dependencies: + stackframe: 1.3.4 + es-define-property@1.0.0: dependencies: get-intrinsic: 1.2.4 @@ -5195,6 +5348,14 @@ snapshots: minipass: 7.0.4 path-scurry: 1.10.2 + glob@10.4.1: + dependencies: + foreground-child: 3.1.1 + jackspeak: 3.4.0 + minimatch: 9.0.4 + minipass: 7.1.2 + path-scurry: 1.11.1 + glob@7.2.3: dependencies: fs.realpath: 1.0.0 @@ -5450,6 +5611,12 @@ snapshots: optionalDependencies: '@pkgjs/parseargs': 0.11.0 + jackspeak@3.4.0: + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + js-stringify@1.0.2: {} js-tokens@4.0.0: {} @@ -5687,6 +5854,8 @@ snapshots: minipass@7.0.4: {} + minipass@7.1.2: {} + mitt@3.0.1: {} mlly@1.6.1: @@ -5858,6 +6027,11 @@ snapshots: lru-cache: 10.2.0 minipass: 7.0.4 + path-scurry@1.11.1: + dependencies: + lru-cache: 10.2.0 + minipass: 7.1.2 + path-to-regexp@2.2.1: {} path-type@4.0.0: {} @@ -6294,6 +6468,8 @@ snapshots: simple-git-hooks@2.11.1: {} + sisteransi@1.0.5: {} + slash@3.0.0: {} slash@4.0.0: {} @@ -6354,6 +6530,8 @@ snapshots: stackback@0.0.2: {} + stackframe@1.3.4: {} + std-env@3.7.0: {} streamx@2.16.1: diff --git a/tsconfig.json b/tsconfig.json index 5c0dac9906e..5adeba37fe8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,15 +27,6 @@ "vue": ["packages/vue/src"] } }, - "include": [ - "packages/global.d.ts", - "packages/*/src", - "packages/runtime-dom/types/jsx.d.ts", - "packages/*/__tests__", - "packages/dts-test", - "packages/vue/jsx-runtime", - "scripts/*", - "rollup.*.js" - ], + "include": ["packages/global.d.ts", "packages/*/src/**/*.ts"], "exclude": ["packages/sfc-playground/src/vue-dev-proxy*"] } diff --git a/tsslint.config.ts b/tsslint.config.ts new file mode 100644 index 00000000000..50b3d8db70b --- /dev/null +++ b/tsslint.config.ts @@ -0,0 +1,52 @@ +import { defineConfig } from '@tsslint/config' +import { convertRule } from '@tsslint/eslint' + +export default defineConfig({ + rules: { + 'no-unnecessary-type-assertion': convertRule( + ( + await import( + './node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-type-assertion.js' + ) + ).default.default, + [], + 0, + ), + 'prefer-nullish-coalescing': convertRule( + ( + await import( + './node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-nullish-coalescing.js' + ) + ).default.default, + [], + 0, + ), + 'strict-boolean-expressions': convertRule( + ( + await import( + './node_modules/@typescript-eslint/eslint-plugin/dist/rules/strict-boolean-expressions.js' + ) + ).default.default, + [], + 0, + ), + 'switch-exhaustiveness-check': convertRule( + ( + await import( + './node_modules/@typescript-eslint/eslint-plugin/dist/rules/switch-exhaustiveness-check.js' + ) + ).default.default, + [], + 0, + ), + 'no-unnecessary-condition': convertRule( + ( + await import( + './node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-condition.js' + ) + ).default.default, + [], + 0, + ), + }, +})