eslint-config-vue-typescript-eslint
vue-typescript-eslint
Getting Started
-
first init your project with @vue/cli 3.0,select typescript with eslint
-
install:
npm i eslint-config-vue-typescript-eslint --save-dev
- edit
.eslintrc.js:
module.exports = {
extends: [
"vue-typescript-eslint"
]
};
- You can customize the rules:
module.exports = {
extends: [
"vue-typescript-eslint"
],
rules:{
//some rules here,such as:
// 'indent': [
// 'error',
// 2,
// {
// SwitchCase: 1,
// flatTernaryExpressions: true
// }
// ],
}
};
- edit
shims-tsx.d.ts:
import Vue, { VNode } from "vue";
declare global {
namespace JSX {
/* eslint-disable */
interface Element extends VNode {}
interface ElementClass extends Vue {}
interface IntrinsicElements {
[elem: string]: any;
}
}
}
Vscode Setting
//eslint
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "vue",
"autoFix": true
},
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
}
],
Thanks
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 1.2.1 | Apache-2.0 | |
| 1.2.0 | Apache-2.0 | |
| 1.1.8 | Apache-2.0 | |
| 1.1.7 | Apache-2.0 | |
| 1.1.6 | Apache-2.0 | |
| 1.1.5 | Apache-2.0 | |
| 1.1.3 | Apache-2.0 | |
| 1.1.2 | Apache-2.0 | |
| 1.1.1 | Apache-2.0 | |
| 1.1.0 | Apache-2.0 | |
| 1.0.9 | Apache-2.0 | |
| 1.0.7 | Apache-2.0 | |
| 1.0.6 | Apache-2.0 | |
| 1.0.5 | Apache-2.0 | |
| 1.0.4 | Apache-2.0 | |
| 1.0.3 | Apache-2.0 | |
| 1.0.2 | Apache-2.0 | |
| 1.0.1 | Apache-2.0 |