Skip to content

Commit 43cbadb

Browse files
committed
Modernize codebase Sept 2023
- Update tsconfig - Update eslint - Replace babel/jest with vitest
1 parent b7668ba commit 43cbadb

21 files changed

+1239
-3533
lines changed

.eslintrc.cjs

Lines changed: 64 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
/* eslint-disable quote-props */
2-
3-
// eslint-disable-next-line @typescript-eslint/no-var-requires
4-
const path = require('path')
5-
6-
// eslint-disable-next-line @typescript-eslint/no-var-requires
1+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
72
const INLINE_ELEMENTS = require('eslint-plugin-vue/lib/utils/inline-non-void-elements.json')
83

94
module.exports = {
105
root: true,
116

127
parserOptions: {
13-
extraFileExtensions: ['.vue'],
8+
extraFileExtensions: ['.vue', 'json'],
149
parser: '@typescript-eslint/parser',
15-
project: path.resolve(__dirname, './tsconfig.json'),
10+
project: './tsconfig.json',
1611
tsconfigRootDir: __dirname,
17-
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
18-
sourceType: 'module', // Allows for the use of imports
12+
ecmaVersion: 'latest',
13+
sourceType: 'module',
1914
},
2015

2116
// Predefines global variables (e.g. browser env predefines 'window' variable)
@@ -25,89 +20,68 @@ module.exports = {
2520
'vue/setup-compiler-macros': true,
2621
},
2722

28-
// Disable warnings for variables that are accessed but not defined in same file
29-
globals: {
30-
'DEFINE': 'readonly',
31-
},
32-
33-
// Rules order is important, please avoid shuffling them
3423
extends: [
3524
'standard',
3625
'eslint:recommended',
37-
'plugin:@typescript-eslint/recommended',
38-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
26+
'plugin:@typescript-eslint/strict-type-checked',
3927
'plugin:vue/vue3-recommended',
4028
],
4129

4230
plugins: [
4331
'@typescript-eslint',
32+
'import',
4433
'vue',
4534
],
4635

47-
settings: {
48-
'import/resolver': {
49-
'typescript': {
50-
'alwaysTryTypes': true,
51-
},
52-
},
53-
},
54-
5536
rules: {
56-
'generator-star-spacing': ['error', 'before'],
37+
semi: 'off',
38+
'comma-dangle': 'off',
39+
5740
'arrow-parens': ['error', 'always'],
58-
'one-var': ['error', 'never'],
59-
'no-void': ['error', {
60-
allowAsStatement: true,
61-
}],
41+
'eol-last': ['error', 'always'],
42+
'generator-star-spacing': ['error', 'before'],
43+
'no-trailing-spaces': 'error',
6244
'space-before-blocks': ['error', 'always'],
63-
64-
'import/first': 'off',
65-
'import/named': 'error',
66-
'import/namespace': 'error',
67-
'import/default': 'error',
68-
'import/export': 'error',
69-
'import/extensions': 'off',
70-
'import/no-unresolved': 'off',
71-
'import/no-extraneous-dependencies': 'off',
72-
'import/order': ['error', {
73-
warnOnUnassignedImports: true,
74-
alphabetize: {
75-
order: 'asc',
76-
caseInsensitive: false,
45+
'space-before-function-paren': ['error', 'never'],
46+
indent: ['error', 4, {
47+
SwitchCase: 1,
48+
}],
49+
'no-multi-spaces': ['error', {
50+
exceptions: {
51+
Property: true,
52+
VariableDeclarator: true,
53+
ImportDeclaration: false,
7754
},
78-
pathGroups: [
79-
{
80-
'pattern': '@/**',
81-
'group': 'parent',
82-
},
83-
],
84-
groups: [
85-
'builtin', 'external', 'parent', 'sibling', 'index', 'object', 'type',
86-
],
55+
ignoreEOLComments: true,
8756
}],
88-
89-
'comma-dangle': 'off',
90-
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
91-
92-
'space-before-function-paren': ['error', 'never'],
93-
'indent': ['error', 4, {
94-
'SwitchCase': 1,
57+
'no-empty-pattern': ['error', {
58+
allowObjectPatternsAsParameters: true,
59+
}],
60+
'no-void': ['error', {
61+
allowAsStatement: true,
62+
}],
63+
quotes: ['error', 'single', {
64+
avoidEscape: true,
65+
allowTemplateLiterals: false,
9566
}],
9667

9768
'vue/html-indent': ['error', 4],
9869
'vue/max-attributes-per-line': ['error', {
9970
singleline: 999,
10071
multiline: 1,
10172
}],
102-
103-
'vue/singleline-html-element-content-newline': ['error', {
104-
'ignores': ['ExternalLink', 'pre', 'router-link', ...INLINE_ELEMENTS],
105-
}],
106-
10773
'vue/component-tags-order': ['error', {
108-
'order': ['script', 'template', 'style'],
74+
order: ['script', 'template', 'style'],
75+
}],
76+
'vue/singleline-html-element-content-newline': ['error', {
77+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
78+
ignores: ['ExternalLink', 'router-link', ...INLINE_ELEMENTS],
10979
}],
11080

81+
'@typescript-eslint/prefer-literal-enum-member': 'off',
82+
'@typescript-eslint/no-unnecessary-condition': 'off',
83+
'@typescript-eslint/semi': ['error', 'never'],
84+
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
11185
'@typescript-eslint/type-annotation-spacing': 'error',
11286
'@typescript-eslint/restrict-template-expressions': ['error', {
11387
allowNumber: true,
@@ -119,14 +93,14 @@ module.exports = {
11993
ignoreParameters: false,
12094
ignoreProperties: true,
12195
}],
96+
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
12297
'@typescript-eslint/consistent-type-assertions': ['error', {
12398
assertionStyle: 'as',
12499
objectLiteralTypeAssertions: 'never',
125100
}],
126101
'@typescript-eslint/array-type': ['error', {
127102
default: 'generic',
128103
}],
129-
130104
'@typescript-eslint/member-delimiter-style': ['error', {
131105
multiline: {
132106
delimiter: 'none',
@@ -137,52 +111,42 @@ module.exports = {
137111
requireLast: false,
138112
},
139113
}],
140-
141-
'semi': 'off',
142-
'@typescript-eslint/semi': ['error', 'never'],
143-
144-
'no-debugger': 'error',
145-
146-
'@typescript-eslint/naming-convention': [
147-
'error',
114+
'@typescript-eslint/strict-boolean-expressions': ['error', {
115+
allowNullableBoolean: true,
116+
allowNullableString: true,
117+
}],
118+
'@typescript-eslint/naming-convention': ['error',
148119
{
149-
'selector': 'default',
150-
'format': null,
151-
'modifiers': ['requiresQuotes'],
120+
selector: 'default',
121+
format: null,
122+
modifiers: ['requiresQuotes'],
152123
},
153124
{
154-
'selector': 'typeLike',
155-
'format': ['PascalCase'],
125+
selector: 'typeLike',
126+
format: ['PascalCase'],
156127
},
157128
{
158-
'selector': 'parameter',
159-
'format': ['strictCamelCase'],
160-
'leadingUnderscore': 'allow',
129+
selector: 'parameter',
130+
format: ['strictCamelCase'],
131+
leadingUnderscore: 'allow',
161132
},
162133
{
163-
'selector': 'memberLike',
164-
'modifiers': ['private'],
165-
'format': ['strictCamelCase'],
166-
'leadingUnderscore': 'require',
134+
selector: 'memberLike',
135+
modifiers: ['private'],
136+
format: ['strictCamelCase'],
137+
leadingUnderscore: 'require',
167138
},
168139
{
169-
'selector': [
140+
selector: [
170141
'variableLike',
171142
'method',
172143
],
173-
'filter': {
174-
'regex': '^update:',
175-
'match': false,
144+
filter: {
145+
regex: '^update:',
146+
match: false,
176147
},
177-
'format': ['strictCamelCase', 'UPPER_CASE'],
148+
format: ['strictCamelCase', 'UPPER_CASE'],
178149
},
179150
],
180-
181-
'@typescript-eslint/strict-boolean-expressions': ['error', {
182-
allowNullableBoolean: true,
183-
allowNullableString: true,
184-
}],
185-
186-
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
187151
},
188152
}

.github/workflows/release-build.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ on:
77
tags:
88
- v*
99
paths-ignore:
10-
- .github/**
11-
- .vscode/**
10+
- README.md
11+
- .vscode
1212
- .editorconfig
1313
- .gitignore
14-
- README.md
1514

1615
jobs:
1716
release-build:
@@ -20,18 +19,16 @@ jobs:
2019

2120
steps:
2221
- name: Checkout
23-
uses: actions/checkout@v2
22+
uses: actions/checkout@v4
2423

2524
- name: Save yarn cache location to env
2625
run: echo "YARN_CACHE=$(yarn cache dir)" >> $GITHUB_ENV
2726

2827
- name: Cache node_modules
29-
uses: actions/cache@v2
30-
env:
31-
CACHE_NAME: cache-node-modules
28+
uses: actions/cache@v3
3229
with:
3330
path: ${{ env.YARN_CACHE }}
34-
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ hashFiles('**/yarn.lock', '**/package-lock.json') }}
31+
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/package-lock.json') }}
3532

3633
- name: Install dependencies
3734
run: yarn install

babel.config.cjs

Lines changed: 0 additions & 29 deletions
This file was deleted.

jest.config.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)