Skip to content

Commit ef57596

Browse files
committed
refactor: add eslint & extract types
1 parent 497f075 commit ef57596

30 files changed

+885
-99
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.eslintrc.cjs

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// @ts-check
2+
3+
module.exports = {
4+
root: true,
5+
parser: 'vue-eslint-parser',
6+
parserOptions: {
7+
parser: '@typescript-eslint/parser',
8+
sourceType: 'module',
9+
},
10+
plugins: ['@typescript-eslint'],
11+
extends: ['plugin:vue/vue3-recommended'],
12+
rules: {
13+
'no-debugger': 'error',
14+
'no-console': ['error', { allow: ['warn', 'error', 'info', 'clear'] }],
15+
'sort-imports': ['error', { ignoreDeclarationSort: true }],
16+
17+
// This rule enforces the preference for using '@ts-expect-error' comments in TypeScript
18+
// code to indicate intentional type errors, improving code clarity and maintainability.
19+
'@typescript-eslint/prefer-ts-expect-error': 'error',
20+
// Enforce the use of 'import type' for importing types
21+
'@typescript-eslint/consistent-type-imports': [
22+
'error',
23+
{
24+
fixStyle: 'inline-type-imports',
25+
disallowTypeAnnotations: false,
26+
},
27+
],
28+
// Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
29+
'@typescript-eslint/no-import-type-side-effects': 'error',
30+
31+
'vue/max-attributes-per-line': 'off',
32+
'vue/singleline-html-element-content-newline': 'off',
33+
'vue/multi-word-component-names': 'off',
34+
'vue/html-self-closing': [
35+
'error',
36+
{
37+
html: { component: 'always', normal: 'always', void: 'any' },
38+
math: 'always',
39+
svg: 'always',
40+
},
41+
],
42+
},
43+
overrides: [],
44+
}

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
"build": "vite build",
4343
"build-preview": "vite build -c vite.preview.config.ts",
4444
"format": "prettier --write .",
45+
"lint": "eslint --ext .ts,.vue .",
46+
"typecheck": "vue-tsc --noEmit",
4547
"release": "bumpp --all",
4648
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
4749
"prepublishOnly": "npm run build"
@@ -68,7 +70,9 @@
6870
"@babel/types": "^7.23.6",
6971
"@rollup/plugin-replace": "^5.0.5",
7072
"@types/codemirror": "^5.60.15",
73+
"@types/hash-sum": "^1.0.2",
7174
"@types/node": "^20.10.6",
75+
"@typescript-eslint/eslint-plugin": "^6.18.1",
7276
"@vitejs/plugin-vue": "^5.0.2",
7377
"@volar/cdn": "~1.11.1",
7478
"@volar/monaco": "~1.11.1",
@@ -77,6 +81,8 @@
7781
"bumpp": "^9.2.1",
7882
"codemirror": "^5.65.16",
7983
"conventional-changelog-cli": "^4.1.0",
84+
"eslint": "^8.56.0",
85+
"eslint-plugin-vue": "^9.20.0",
8086
"fflate": "^0.8.1",
8187
"hash-sum": "^2.0.0",
8288
"lint-staged": "^15.2.0",

0 commit comments

Comments
 (0)