mirror of
https://github.com/jellyfin/jellyfin-vue.git
synced 2026-09-02 21:04:08 +03:00
fix(eslint): typescript resolver
This prevented linting altogether in the whole monorepo Signed-off-by: Fernando Fernández <ferferga@hotmail.com>
This commit is contained in:
@@ -4,6 +4,6 @@ import pkg from './package.json' with { type: 'json' };
|
||||
|
||||
export default defineConfig([
|
||||
...getBaseConfig(pkg.name),
|
||||
...getTSVueConfig(pkg.name, false, import.meta.dirname),
|
||||
...getNodeFiles(pkg.name, tsFiles)
|
||||
...getTSVueConfig(false, import.meta.dirname),
|
||||
...getNodeFiles(tsFiles)
|
||||
]);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
"@unocss/eslint-config": "66.6.7",
|
||||
"eslint": "9.39.4",
|
||||
"eslint-config-flat-gitignore": "2.3.0",
|
||||
"eslint-import-resolver-typescript": "4.4.4",
|
||||
"eslint-plugin-css": "0.12.0",
|
||||
"eslint-plugin-depend": "1.5.0",
|
||||
"eslint-plugin-file-progress": "4.0.0",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { getPackagePath } from '@jellyfin-vue/configs/utils';
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import globals from 'globals';
|
||||
import { getAllPackagePaths } from '@jellyfin-vue/configs/utils';
|
||||
|
||||
/**
|
||||
* Gets the ESLint config from Node.js and development related files
|
||||
* @param files - Defaults to `*config.*` and files under `scripts` folder
|
||||
*/
|
||||
export function getNodeFiles(packageName: string, files = ['*.config.*', 'scripts/**/*.ts']) {
|
||||
export function getNodeFiles(files = ['*.config.*', 'scripts/**/*.ts']) {
|
||||
return defineConfig([{
|
||||
name: '(@jellyfin-vue/configs/lint/env) Node.js and development-related files',
|
||||
files,
|
||||
@@ -21,7 +21,7 @@ export function getNodeFiles(packageName: string, files = ['*.config.*', 'script
|
||||
'error',
|
||||
{
|
||||
devDependencies: true,
|
||||
packageDir: [getPackagePath('jellyfin-vue'), getPackagePath(packageName)]
|
||||
packageDir: [...getAllPackagePaths()]
|
||||
}
|
||||
],
|
||||
'import-x/no-nodejs-modules': 'off',
|
||||
|
||||
@@ -4,6 +4,7 @@ import sonarjs from 'eslint-plugin-sonarjs';
|
||||
import regexp from 'eslint-plugin-regexp';
|
||||
import jsdoc from 'eslint-plugin-jsdoc';
|
||||
import eslintImportX from 'eslint-plugin-import-x';
|
||||
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
|
||||
import vueScopedCSS from 'eslint-plugin-vue-scoped-css';
|
||||
import css from 'eslint-plugin-css';
|
||||
import vue from 'eslint-plugin-vue';
|
||||
@@ -11,8 +12,8 @@ import vue from 'eslint-plugin-vue';
|
||||
import promise from 'eslint-plugin-promise';
|
||||
import globals from 'globals';
|
||||
import vueParser from 'vue-eslint-parser';
|
||||
import { getPackagePath } from '@jellyfin-vue/configs/utils';
|
||||
import { eqeqeqConfig, vueAndTsFiles, vueFiles, tsFiles } from '../shared';
|
||||
import { eqeqeqConfig, vueAndTsFiles, vueFiles, tsFiles } from '../shared.ts';
|
||||
import { getAllPackagePaths } from '@jellyfin-vue/configs/utils';
|
||||
|
||||
const recommendedKey = 'flat/recommended';
|
||||
|
||||
@@ -22,7 +23,7 @@ const recommendedKey = 'flat/recommended';
|
||||
const flatArrayOfObjects = (obj: unknown[]) => Object.assign({}, ...obj);
|
||||
|
||||
/** Common TypeScript and Vue rules */
|
||||
const common = (packageName: string) => defineConfig([
|
||||
const common = () => defineConfig([
|
||||
{
|
||||
...flatArrayOfObjects(tseslint.configs.strictTypeChecked),
|
||||
name: '(@jellyfin-vue/configs/lint/typescript-vue - typescript-eslint) Extended config from plugin (strict type checking)'
|
||||
@@ -55,15 +56,21 @@ const common = (packageName: string) => defineConfig([
|
||||
plugins: {
|
||||
'import-x': eslintImportX
|
||||
},
|
||||
settings: {
|
||||
'import-x/resolver-next': [
|
||||
createTypeScriptImportResolver()
|
||||
]
|
||||
},
|
||||
rules: {
|
||||
'import-x/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
packageDir: [getPackagePath('jellyfin-vue'), getPackagePath(packageName)]
|
||||
packageDir: [...getAllPackagePaths()]
|
||||
}
|
||||
],
|
||||
'import-x/order': 'error',
|
||||
'import-x/no-cycle': 'error',
|
||||
'import-x/extensions': ['error', 'ignorePackages', { fix: false, checkTypeImports: true }],
|
||||
'import-x/no-nodejs-modules': 'error',
|
||||
'import-x/no-duplicates': ['error', { 'prefer-inline': true, 'considerQueryString': true }],
|
||||
// From the recommended preset
|
||||
@@ -208,10 +215,10 @@ const vue_config = defineConfig([
|
||||
* @param enableVue - Whether to apply the base config for Vue files
|
||||
* @returns
|
||||
*/
|
||||
export function getTSVueConfig(packageName: string, enableVue = true, tsconfigRootDir = import.meta.dirname) {
|
||||
export function getTSVueConfig(enableVue = true, tsconfigRootDir = import.meta.dirname) {
|
||||
const result = [
|
||||
...(enableVue ? vue_config : []),
|
||||
...common(packageName).map(conf => ({
|
||||
...common().map(conf => ({
|
||||
...conf, files: enableVue ? vueAndTsFiles : tsFiles
|
||||
}))];
|
||||
|
||||
|
||||
@@ -43,6 +43,13 @@ const packagePaths = (() => {
|
||||
return relation;
|
||||
})();
|
||||
|
||||
/**
|
||||
* Gets the paths of all packages in the monorepo, including the root package
|
||||
*/
|
||||
export function getAllPackagePaths() {
|
||||
return new Set([monorepoRoot, ...packagePaths.values()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the path of a monorepo package
|
||||
*/
|
||||
|
||||
@@ -4,9 +4,9 @@ import pkg from './package.json' with { type: 'json' };
|
||||
|
||||
export default defineConfig([
|
||||
...getBaseConfig(pkg.name),
|
||||
...getTSVueConfig(pkg.name, true, import.meta.dirname),
|
||||
...getTSVueConfig(true, import.meta.dirname),
|
||||
...unocss,
|
||||
...getNodeFiles(pkg.name),
|
||||
...getNodeFiles(),
|
||||
...getWorkerFiles(),
|
||||
{
|
||||
name: '(@jellyfin-vue/frontend) Ignored files',
|
||||
|
||||
@@ -4,6 +4,6 @@ import pkg from './package.json' with { type: 'json' };
|
||||
|
||||
export default defineConfig([
|
||||
...getBaseConfig(pkg.name),
|
||||
...getTSVueConfig(pkg.name, false, import.meta.dirname),
|
||||
...getNodeFiles(pkg.name, ['src/vite.ts'])
|
||||
...getTSVueConfig(false, import.meta.dirname),
|
||||
...getNodeFiles(['src/vite.ts'])
|
||||
]);
|
||||
|
||||
@@ -4,6 +4,6 @@ import pkg from './package.json' with { type: 'json' };
|
||||
|
||||
export default defineConfig([
|
||||
...getBaseConfig(pkg.name),
|
||||
...getTSVueConfig(pkg.name, false, import.meta.dirname),
|
||||
...getNodeFiles(pkg.name, ['./src/node/**/*.ts'])
|
||||
...getTSVueConfig(false, import.meta.dirname),
|
||||
...getNodeFiles(['./src/node/**/*.ts'])
|
||||
]);
|
||||
|
||||
@@ -4,6 +4,6 @@ import pkg from './package.json' with { type: 'json' };
|
||||
|
||||
export default defineConfig([
|
||||
...getBaseConfig(pkg.name),
|
||||
...getTSVueConfig(pkg.name, false, import.meta.dirname),
|
||||
...getNodeFiles(pkg.name, tsFiles)
|
||||
...getTSVueConfig(false, import.meta.dirname),
|
||||
...getNodeFiles(tsFiles)
|
||||
]);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import { getBaseConfig, getTSVueConfig } from '@jellyfin-vue/configs/lint';
|
||||
import { getBaseConfig, getNodeFiles, getTSVueConfig } from '@jellyfin-vue/configs/lint';
|
||||
import pkg from './package.json' with { type: 'json' };
|
||||
|
||||
export default defineConfig([
|
||||
...getBaseConfig(pkg.name),
|
||||
...getTSVueConfig(pkg.name, true, import.meta.dirname)
|
||||
...getTSVueConfig(true, import.meta.dirname),
|
||||
...getNodeFiles(['./storybook/**/*.ts'])
|
||||
]);
|
||||
|
||||
@@ -4,6 +4,6 @@ import pkg from './package.json' with { type: 'json' };
|
||||
|
||||
export default defineConfig([
|
||||
...getBaseConfig(pkg.name),
|
||||
...getTSVueConfig(pkg.name, false, import.meta.dirname),
|
||||
...getNodeFiles(pkg.name, tsFiles)
|
||||
...getTSVueConfig(false, import.meta.dirname),
|
||||
...getNodeFiles(tsFiles)
|
||||
]);
|
||||
|
||||
Generated
+38
@@ -87,6 +87,9 @@ importers:
|
||||
eslint-config-flat-gitignore:
|
||||
specifier: 2.3.0
|
||||
version: 2.3.0(eslint@9.39.4(jiti@2.6.1))
|
||||
eslint-import-resolver-typescript:
|
||||
specifier: 4.4.4
|
||||
version: 4.4.4(eslint-plugin-import-x@4.16.2(@typescript-eslint/utils@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@6.0.2))(eslint@9.39.4(jiti@2.6.1)))(eslint@9.39.4(jiti@2.6.1))
|
||||
eslint-plugin-css:
|
||||
specifier: 0.12.0
|
||||
version: 0.12.0(eslint@9.39.4(jiti@2.6.1))
|
||||
@@ -2183,6 +2186,19 @@ packages:
|
||||
unrs-resolver:
|
||||
optional: true
|
||||
|
||||
eslint-import-resolver-typescript@4.4.4:
|
||||
resolution: {integrity: sha512-1iM2zeBvrYmUNTj2vSC/90JTHDth+dfOfiNKkxApWRsTJYNrc8rOdxxIf5vazX+BiAXTeOT0UvWpGI/7qIWQOw==, tarball: https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-4.4.4.tgz}
|
||||
engines: {node: ^16.17.0 || >=18.6.0}
|
||||
peerDependencies:
|
||||
eslint: '*'
|
||||
eslint-plugin-import: '*'
|
||||
eslint-plugin-import-x: '*'
|
||||
peerDependenciesMeta:
|
||||
eslint-plugin-import:
|
||||
optional: true
|
||||
eslint-plugin-import-x:
|
||||
optional: true
|
||||
|
||||
eslint-plugin-css@0.12.0:
|
||||
resolution: {integrity: sha512-pztNsypvSgHbGmoEOIWHkYzr8W8O4zlg0J9p2mE0eFCMsZRN/kSTxD4tupBV/jgYcKu0jXPKFJWU238soopXyw==, tarball: https://registry.npmjs.org/eslint-plugin-css/-/eslint-plugin-css-0.12.0.tgz}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
@@ -2536,6 +2552,9 @@ packages:
|
||||
resolution: {integrity: sha512-f4RqJKBUe5rQkJ2eJEJBXSticB3hGbN9j0yxxMQFqIW89Jp9WYFtzfTcRlstDKVUTRzSOTLKRfO9vIztenwtxA==, tarball: https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-5.0.0.tgz}
|
||||
engines: {node: '>=18.20'}
|
||||
|
||||
is-bun-module@2.0.0:
|
||||
resolution: {integrity: sha512-gNCGbnnnnFAUGKeZ9PdbyeGYJqewpmc2aKHUEMO5nQPWU9lOmv7jcmQIv+qHD8fXW6W7qfuCwX4rY9LNRjXrkQ==, tarball: https://registry.npmjs.org/is-bun-module/-/is-bun-module-2.0.0.tgz}
|
||||
|
||||
is-core-module@2.16.1:
|
||||
resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==, tarball: https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -5390,6 +5409,21 @@ snapshots:
|
||||
optionalDependencies:
|
||||
unrs-resolver: 1.11.1
|
||||
|
||||
eslint-import-resolver-typescript@4.4.4(eslint-plugin-import-x@4.16.2(@typescript-eslint/utils@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@6.0.2))(eslint@9.39.4(jiti@2.6.1)))(eslint@9.39.4(jiti@2.6.1)):
|
||||
dependencies:
|
||||
debug: 4.4.3
|
||||
eslint: 9.39.4(jiti@2.6.1)
|
||||
eslint-import-context: 0.1.9(unrs-resolver@1.11.1)
|
||||
get-tsconfig: 4.13.7
|
||||
is-bun-module: 2.0.0
|
||||
stable-hash-x: 0.2.0
|
||||
tinyglobby: 0.2.15
|
||||
unrs-resolver: 1.11.1
|
||||
optionalDependencies:
|
||||
eslint-plugin-import-x: 4.16.2(@typescript-eslint/utils@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@6.0.2))(eslint@9.39.4(jiti@2.6.1))
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-css@0.12.0(eslint@9.39.4(jiti@2.6.1)):
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.9.1(eslint@9.39.4(jiti@2.6.1))
|
||||
@@ -5783,6 +5817,10 @@ snapshots:
|
||||
dependencies:
|
||||
builtin-modules: 5.0.0
|
||||
|
||||
is-bun-module@2.0.0:
|
||||
dependencies:
|
||||
semver: 7.7.4
|
||||
|
||||
is-core-module@2.16.1:
|
||||
dependencies:
|
||||
hasown: 2.0.2
|
||||
|
||||
Reference in New Issue
Block a user