Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 33 additions & 11 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// @ts-check
import { createRequire } from 'node:module'
import eslint from '@eslint/js'
import pluginN from 'eslint-plugin-n'
import pluginImportX from 'eslint-plugin-import-x'
import pluginRegExp from 'eslint-plugin-regexp'
import tseslint from 'typescript-eslint'
import { defineConfig } from 'eslint/config'
import globals from 'globals'

const require = createRequire(import.meta.url)
const pkgVite = require('./packages/vite/package.json')
import pkgVite from './packages/vite/package.json' with { type: 'json' }

// Some rules work better with typechecking enabled, but as enabling it is slow,
// we only do so when linting in IDEs for now. If you want to lint with typechecking
Expand All @@ -31,6 +28,8 @@ export default defineConfig(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
...(shouldTypeCheck ? tseslint.configs.recommendedTypeCheckedOnly : []),
...(shouldTypeCheck ? tseslint.configs.stylisticTypeCheckedOnly : []),
pluginRegExp.configs['flat/recommended'],
{
name: 'main',
Expand All @@ -40,12 +39,7 @@ export default defineConfig(
sourceType: 'module',
ecmaVersion: 2022,
isolatedDeclarations: true,
project: shouldTypeCheck
? [
'./packages/*/tsconfig.json',
'./packages/vite/src/*/tsconfig.json',
]
: undefined,
projectService: shouldTypeCheck,
},
globals: {
...globals.es2023,
Expand Down Expand Up @@ -161,6 +155,33 @@ export default defineConfig(
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/prefer-for-of': 'off',
'@typescript-eslint/prefer-function-type': 'off',
// disable typecheck-specific rules (but worth revisiting again)
'@typescript-eslint/await-thenable': 'off',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/no-duplicate-type-constituents': 'off',
'@typescript-eslint/no-implied-eval': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/prefer-includes': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/prefer-optional-chain': 'off',
'@typescript-eslint/prefer-promise-reject-errors': 'off',
'@typescript-eslint/prefer-string-starts-ends-with': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/unbound-method': 'off',

'import-x/no-duplicates': 'error',
'import-x/order': [
Expand Down Expand Up @@ -372,8 +393,9 @@ export default defineConfig(
],
languageOptions: {
parserOptions: {
project: false,
projectService: false,
},
},
extends: [tseslint.configs.disableTypeChecked],
Comment thread
bluwy marked this conversation as resolved.
Resolved
},
)
1 change: 1 addition & 0 deletions packages/plugin-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"dev": "tsdown --watch",
"build": "tsdown",
"typecheck": "tsc",
"prepublishOnly": "npm run build"
},
"engines": {
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-legacy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function toOutputFilePathInHtml(
if (relative && !config.build.ssr) {
return toRelative(filename, hostId)
} else {
// @ts-expect-error `decodedBase` is internal
return joinUrlSegments(config.decodedBase, filename)
}
}
Expand Down
8 changes: 3 additions & 5 deletions packages/plugin-legacy/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"include": ["src"],
"include": ["tsdown.config.ts", "src"],
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist",
Expand All @@ -10,9 +10,7 @@
"isolatedDeclarations": true,
"declaration": true,
"sourceMap": true,
"noUnusedLocals": true,
"paths": {
"vite": ["../vite/src/node/index.js"]
}
"skipLibCheck": true,
"noUnusedLocals": true
}
}
4 changes: 2 additions & 2 deletions packages/plugin-legacy/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'tsdown'
import { type UserConfig, defineConfig } from 'tsdown'

export default defineConfig({
entry: ['src/index.ts'],
Expand All @@ -9,4 +9,4 @@ export default defineConfig({
deps: {
onlyBundle: ['picocolors'],
},
})
}) as UserConfig
Comment thread
bluwy marked this conversation as resolved.
Resolved
Loading