在 Vue 3.0 使用 ESLint 分析工具並套用 Airbnb 程式碼風格

做法

建立專案。

1
2
npm create vite@latest example -- --template vue
cd example

安裝套件。

1
2
3
npm i @vue/eslint-config-airbnb \
eslint-import-resolver-typescript \
-D

在專案根目錄新增 .eslintrc.cjs 檔:

1
2
3
4
5
6
7
8
9
10
11
12
module.exports = {
extends: [
'@vue/airbnb',
],
settings: {
'import/resolver': {
typescript: {},
},
},
rules: {
},
};