Skip to content

Commit

Permalink
* specify parser & parserOptions.parser on *.vue following vuej…
Browse files Browse the repository at this point in the history
…s/vue-eslint-parser#104 (comment) @ .eslintrc.cjs

* re-order `overrides` to specify `settings.import/resolver.vite` over `*.vue`, `settings.import/resolver.typescript` over `*.ts` & rules over `.eslintrc.cjs`,

* `eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call` @ main.ts
* `eslint-disable` @ stats.js
* fix the return type of `_.defaultsDeep()` is `any` @ `useQueryForm.fillParamDefaultValue()`
- `shims-vue.d.ts` following vuejs/vue-eslint-parser#104 (comment)
$ yarn add -D typescript-eslint-parser-for-extra-files
@ fe
  • Loading branch information
n0099 committed Dec 18, 2023
1 parent 6208081 commit 3ac8994
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 28 deletions.
49 changes: 28 additions & 21 deletions fe/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
module.exports = {
root: true,
overrides: [{
// https://stackoverflow.com/questions/57107800/eslint-disable-extends-in-override
files: '.eslintrc.cjs',
plugins: ['@stylistic', '@stylistic/migrate'],
rules: {
'@stylistic/migrate/migrate-js': 'error',
'@stylistic/migrate/migrate-ts': 'error',
'@stylistic/quote-props': ['error', 'as-needed'],
'@stylistic/comma-dangle': ['error', 'always-multiline'],
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
},
}, {
files: '*',
excludedFiles: '.eslintrc.cjs',
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
settings: {
'import/resolver': {
typescript: true,
// https://github.com/pzmosquito/eslint-import-resolver-vite/issues/12#issuecomment-1858743165
vite: { viteConfig: require('import-sync')('./vite.config.ts').default },
},
},
plugins: ['@stylistic'],
extends: [
'eslint:recommended',
Expand Down Expand Up @@ -489,5 +468,33 @@ module.exports = {
'vue/no-unused-emit-declarations': 'error',
'vue/no-ref-object-reactivity-loss': 'error',
},
}, { // https://stackoverflow.com/questions/57107800/eslint-disable-extends-in-override
files: '.eslintrc.cjs',
plugins: ['@stylistic', '@stylistic/migrate'],
rules: {
'@stylistic/migrate/migrate-js': 'error',
'@stylistic/migrate/migrate-ts': 'error',
'@stylistic/comma-dangle': ['error', 'always-multiline'],
'@typescript-eslint/naming-convention': 'off',
},
}, {
files: '*.ts',
parser: 'typescript-eslint-parser-for-extra-files',
settings: { 'import/resolver': { typescript: true } }
}, {
files: '*.vue',
parser: 'vue-eslint-parser',
parserOptions: {
parser: 'typescript-eslint-parser-for-extra-files',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
settings: {
'import/resolver': {
typescript: true,
// https://github.com/pzmosquito/eslint-import-resolver-vite/issues/12#issuecomment-1858743165
vite: { viteConfig: require('import-sync')('./vite.config.ts').default },
},
},
}],
};
1 change: 1 addition & 0 deletions fe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"import-sync": "^2.2.0",
"stats.js": "^0.17.0",
"typescript": "^5.3.3",
"typescript-eslint-parser-for-extra-files": "^0.5.0",
"vite": "^5.0.10",
"vue-tsc": "^1.8.25"
},
Expand Down
2 changes: 1 addition & 1 deletion fe/src/components/Post/queryForm/useQueryForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default <
defaultParam.subParam.not = false; // add subParam.not on every param
// cloneDeep to prevent defaultsDeep mutates origin object
if (resetToDefault)
return _.defaultsDeep(defaultParam, param);
return _.defaultsDeep(defaultParam, param) as T;
return _.defaultsDeep(_.cloneDeep(param), defaultParam);
};
const addParam = (name: string) => {
Expand Down
1 change: 1 addition & 0 deletions fe/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ nprogress.configure({ trickleSpeed: 200 });
if (import.meta.env.DEV) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
(await import('@/checkForUndefinedCSSClasses.js')).default();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error
// @ts-ignore
Expand Down
6 changes: 0 additions & 6 deletions fe/src/shims-vue.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions fe/src/stats.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable */
import Stats from 'stats.js';
const stats = new Stats();
stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom
Expand Down
23 changes: 23 additions & 0 deletions fe/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3735,6 +3735,7 @@ __metadata:
stats.js: "npm:^0.17.0"
tippy.js: "npm:^6.3.7"
typescript: "npm:^5.3.3"
typescript-eslint-parser-for-extra-files: "npm:^0.5.0"
v-viewer: "npm:^3.0.11"
vanilla-lazyload: "npm:^17.8.5"
vite: "npm:^5.0.10"
Expand Down Expand Up @@ -3816,6 +3817,28 @@ __metadata:
languageName: node
linkType: hard

"typescript-eslint-parser-for-extra-files@npm:^0.5.0":
version: 0.5.0
resolution: "typescript-eslint-parser-for-extra-files@npm:0.5.0"
peerDependencies:
"@typescript-eslint/parser": ">=5.41.0"
astrojs-compiler-sync: ">=0.3.1"
svelte2tsx: ">=0.5.20"
typescript: ">=4.8.4"
vue: ^3.2.45
peerDependenciesMeta:
astrojs-compiler-sync:
optional: true
svelte2tsx:
optional: true
typescript:
optional: true
vue:
optional: true
checksum: fdb0110e22cb9a11f4042e09afce2bf38b2abdb41288d609a347f0628412cc444dc8b8a041eec86f11079e6e437a98490bc0699549d0029342a1a99bfe2854aa
languageName: node
linkType: hard

"typescript@npm:^5.3.3":
version: 5.3.3
resolution: "typescript@npm:5.3.3"
Expand Down

0 comments on commit 3ac8994

Please sign in to comment.