chore(configs): fix wrong type mapping in TypeScript

This commit is contained in:
Fernando Fernández 2024-11-04 19:14:39 +00:00
parent c5cb51d4ca
commit 98471eee65
12 changed files with 33 additions and 33 deletions

View File

@ -1,5 +1,5 @@
import type { Linter } from 'eslint';
import { getBaseConfig, getTSVueConfig, getNodeFiles, unocss, getWorkerFiles } from '@jellyfin-vue/configs/eslint';
import { getBaseConfig, getTSVueConfig, getNodeFiles, unocss, getWorkerFiles } from '@jellyfin-vue/configs/lint';
// TODO: Add missing rules for i18n and json
export default [

View File

@ -1,5 +1,5 @@
import type { Linter } from 'eslint';
import { getBaseConfig, getTSVueConfig, getNodeFiles, tsFiles } from './eslint/';
import { getBaseConfig, getTSVueConfig, getNodeFiles, tsFiles } from './lint/';
export default [
...getBaseConfig('@jellyfin-vue/configs'),

View File

@ -40,12 +40,12 @@ export function getBaseConfig(packageName: string, forceCache = !CI_environment,
const cacheLocation = join(findUpSync('node_modules', { type: 'directory' }) ?? '', '.cache/eslint', packageName.replace('/', '_'));
newArgs.push('--cache', '--cache-location', cacheLocation);
console.log('[@jellyfin-vue/configs/eslint] Force enabling caching for this run');
console.log('[@jellyfin-vue/configs/lint] Force enabling caching for this run');
}
if (warningAsErrors && !newArgs.some(arg => arg.includes('--max-warnings'))) {
newArgs.push('--max-warnings=0');
console.log('[@jellyfin-vue/configs/eslint] Force enabling warnings for this run');
console.log('[@jellyfin-vue/configs/lint] Force enabling warnings for this run');
}
const argsHaveChanged = new Set(newArgs).difference(new Set(process.argv.slice(1))).size > 0;
@ -64,15 +64,15 @@ export function getBaseConfig(packageName: string, forceCache = !CI_environment,
return [
{ ...js.configs.recommended,
name: '(@jellyfin-vue/configs/eslint/base - eslint) Extended config from plugin'
name: '(@jellyfin-vue/configs/lint/base - eslint) Extended config from plugin'
},
{
...unicorn.configs['flat/recommended'],
name: '(@jellyfin-vue/configs/eslint/base - unicorn) Extended config from plugin'
name: '(@jellyfin-vue/configs/lint/base - unicorn) Extended config from plugin'
},
{
...dependConfigs['flat/recommended'],
name: '(@jellyfin-vue/configs/eslint/base - depend) Extended config from plugin'
name: '(@jellyfin-vue/configs/lint/base - depend) Extended config from plugin'
},
{
...stylistic.configs.customize({
@ -83,10 +83,10 @@ export function getBaseConfig(packageName: string, forceCache = !CI_environment,
arrowParens: false,
blockSpacing: true
}),
name: '(@jellyfin-vue/configs/eslint/base - @stylistic) Extended config from plugin'
name: '(@jellyfin-vue/configs/lint/base - @stylistic) Extended config from plugin'
},
{
name: '(@jellyfin-vue/configs/eslint/base) Common settings',
name: '(@jellyfin-vue/configs/lint/base) Common settings',
rules: {
'no-empty': ['error', { allowEmptyCatch: true }],
'no-extend-native': 'error',
@ -150,13 +150,13 @@ export function getBaseConfig(packageName: string, forceCache = !CI_environment,
},
{
...stylistic.configs['disable-legacy'],
name: '(@jellyfin-vue/configs/eslint/base) Disable stylistic legacy rules'
name: '(@jellyfin-vue/configs/lint/base) Disable stylistic legacy rules'
},
/**
* Extra files to include and ignores that should override all the others
*/
{
name: '(@jellyfin-vue/configs/eslint/base) Ignored files',
name: '(@jellyfin-vue/configs/lint/base) Ignored files',
ignores: [
'**/.git',
...gitignore().ignores
@ -164,7 +164,7 @@ export function getBaseConfig(packageName: string, forceCache = !CI_environment,
},
/** File progress plugin */
{
name: '(@jellyfin-vue/configs/eslint/base) Linting progress report',
name: '(@jellyfin-vue/configs/lint/base) Linting progress report',
settings: {
progress: {
successMessage: 'Linting done!'

View File

@ -7,7 +7,7 @@ import globals from 'globals';
*/
export function getNodeFiles(files = ['*.config.*', 'scripts/**/*.ts']): Linter.Config[] {
return [{
name: '(@jellyfin-vue/configs/eslint/env) Node.js and development-related files',
name: '(@jellyfin-vue/configs/lint/env) Node.js and development-related files',
files,
languageOptions: {
globals: {
@ -35,7 +35,7 @@ export function getNodeFiles(files = ['*.config.*', 'scripts/**/*.ts']): Linter.
*/
export function getWorkerFiles(files = ['**/*.worker.ts']): Linter.Config[] {
return [{
name: '(@jellyfin-vue/configs/eslint/env) WebWorkers',
name: '(@jellyfin-vue/configs/lint/env) WebWorkers',
files,
languageOptions: {
globals: {

View File

@ -8,7 +8,7 @@ export const json = [
/* First index is just the plugin definition */
...jsoncRecommended.at(0),
...jsoncRecommended.at(1),
name: '(@jellyfin-vue/configs/eslint/json) - Custom config',
name: '(@jellyfin-vue/configs/lint/json) - Custom config',
rules: {
...jsoncRecommended.at(1).rules,
...jsoncRecommended.at(2).rules,

View File

@ -23,33 +23,33 @@ const flatArrayOfObjects = (obj: unknown[]) => Object.assign({}, ...obj);
const common = [
{
...flatArrayOfObjects(tseslint.configs.strictTypeChecked),
name: '(@jellyfin-vue/configs/eslint/typescript-vue - typescript-eslint) Extended config from plugin (strict type checking)'
name: '(@jellyfin-vue/configs/lint/typescript-vue - typescript-eslint) Extended config from plugin (strict type checking)'
},
{
...flatArrayOfObjects(tseslint.configs.stylisticTypeChecked),
name: '(@jellyfin-vue/configs/eslint/typescript-vue - typescript-eslint) Extended config from plugin (stylistic type checking)'
name: '(@jellyfin-vue/configs/lint/typescript-vue - typescript-eslint) Extended config from plugin (stylistic type checking)'
},
{
...tseslint.configs.eslintRecommended,
name: '(@jellyfin-vue/configs/eslint/typescript-vue - typescript-eslint) Extended config from plugin (ESLint rules with type checking)'
name: '(@jellyfin-vue/configs/lint/typescript-vue - typescript-eslint) Extended config from plugin (ESLint rules with type checking)'
},
{
...regexp.configs['flat/recommended'],
name: '(@jellyfin-vue/configs/eslint/typescript-vue - regexp) Extended config from plugin'
name: '(@jellyfin-vue/configs/lint/typescript-vue - regexp) Extended config from plugin'
},
{
...promise.configs['flat/recommended'],
name: '(@jellyfin-vue/configs/eslint/typescript-vue - promise) Extended config from plugin'
name: '(@jellyfin-vue/configs/lint/typescript-vue - promise) Extended config from plugin'
},
{
name: '(@jellyfin-vue/configs/eslint/typescript-vue - promise) Custom config',
name: '(@jellyfin-vue/configs/lint/typescript-vue - promise) Custom config',
rules: {
'promise/prefer-await-to-callbacks': 'error',
'promise/prefer-await-to-then': 'error'
}
},
{
name: '(@jellyfin-vue/configs/eslint/typescript-vue - import) Custom config',
name: '(@jellyfin-vue/configs/lint/typescript-vue - import) Custom config',
plugins: {
'import-x': eslintImportX
},
@ -65,7 +65,7 @@ const common = [
}
},
{
name: '(@jellyfin-vue/configs/eslint/typescript-vue - JSDoc) Custom config',
name: '(@jellyfin-vue/configs/lint/typescript-vue - JSDoc) Custom config',
plugins: {
jsdoc
},
@ -78,7 +78,7 @@ const common = [
}
},
{
name: '(@jellyfin-vue/configs/eslint/typescript-vue - TypeScript & Vue) Custom config',
name: '(@jellyfin-vue/configs/lint/typescript-vue - TypeScript & Vue) Custom config',
rules: {
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
@ -110,7 +110,7 @@ const common = [
},
{
...sonarjs.configs.recommended,
name: '(@jellyfin-vue/configs/eslint/typescript-vue - sonarcloud) Extended config from plugin'
name: '(@jellyfin-vue/configs/lint/typescript-vue - sonarcloud) Extended config from plugin'
}
] satisfies Linter.Config[];
@ -126,18 +126,18 @@ const vue_config = [
* TODO: Remove when it's removed from the recommended rules
*/
delete config.rules?.['vue/component-tags-order'];
config.name = `(@jellyfin-vue/configs/eslint/typescript-vue - ${config.name}) - Extended config from plugin`;
config.name = `(@jellyfin-vue/configs/lint/typescript-vue - ${config.name}) - Extended config from plugin`;
return config;
}),
{
...flatArrayOfObjects(vueScopedCSS.configs['flat/recommended']),
name: '(@jellyfin-vue/configs/eslint/typescript-vue - Vue Scoped CSS) Extended config from plugin',
name: '(@jellyfin-vue/configs/lint/typescript-vue - Vue Scoped CSS) Extended config from plugin',
files: vueFiles
},
{
...css.configs['flat/recommended'],
name: '(@jellyfin-vue/configs/eslint/typescript-vue - Vue CSS) Extended config from plugin',
name: '(@jellyfin-vue/configs/lint/typescript-vue - Vue CSS) Extended config from plugin',
files: vueFiles
},
{
@ -202,7 +202,7 @@ export function getTSVueConfig(enableVue = true, tsconfigRootDir = import.meta.d
// Extracted from https://github.com/vuejs/eslint-config-typescript
const base_vue_parser = {
name: '(@jellyfin-vue/configs/eslint/typescript-vue - Vue) Extra parser configuration for typed linting',
name: '(@jellyfin-vue/configs/lint/typescript-vue - Vue) Extra parser configuration for typed linting',
files: vueFiles,
languageOptions: {
...langOptions,
@ -216,8 +216,8 @@ export function getTSVueConfig(enableVue = true, tsconfigRootDir = import.meta.d
const base_ts_parser = {
name: enableVue
? '(@jellyfin-vue/configs/eslint/typescript-vue - TypeScript & Vue) Parser extra config'
: '(@jellyfin-vue/configs/eslint/typescript-vue - TypeScript) Parser extra config',
? '(@jellyfin-vue/configs/lint/typescript-vue - TypeScript & Vue) Parser extra config'
: '(@jellyfin-vue/configs/lint/typescript-vue - TypeScript) Parser extra config',
files: enableVue ? vueAndTsFiles : tsFiles,
languageOptions: {
...langOptions,

View File

@ -4,7 +4,7 @@
"type": "module",
"exports": {
"./typescript/base.json": "./typescript/base.json",
"./eslint": "./eslint/index.ts",
"./lint": "./lint/index.ts",
"./unocss": "./unocss.ts"
},
"scripts": {

View File

@ -1,5 +1,5 @@
import type { Linter } from 'eslint';
import { getBaseConfig, getTSVueConfig, getNodeFiles, tsFiles } from '@jellyfin-vue/configs/eslint';
import { getBaseConfig, getTSVueConfig, getNodeFiles, tsFiles } from '@jellyfin-vue/configs/lint';
export default [
...getBaseConfig('@jellyfin-vue/vite-plugins'),