-
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.
* fix `Parsing error: "parserOptions.programs" has been provided for …
…@typescript-eslint/parser. The file was not found in any of the provided program instance(s):` by vuejs/vue-eslint-parser#104 (comment) * reset `languageOptions.parserOptions.ecmaVersion` to `latest` as it's set to `2018` by `pluginImportX.configs.recommended` - rules from `@typescript-eslint` for file `eslint.config.js` * simplify the importing of `vite.config.ts` * ignore files generated by yarn - rule `@typescript-eslint/no-throw-literal`: typescript-eslint/typescript-eslint#9083 @ eslint.config.js $ yarn eslint --fix @ fe
- Loading branch information
Showing
2 changed files
with
24 additions
and
15 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 |
---|---|---|
|
@@ -8,6 +8,7 @@ const rules = [{ // as of [email protected] | |
'unicorn/prevent-abbreviations': 'off', | ||
'unicorn/consistent-function-scoping': 'off', | ||
'unicorn/filename-case': 'off', | ||
'unicorn/prefer-string-raw': 'off', | ||
}, | ||
optin: { | ||
'unicorn/catch-error-name': ['error', { name: 'e' }], | ||
|
@@ -283,8 +284,6 @@ const rules = [{ // as of [email protected] | |
hoist: 'all', | ||
allow: ['name'], | ||
}], | ||
'no-throw-literal': 'off', | ||
'@typescript-eslint/no-throw-literal': 'error', | ||
'no-unused-expressions': 'off', | ||
'@typescript-eslint/no-unused-expressions': 'error', | ||
'no-use-before-define': 'off', | ||
|
@@ -522,17 +521,17 @@ 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'; | ||
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 * as vueESLintParser from 'vue-eslint-parser'; | ||
import pluginVue from 'eslint-plugin-vue' | ||
import vueESLintConfigTypescriptRecommendedExtends from '@vue/eslint-config-typescript/recommended.js' | ||
import * as typescriptESLintParserForExtraFiles from 'typescript-eslint-parser-for-extra-files'; | ||
import pluginStylistic from '@stylistic/eslint-plugin'; | ||
import stylisticMigrate from '@stylistic/eslint-plugin-migrate'; | ||
import pluginImportX from 'eslint-plugin-import-x'; | ||
import pluginUnicorn from 'eslint-plugin-unicorn'; | ||
import * as _ from 'lodash-es'; | ||
|
||
// https://github.com/eslint/eslint/issues/18093 | ||
|
@@ -553,6 +552,8 @@ export default [ | |
'plugin:@tanstack/eslint-plugin-query/recommended', // https://github.com/TanStack/query/pull/7253 | ||
)), | ||
pluginUnicorn.configs['flat/recommended'], | ||
{ languageOptions: { parserOptions: { ecmaVersion: 'latest' } } }, | ||
{ ignores: ['.yarn/', '.pnp.*'] }, | ||
{ linterOptions: { reportUnusedDisableDirectives: 'error' } }, | ||
{ | ||
languageOptions: { | ||
|
@@ -562,9 +563,15 @@ export default [ | |
}, | ||
}, | ||
plugins: { '@stylistic': pluginStylistic }, | ||
|
||
// https://stackoverflow.com/questions/30221286/how-to-convert-an-array-of-objects-to-an-object-in-lodash/36692117#36692117 | ||
rules: Object.assign({}, ..._.flatten(_.map(rules, Object.values))), | ||
rules: Object.assign({}, ..._.flatMap(rules, Object.values)), | ||
}, | ||
{ | ||
files: ['**/*.js'], | ||
languageOptions: { // https://github.com/vuejs/vue-eslint-parser/issues/104#issuecomment-2148652586 | ||
parserOptions: { disallowAutomaticSingleRunInference: true }, | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.ts'], | ||
|
@@ -584,9 +591,7 @@ export default [ | |
settings: { | ||
'import-x/resolver': { | ||
typescript: true, | ||
|
||
// https://github.com/pzmosquito/eslint-import-resolver-vite/issues/12#issuecomment-1979897899 | ||
vite: { viteConfig: import('./vite.config') }, | ||
vite: { viteConfig }, // https://github.com/pzmosquito/eslint-import-resolver-vite/issues/12#issuecomment-2148676875 | ||
}, | ||
}, | ||
}, | ||
|
@@ -598,6 +603,10 @@ export default [ | |
'@stylistic/migrate/migrate-ts': 'error', | ||
'@stylistic/comma-dangle': ['error', 'always-multiline'], | ||
'@typescript-eslint/naming-convention': 'off', | ||
'@typescript-eslint/no-unsafe-call': 'off', | ||
'@typescript-eslint/no-unsafe-argument': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
}, | ||
}, | ||
]; |
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