vue-tsc-eslint-hook
TypeScript icon, indicating that this package has built-in type declarations

1.8.27 • Public • Published

vue-tsc-eslint-hook

Use ESLint with vue-tsc to have better performance and accuracy.

Example: https://github.com/DrJume/vue-volar-eslint

Usage

package.json

{
	"devDependencies": {
		"eslint": "latest",
		"vue-tsc": "latest",
		"vue-tsc-eslint-hook": "latest"
	}
}

tsconfig.json

{
	"vueCompilerOptions": {
		"hooks": [
			"./vue-tsc-hook.js"
		]
	}
}

vue-tsc-hook.js

module.exports = (program) =>
	require('vue-tsc-eslint-hook')(
		program,
		(program) => ({
			...baseConfig,
			parserOptions: {
				...baseConfig.parserOptions,
				programs: [program], // replace eslint typescript program
			},
			// ignore non-ts virtual files that was generated by volar
			ignorePatterns: ['**/*.vue', '**/*.html', '**/*.pug', '**/*.css', '**/*.scss'],
			overrides: [
				...baseConfig.overrides ?? [],
				{
					// ignore format linting for virtual ts code
					files: ['*.vue.ts', '*.vue.js', '*.vue.tsx', '*.vue.jsx'],
					rules: {
						'prettier/prettier': 'off',
					},
				},
			],
		})
	)

Readme

Keywords

none

Package Sidebar

Install

npm i vue-tsc-eslint-hook

Weekly Downloads

61

Version

1.8.27

License

MIT

Unpacked Size

8.39 kB

Total Files

5

Last publish

Collaborators

  • johnsoncodehk