-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add option for rule
@typescript-eslint/restrict-template-expressions
* merge two settings for `import-x/resolver` from `*.{ts,vue}` to globalwide * rename import `stylisticMigrate` to `pluginStylisticMigrate` @ eslint.config.js * re-plug eslint: pzmosquito/eslint-import-resolver-vite#12 (comment) @ package.json * fix some violations of eslint rules @ fe
- Loading branch information
Showing
8 changed files
with
37 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -382,6 +382,7 @@ const rules = [{ // as of [email protected] | |
'@typescript-eslint/no-unsafe-enum-comparison': 'error', | ||
'@typescript-eslint/no-unsafe-unary-minus': 'error', | ||
'@typescript-eslint/parameter-properties': ['error', { prefer: 'parameter-property' }], | ||
'@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }], | ||
}, | ||
}, { // as of [email protected] | ||
optout: { | ||
|
@@ -520,20 +521,25 @@ const rules = [{ // as of [email protected] | |
}, | ||
}]; | ||
|
||
import viteConfig from './vite.config.ts'; | ||
import pluginStylistic from '@stylistic/eslint-plugin'; | ||
import pluginImportX from 'eslint-plugin-import-x'; | ||
import pluginUnicorn from 'eslint-plugin-unicorn'; | ||
import * as typescriptESLintParserForExtraFiles from 'typescript-eslint-parser-for-extra-files'; | ||
import * as vueESLintParser from 'vue-eslint-parser'; | ||
// eslint-disable-next-line import-x/extensions | ||
import vueESLintConfigTypescriptRecommendedExtends from '@vue/eslint-config-typescript/recommended.js'; | ||
import pluginVue from 'eslint-plugin-vue'; | ||
import { fixupConfigRules } from '@eslint/compat'; | ||
import { FlatCompat } from '@eslint/eslintrc'; | ||
import eslintJs from '@eslint/js'; | ||
import stylisticMigrate from '@stylistic/eslint-plugin-migrate'; | ||
import pluginStylistic from '@stylistic/eslint-plugin'; | ||
import pluginStylisticMigrate from '@stylistic/eslint-plugin-migrate'; | ||
import pluginImportX from 'eslint-plugin-import-x'; | ||
import pluginUnicorn from 'eslint-plugin-unicorn'; | ||
// eslint-disable-next-line import-x/extensions | ||
import { tsImport } from 'tsx/esm/api'; | ||
import * as typescriptESLintParserForExtraFiles from 'typescript-eslint-parser-for-extra-files'; | ||
import * as _ from 'lodash-es'; | ||
|
||
// https://github.com/pzmosquito/eslint-import-resolver-vite/issues/12#issuecomment-2151349705 | ||
const viteConfig = await tsImport('./vite.config.ts', import.meta.url); | ||
|
||
// https://github.com/eslint/eslint/issues/18093 | ||
// https://github.com/eslint/eslint/issues/18391 | ||
const compat = new FlatCompat(); | ||
|
@@ -546,8 +552,8 @@ export default [ | |
'plugin:@typescript-eslint/strict-type-checked', | ||
'plugin:@typescript-eslint/stylistic-type-checked', | ||
), | ||
...compat.config(pluginImportX.configs.recommended), // https://github.com/un-ts/eslint-plugin-import-x/issues/29#issuecomment-2148843214 | ||
...compat.config(pluginImportX.configs.typescript), | ||
...compat.config(pluginImportX.configs.recommended), // https://github.com/un-ts/eslint-plugin-import-x/pull/85 | ||
pluginImportX.configs.typescript, // https://github.com/import-js/eslint-plugin-import/issues/2556#issuecomment-2119520339 | ||
...fixupConfigRules(...compat.extends( | ||
'plugin:@tanstack/eslint-plugin-query/recommended', // https://github.com/TanStack/query/pull/7253 | ||
)), | ||
|
@@ -562,6 +568,12 @@ export default [ | |
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
settings: { | ||
'import-x/resolver': { | ||
typescript: true, | ||
vite: { viteConfig }, // https://github.com/pzmosquito/eslint-import-resolver-vite/issues/12#issuecomment-2148676875 | ||
}, | ||
}, | ||
plugins: { '@stylistic': pluginStylistic }, | ||
|
||
// https://stackoverflow.com/questions/30221286/how-to-convert-an-array-of-objects-to-an-object-in-lodash/36692117#36692117 | ||
|
@@ -576,7 +588,6 @@ export default [ | |
{ | ||
files: ['**/*.ts'], | ||
languageOptions: { parser: typescriptESLintParserForExtraFiles }, | ||
settings: { 'import-x/resolver': { typescript: true } }, | ||
}, | ||
{ | ||
files: ['**/*.vue'], | ||
|
@@ -588,16 +599,10 @@ export default [ | |
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
settings: { | ||
'import-x/resolver': { | ||
typescript: true, | ||
vite: { viteConfig }, // https://github.com/pzmosquito/eslint-import-resolver-vite/issues/12#issuecomment-2148676875 | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: ['eslint.config.js'], | ||
plugins: { '@stylistic': pluginStylistic, '@stylistic/migrate': stylisticMigrate }, | ||
plugins: { '@stylistic': pluginStylistic, '@stylistic/migrate': pluginStylisticMigrate }, | ||
rules: { | ||
'@stylistic/migrate/migrate-js': 'error', | ||
'@stylistic/migrate/migrate-ts': 'error', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,7 @@ | |
"scripts": { | ||
"dev": "vite", | ||
"build": "vue-tsc && vite build", | ||
"preview": "vite preview", | ||
"eslint": "tsx .yarn/unplugged/eslint-npm-*/node_modules/eslint/bin/eslint.js" | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"@fortawesome/fontawesome-svg-core": "^6.5.2", | ||
|
@@ -81,10 +80,5 @@ | |
"not ie 11", | ||
"not dead" | ||
], | ||
"packageManager": "[email protected]", | ||
"dependenciesMeta": { | ||
"[email protected]": { | ||
"unplugged": true | ||
} | ||
} | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5685,9 +5685,6 @@ __metadata: | |
vue-eslint-parser: "npm:^9.4.3" | ||
vue-router: "npm:^4.3.2" | ||
vue-tsc: "npm:^2.0.19" | ||
dependenciesMeta: | ||
[email protected]: | ||
unplugged: true | ||
languageName: unknown | ||
linkType: soft | ||
|
||
|