mirror of
https://github.com/imdap/ruoyi-plus-vben5.git
synced 2026-04-23 00:38:34 +08:00
chore: finalize oxlint migration config
This commit is contained in:
@@ -27,26 +27,22 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@vben/oxlint-config": "workspace:*",
|
||||
"eslint-config-turbo": "catalog:",
|
||||
"eslint-plugin-command": "catalog:",
|
||||
"eslint-plugin-import-x": "catalog:"
|
||||
"eslint-plugin-command": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "catalog:",
|
||||
"@eslint/js": "catalog:",
|
||||
"@typescript-eslint/eslint-plugin": "catalog:",
|
||||
"@typescript-eslint/parser": "catalog:",
|
||||
"@vitest/eslint-plugin": "catalog:",
|
||||
"eslint": "catalog:",
|
||||
"eslint-plugin-better-tailwindcss": "catalog:",
|
||||
"eslint-plugin-jsdoc": "catalog:",
|
||||
"eslint-plugin-jsonc": "catalog:",
|
||||
"eslint-plugin-n": "catalog:",
|
||||
"eslint-plugin-no-only-tests": "catalog:",
|
||||
"eslint-plugin-oxlint": "catalog:",
|
||||
"eslint-plugin-perfectionist": "catalog:",
|
||||
"eslint-plugin-pnpm": "catalog:",
|
||||
"eslint-plugin-prettier": "catalog:",
|
||||
"eslint-plugin-regexp": "catalog:",
|
||||
"eslint-plugin-unicorn": "catalog:",
|
||||
"eslint-plugin-unused-imports": "catalog:",
|
||||
"eslint-plugin-vue": "catalog:",
|
||||
|
||||
@@ -3,9 +3,9 @@ import type { Linter } from 'eslint';
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
export async function comments(): Promise<Linter.Config[]> {
|
||||
const [pluginComments] = await Promise.all([
|
||||
interopDefault(import('@eslint-community/eslint-plugin-eslint-comments')),
|
||||
] as const);
|
||||
const pluginComments = await interopDefault(
|
||||
import('@eslint-community/eslint-plugin-eslint-comments'),
|
||||
);
|
||||
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -2,21 +2,6 @@ import type { Linter } from 'eslint';
|
||||
|
||||
export async function disableds(): Promise<Linter.Config[]> {
|
||||
return [
|
||||
{
|
||||
files: ['**/__tests__/**/*.?([cm])[jt]s?(x)'],
|
||||
name: 'disables/test',
|
||||
rules: {
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'no-console': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.d.ts'],
|
||||
name: 'disables/dts',
|
||||
rules: {
|
||||
'@typescript-eslint/triple-slash-reference': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
|
||||
name: 'disables/js',
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
import * as pluginImport from 'eslint-plugin-import-x';
|
||||
|
||||
export async function importPluginConfig(): Promise<Linter.Config[]> {
|
||||
return [
|
||||
{
|
||||
plugins: {
|
||||
// @ts-expect-error - This is a dynamic import
|
||||
import: pluginImport,
|
||||
},
|
||||
rules: {
|
||||
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
|
||||
'import/first': 'error',
|
||||
'import/newline-after-import': 'error',
|
||||
'import/no-duplicates': 'error',
|
||||
'import/no-mutable-exports': 'error',
|
||||
'import/no-named-default': 'error',
|
||||
'import/no-self-import': 'error',
|
||||
'import/no-unresolved': 'off',
|
||||
'import/no-webpack-loader-syntax': 'error',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -2,17 +2,13 @@ export * from './command';
|
||||
export * from './comments';
|
||||
export * from './disableds';
|
||||
export * from './ignores';
|
||||
export * from './import';
|
||||
export * from './javascript';
|
||||
export * from './jsdoc';
|
||||
export * from './jsonc';
|
||||
export * from './node';
|
||||
export * from './oxlint';
|
||||
export * from './perfectionist';
|
||||
export * from './pnpm';
|
||||
export * from './prettier';
|
||||
export * from './regexp';
|
||||
export * from './tailwindcss';
|
||||
export * from './test';
|
||||
export * from './turbo';
|
||||
export * from './typescript';
|
||||
export * from './unicorn';
|
||||
|
||||
@@ -34,78 +34,11 @@ export async function javascript(): Promise<Linter.Config[]> {
|
||||
},
|
||||
rules: {
|
||||
...js.configs.recommended.rules,
|
||||
'accessor-pairs': [
|
||||
'error',
|
||||
{ enforceForClassMembers: true, setWithoutGet: true },
|
||||
],
|
||||
'array-callback-return': 'error',
|
||||
'block-scoped-var': 'error',
|
||||
'constructor-super': 'error',
|
||||
'default-case-last': 'error',
|
||||
'dot-notation': ['error', { allowKeywords: true }],
|
||||
eqeqeq: ['error', 'always'],
|
||||
'keyword-spacing': 'off',
|
||||
|
||||
'new-cap': [
|
||||
'error',
|
||||
{ capIsNew: false, newIsCap: true, properties: true },
|
||||
],
|
||||
'no-alert': 'error',
|
||||
'no-array-constructor': 'error',
|
||||
'no-async-promise-executor': 'error',
|
||||
'no-caller': 'error',
|
||||
'no-case-declarations': 'error',
|
||||
'no-class-assign': 'error',
|
||||
'no-compare-neg-zero': 'error',
|
||||
'no-cond-assign': ['error', 'always'],
|
||||
'no-console': ['error', { allow: ['warn', 'error'] }],
|
||||
'no-const-assign': 'error',
|
||||
'no-control-regex': 'error',
|
||||
'no-debugger': 'error',
|
||||
'no-delete-var': 'error',
|
||||
'no-dupe-args': 'error',
|
||||
'no-dupe-class-members': 'error',
|
||||
'no-dupe-keys': 'error',
|
||||
'no-duplicate-case': 'error',
|
||||
'no-empty': ['error', { allowEmptyCatch: true }],
|
||||
'no-empty-character-class': 'error',
|
||||
'no-empty-function': 'off',
|
||||
'no-empty-pattern': 'error',
|
||||
'no-eval': 'error',
|
||||
'no-ex-assign': 'error',
|
||||
'no-extend-native': 'error',
|
||||
'no-extra-bind': 'error',
|
||||
'no-extra-boolean-cast': 'error',
|
||||
'no-fallthrough': 'error',
|
||||
'no-func-assign': 'error',
|
||||
'no-global-assign': 'error',
|
||||
'no-implied-eval': 'error',
|
||||
'no-import-assign': 'error',
|
||||
'no-invalid-regexp': 'error',
|
||||
'no-irregular-whitespace': 'error',
|
||||
'no-iterator': 'error',
|
||||
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
|
||||
'no-lone-blocks': 'error',
|
||||
'no-loss-of-precision': 'error',
|
||||
'no-misleading-character-class': 'error',
|
||||
'no-multi-str': 'error',
|
||||
'no-new': 'error',
|
||||
'no-new-func': 'error',
|
||||
'no-new-object': 'error',
|
||||
'no-new-symbol': 'error',
|
||||
'no-new-wrappers': 'error',
|
||||
'no-obj-calls': 'error',
|
||||
'no-octal': 'error',
|
||||
'no-octal-escape': 'error',
|
||||
'no-proto': 'error',
|
||||
'no-prototype-builtins': 'error',
|
||||
'no-redeclare': ['error', { builtinGlobals: false }],
|
||||
'no-regex-spaces': 'error',
|
||||
'no-restricted-globals': [
|
||||
'error',
|
||||
{ message: 'Use `globalThis` instead.', name: 'global' },
|
||||
{ message: 'Use `globalThis` instead.', name: 'self' },
|
||||
],
|
||||
'no-restricted-properties': [
|
||||
'error',
|
||||
{
|
||||
@@ -138,31 +71,8 @@ export async function javascript(): Promise<Linter.Config[]> {
|
||||
'TSEnumDeclaration[const=true]',
|
||||
'TSExportAssignment',
|
||||
],
|
||||
'no-self-assign': ['error', { props: true }],
|
||||
'no-self-compare': 'error',
|
||||
'no-sequences': 'error',
|
||||
'no-shadow-restricted-names': 'error',
|
||||
'no-sparse-arrays': 'error',
|
||||
'no-template-curly-in-string': 'error',
|
||||
'no-this-before-super': 'error',
|
||||
'no-throw-literal': 'error',
|
||||
'no-undef': 'off',
|
||||
'no-undef-init': 'error',
|
||||
'no-unexpected-multiline': 'error',
|
||||
'no-unmodified-loop-condition': 'error',
|
||||
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
|
||||
'no-unreachable': 'error',
|
||||
'no-unreachable-loop': 'error',
|
||||
'no-unsafe-finally': 'error',
|
||||
'no-unsafe-negation': 'error',
|
||||
'no-unused-expressions': [
|
||||
'error',
|
||||
{
|
||||
allowShortCircuit: true,
|
||||
allowTaggedTemplates: true,
|
||||
allowTernary: true,
|
||||
},
|
||||
],
|
||||
'no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
@@ -172,50 +82,7 @@ export async function javascript(): Promise<Linter.Config[]> {
|
||||
vars: 'all',
|
||||
},
|
||||
],
|
||||
'no-use-before-define': [
|
||||
'error',
|
||||
{ classes: false, functions: false, variables: false },
|
||||
],
|
||||
'no-useless-backreference': 'error',
|
||||
'no-useless-call': 'error',
|
||||
'no-useless-catch': 'error',
|
||||
'no-useless-computed-key': 'error',
|
||||
'no-useless-constructor': 'error',
|
||||
'no-useless-rename': 'error',
|
||||
'no-useless-return': 'error',
|
||||
'no-var': 'error',
|
||||
'no-with': 'error',
|
||||
'object-shorthand': [
|
||||
'error',
|
||||
'always',
|
||||
{ avoidQuotes: true, ignoreConstructors: false },
|
||||
],
|
||||
'one-var': ['error', { initialized: 'never' }],
|
||||
'prefer-arrow-callback': [
|
||||
'error',
|
||||
{
|
||||
allowNamedFunctions: false,
|
||||
allowUnboundThis: true,
|
||||
},
|
||||
],
|
||||
'prefer-const': [
|
||||
'error',
|
||||
{
|
||||
destructuring: 'all',
|
||||
ignoreReadBeforeAssign: true,
|
||||
},
|
||||
],
|
||||
'prefer-exponentiation-operator': 'error',
|
||||
|
||||
'prefer-promise-reject-errors': 'error',
|
||||
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
|
||||
'prefer-rest-params': 'error',
|
||||
'prefer-spread': 'error',
|
||||
'prefer-template': 'error',
|
||||
'space-before-function-paren': 'off',
|
||||
'spaced-comment': 'error',
|
||||
'symbol-description': 'error',
|
||||
'unicode-bom': ['error', 'never'],
|
||||
|
||||
'unused-imports/no-unused-imports': 'error',
|
||||
'unused-imports/no-unused-vars': [
|
||||
@@ -227,14 +94,6 @@ export async function javascript(): Promise<Linter.Config[]> {
|
||||
varsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
'use-isnan': [
|
||||
'error',
|
||||
{ enforceForIndexOf: true, enforceForSwitchCase: true },
|
||||
],
|
||||
'valid-typeof': ['error', { requireStringLiterals: true }],
|
||||
|
||||
'vars-on-top': 'error',
|
||||
yoda: ['error', 'never'],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
export async function jsdoc(): Promise<Linter.Config[]> {
|
||||
const [pluginJsdoc] = await Promise.all([
|
||||
interopDefault(import('eslint-plugin-jsdoc')),
|
||||
] as const);
|
||||
|
||||
return [
|
||||
{
|
||||
plugins: {
|
||||
jsdoc: pluginJsdoc,
|
||||
},
|
||||
rules: {
|
||||
'jsdoc/check-access': 'warn',
|
||||
'jsdoc/check-param-names': 'warn',
|
||||
'jsdoc/check-property-names': 'warn',
|
||||
'jsdoc/check-types': 'warn',
|
||||
'jsdoc/empty-tags': 'warn',
|
||||
'jsdoc/implements-on-classes': 'warn',
|
||||
'jsdoc/no-defaults': 'warn',
|
||||
'jsdoc/no-multi-asterisks': 'warn',
|
||||
'jsdoc/require-param-name': 'warn',
|
||||
'jsdoc/require-property': 'warn',
|
||||
'jsdoc/require-property-description': 'warn',
|
||||
'jsdoc/require-property-name': 'warn',
|
||||
'jsdoc/require-returns-check': 'warn',
|
||||
'jsdoc/require-returns-description': 'warn',
|
||||
'jsdoc/require-yields-check': 'warn',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -13,7 +13,6 @@ export async function node(): Promise<Linter.Config[]> {
|
||||
rules: {
|
||||
'n/handle-callback-err': ['error', '^(err|error)$'],
|
||||
'n/no-deprecated-api': 'error',
|
||||
'n/no-exports-assign': 'error',
|
||||
'n/no-extraneous-import': [
|
||||
'error',
|
||||
{
|
||||
@@ -27,8 +26,6 @@ export async function node(): Promise<Linter.Config[]> {
|
||||
],
|
||||
},
|
||||
],
|
||||
'n/no-new-require': 'error',
|
||||
'n/no-path-concat': 'error',
|
||||
// 'n/no-unpublished-import': 'off',
|
||||
'n/no-unsupported-features/es-syntax': [
|
||||
'error',
|
||||
@@ -43,6 +40,33 @@ export async function node(): Promise<Linter.Config[]> {
|
||||
'n/process-exit-as-throw': 'error',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'**/__tests__/**/*.?([cm])[jt]s?(x)',
|
||||
'**/*.spec.?([cm])[jt]s?(x)',
|
||||
'**/*.test.?([cm])[jt]s?(x)',
|
||||
'**/*.bench.?([cm])[jt]s?(x)',
|
||||
'**/*.benchmark.?([cm])[jt]s?(x)',
|
||||
],
|
||||
rules: {
|
||||
'n/prefer-global/process': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['apps/backend-mock/**/**', 'docs/**/**'],
|
||||
rules: {
|
||||
'n/no-extraneous-import': 'off',
|
||||
'n/prefer-global/buffer': 'off',
|
||||
'n/prefer-global/process': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/**/playwright.config.ts'],
|
||||
rules: {
|
||||
'n/prefer-global/buffer': 'off',
|
||||
'n/prefer-global/process': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'scripts/**/*.?([cm])[jt]s?(x)',
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
import { mergeOxlintConfigs, oxlintConfig } from '@vben/oxlint-config';
|
||||
|
||||
import oxlint from 'eslint-plugin-oxlint';
|
||||
|
||||
export async function oxcCompat(): Promise<Linter.Config[]> {
|
||||
return oxlint.buildFromOxlintConfig(mergeOxlintConfigs(oxlintConfig));
|
||||
}
|
||||
@@ -3,9 +3,7 @@ import type { Linter } from 'eslint';
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
export async function prettier(): Promise<Linter.Config[]> {
|
||||
const [pluginPrettier] = await Promise.all([
|
||||
interopDefault(import('eslint-plugin-prettier')),
|
||||
] as const);
|
||||
const pluginPrettier = await interopDefault(import('eslint-plugin-prettier'));
|
||||
return [
|
||||
{
|
||||
plugins: {
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
export async function regexp(): Promise<Linter.Config[]> {
|
||||
const [pluginRegexp] = await Promise.all([
|
||||
interopDefault(import('eslint-plugin-regexp')),
|
||||
] as const);
|
||||
|
||||
return [
|
||||
{
|
||||
plugins: {
|
||||
regexp: pluginRegexp,
|
||||
},
|
||||
rules: {
|
||||
...pluginRegexp.configs.recommended.rules,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
import { getDefaultSelectors } from 'eslint-plugin-better-tailwindcss/defaults';
|
||||
import { SelectorKind } from 'eslint-plugin-better-tailwindcss/types';
|
||||
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
export async function tailwindcss(): Promise<Linter.Config[]> {
|
||||
const [pluginBetterTailwindcss] = await Promise.all([
|
||||
interopDefault(import('eslint-plugin-better-tailwindcss')),
|
||||
] as const);
|
||||
|
||||
return [
|
||||
{
|
||||
plugins: {
|
||||
'better-tailwindcss': pluginBetterTailwindcss,
|
||||
},
|
||||
// shadcn-ui 内部组件是自动生成的,不做太多限制
|
||||
ignores: ['packages/@core/ui-kit/shadcn-ui/**/**'],
|
||||
settings: {
|
||||
'better-tailwindcss': {
|
||||
entryPoint: 'packages/@core/base/design/src/css/global.css',
|
||||
selectors: [
|
||||
...getDefaultSelectors(), // preserve default selectors
|
||||
{
|
||||
kind: SelectorKind.Attribute,
|
||||
match: [{ type: 'objectValues' }],
|
||||
name: '^classNames$',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
...pluginBetterTailwindcss.configs.recommended.rules,
|
||||
'better-tailwindcss/enforce-consistent-class-order': [
|
||||
'error',
|
||||
{
|
||||
detectComponentClasses: true,
|
||||
unknownClassOrder: 'asc',
|
||||
unknownClassPosition: 'start',
|
||||
},
|
||||
],
|
||||
// Let Prettier own wrapping decisions to avoid ping-pong formatting.
|
||||
'better-tailwindcss/enforce-consistent-line-wrapping': 'off',
|
||||
'better-tailwindcss/no-unknown-classes': 'off',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
export async function test(): Promise<Linter.Config[]> {
|
||||
const [pluginTest, pluginNoOnlyTests] = await Promise.all([
|
||||
interopDefault(import('@vitest/eslint-plugin')),
|
||||
// @ts-expect-error - no types
|
||||
interopDefault(import('eslint-plugin-no-only-tests')),
|
||||
] as const);
|
||||
|
||||
return [
|
||||
{
|
||||
files: [
|
||||
`**/__tests__/**/*.?([cm])[jt]s?(x)`,
|
||||
`**/*.spec.?([cm])[jt]s?(x)`,
|
||||
`**/*.test.?([cm])[jt]s?(x)`,
|
||||
`**/*.bench.?([cm])[jt]s?(x)`,
|
||||
`**/*.benchmark.?([cm])[jt]s?(x)`,
|
||||
],
|
||||
plugins: {
|
||||
test: {
|
||||
...pluginTest,
|
||||
rules: {
|
||||
...pluginTest.rules,
|
||||
...pluginNoOnlyTests.rules,
|
||||
},
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'no-console': 'off',
|
||||
'node/prefer-global/process': 'off',
|
||||
'test/consistent-test-it': [
|
||||
'error',
|
||||
{ fn: 'it', withinDescribe: 'it' },
|
||||
],
|
||||
'test/no-identical-title': 'error',
|
||||
'test/no-import-node-test': 'error',
|
||||
'test/no-only-tests': 'error',
|
||||
'test/prefer-hooks-in-order': 'error',
|
||||
'test/prefer-lowercase-title': 'error',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -3,9 +3,7 @@ import type { Linter } from 'eslint';
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
export async function turbo(): Promise<Linter.Config[]> {
|
||||
const [pluginTurbo] = await Promise.all([
|
||||
interopDefault(import('eslint-config-turbo')),
|
||||
] as const);
|
||||
const pluginTurbo = await interopDefault(import('eslint-config-turbo'));
|
||||
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -31,39 +31,13 @@ export async function typescript(): Promise<Linter.Config[]> {
|
||||
rules: {
|
||||
...pluginTs.configs['eslint-recommended']?.overrides?.[0]?.rules,
|
||||
...pluginTs.configs.strict?.rules,
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
'error',
|
||||
{
|
||||
'ts-check': false,
|
||||
'ts-expect-error': 'allow-with-description',
|
||||
'ts-ignore': 'allow-with-description',
|
||||
'ts-nocheck': 'allow-with-description',
|
||||
},
|
||||
],
|
||||
|
||||
// '@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],
|
||||
'@typescript-eslint/consistent-type-definitions': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-empty-function': [
|
||||
'error',
|
||||
{
|
||||
allow: ['arrowFunctions', 'functions', 'methods'],
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-namespace': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-unused-expressions': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
'@typescript-eslint/no-var-requires': 'error',
|
||||
'unused-imports/no-unused-vars': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -3,9 +3,7 @@ import type { Linter } from 'eslint';
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
export async function unicorn(): Promise<Linter.Config[]> {
|
||||
const [pluginUnicorn] = await Promise.all([
|
||||
interopDefault(import('eslint-plugin-unicorn')),
|
||||
] as const);
|
||||
const pluginUnicorn = await interopDefault(import('eslint-plugin-unicorn'));
|
||||
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -138,9 +138,6 @@ const customConfig: Linter.Config[] = [
|
||||
files: ['apps/backend-mock/**/**', 'docs/**/**'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-extraneous-class': 'off',
|
||||
'n/no-extraneous-import': 'off',
|
||||
'n/prefer-global/buffer': 'off',
|
||||
'n/prefer-global/process': 'off',
|
||||
'no-console': 'off',
|
||||
'unicorn/prefer-module': 'off',
|
||||
},
|
||||
@@ -148,8 +145,6 @@ const customConfig: Linter.Config[] = [
|
||||
{
|
||||
files: ['**/**/playwright.config.ts'],
|
||||
rules: {
|
||||
'n/prefer-global/buffer': 'off',
|
||||
'n/prefer-global/process': 'off',
|
||||
'no-console': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -5,17 +5,13 @@ import {
|
||||
comments,
|
||||
disableds,
|
||||
ignores,
|
||||
importPluginConfig,
|
||||
javascript,
|
||||
jsdoc,
|
||||
jsonc,
|
||||
node,
|
||||
oxcCompat,
|
||||
perfectionist,
|
||||
pnpm,
|
||||
prettier,
|
||||
regexp,
|
||||
tailwindcss,
|
||||
test,
|
||||
turbo,
|
||||
typescript,
|
||||
unicorn,
|
||||
@@ -41,20 +37,16 @@ async function defineConfig(config: FlatConfig[] = []) {
|
||||
typescript(),
|
||||
jsonc(),
|
||||
disableds(),
|
||||
importPluginConfig(),
|
||||
node(),
|
||||
perfectionist(),
|
||||
comments(),
|
||||
jsdoc(),
|
||||
tailwindcss(),
|
||||
unicorn(),
|
||||
test(),
|
||||
regexp(),
|
||||
command(),
|
||||
turbo(),
|
||||
yaml(),
|
||||
pnpm(),
|
||||
...customConfig,
|
||||
oxcCompat(),
|
||||
...config,
|
||||
];
|
||||
|
||||
|
||||
7
internal/lint-configs/oxlint-config/build.config.ts
Normal file
7
internal/lint-configs/oxlint-config/build.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineBuildConfig } from 'unbuild';
|
||||
|
||||
export default defineBuildConfig({
|
||||
clean: true,
|
||||
declaration: true,
|
||||
entries: ['src/index'],
|
||||
});
|
||||
33
internal/lint-configs/oxlint-config/package.json
Normal file
33
internal/lint-configs/oxlint-config/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@vben/oxlint-config",
|
||||
"version": "5.6.0",
|
||||
"private": true,
|
||||
"homepage": "https://github.com/vbenjs/vue-vben-admin",
|
||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
|
||||
"directory": "internal/lint-configs/oxlint-config"
|
||||
},
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"stub": "pnpm unbuild --stub"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"main": "./dist/index.mjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.mjs"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"eslint-plugin-better-tailwindcss": "catalog:",
|
||||
"oxlint": "catalog:"
|
||||
}
|
||||
}
|
||||
17
internal/lint-configs/oxlint-config/src/configs/ignores.ts
Normal file
17
internal/lint-configs/oxlint-config/src/configs/ignores.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const ignores: OxlintConfig = {
|
||||
ignorePatterns: [
|
||||
'**/dist/**',
|
||||
'**/node_modules/**',
|
||||
'docs/**',
|
||||
'playground/public/**',
|
||||
'**/*.json',
|
||||
'**/*.md',
|
||||
'**/*.svg',
|
||||
'**/*.yaml',
|
||||
'**/*.yml',
|
||||
],
|
||||
};
|
||||
|
||||
export { ignores };
|
||||
18
internal/lint-configs/oxlint-config/src/configs/import.ts
Normal file
18
internal/lint-configs/oxlint-config/src/configs/import.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const importPluginConfig: OxlintConfig = {
|
||||
rules: {
|
||||
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
|
||||
'import/first': 'error',
|
||||
'import/no-duplicates': 'error',
|
||||
'import/no-mutable-exports': 'error',
|
||||
'import/no-named-as-default': 'off',
|
||||
'import/no-named-as-default-member': 'off',
|
||||
'import/no-named-default': 'error',
|
||||
'import/no-self-import': 'error',
|
||||
'import/no-unassigned-import': 'off',
|
||||
'import/no-webpack-loader-syntax': 'error',
|
||||
},
|
||||
};
|
||||
|
||||
export { importPluginConfig };
|
||||
90
internal/lint-configs/oxlint-config/src/configs/index.ts
Normal file
90
internal/lint-configs/oxlint-config/src/configs/index.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
import { defineConfig as defineOxlintConfig } from 'oxlint';
|
||||
|
||||
import { ignores } from './ignores';
|
||||
import { importPluginConfig } from './import';
|
||||
import { javascript } from './javascript';
|
||||
import { node } from './node';
|
||||
import { overrides } from './overrides';
|
||||
import { plugins } from './plugins';
|
||||
import { tailwindcss } from './tailwindcss';
|
||||
import { test } from './test';
|
||||
import { typescript } from './typescript';
|
||||
import { unicorn } from './unicorn';
|
||||
import { vue } from './vue';
|
||||
|
||||
function mergeOxlintConfigs(...configs: OxlintConfig[]): OxlintConfig {
|
||||
const merged: OxlintConfig = {};
|
||||
|
||||
for (const config of configs) {
|
||||
merged.categories =
|
||||
merged.categories && config.categories
|
||||
? { ...merged.categories, ...config.categories }
|
||||
: (config.categories ?? merged.categories);
|
||||
merged.env =
|
||||
merged.env && config.env
|
||||
? { ...merged.env, ...config.env }
|
||||
: (config.env ?? merged.env);
|
||||
merged.globals =
|
||||
merged.globals && config.globals
|
||||
? { ...merged.globals, ...config.globals }
|
||||
: (config.globals ?? merged.globals);
|
||||
merged.ignorePatterns = [
|
||||
...(merged.ignorePatterns ?? []),
|
||||
...(config.ignorePatterns ?? []),
|
||||
];
|
||||
merged.jsPlugins = [
|
||||
...new Set([...(merged.jsPlugins ?? []), ...(config.jsPlugins ?? [])]),
|
||||
];
|
||||
merged.overrides = [
|
||||
...(merged.overrides ?? []),
|
||||
...(config.overrides ?? []),
|
||||
];
|
||||
merged.plugins = [
|
||||
...new Set([...(merged.plugins ?? []), ...(config.plugins ?? [])]),
|
||||
];
|
||||
merged.rules =
|
||||
merged.rules && config.rules
|
||||
? { ...merged.rules, ...config.rules }
|
||||
: (config.rules ?? merged.rules);
|
||||
merged.settings =
|
||||
merged.settings && config.settings
|
||||
? { ...merged.settings, ...config.settings }
|
||||
: (config.settings ?? merged.settings);
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
|
||||
const oxlintConfig = defineOxlintConfig(
|
||||
mergeOxlintConfigs(
|
||||
javascript,
|
||||
ignores,
|
||||
plugins,
|
||||
importPluginConfig,
|
||||
node,
|
||||
overrides,
|
||||
tailwindcss,
|
||||
test,
|
||||
typescript,
|
||||
unicorn,
|
||||
vue,
|
||||
),
|
||||
);
|
||||
|
||||
export {
|
||||
ignores,
|
||||
importPluginConfig,
|
||||
javascript,
|
||||
mergeOxlintConfigs,
|
||||
node,
|
||||
overrides,
|
||||
oxlintConfig,
|
||||
plugins,
|
||||
tailwindcss,
|
||||
test,
|
||||
typescript,
|
||||
unicorn,
|
||||
vue,
|
||||
};
|
||||
156
internal/lint-configs/oxlint-config/src/configs/javascript.ts
Normal file
156
internal/lint-configs/oxlint-config/src/configs/javascript.ts
Normal file
@@ -0,0 +1,156 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const javascript: OxlintConfig = {
|
||||
categories: {
|
||||
correctness: 'error',
|
||||
suspicious: 'warn',
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
es2021: true,
|
||||
node: true,
|
||||
},
|
||||
globals: {
|
||||
document: 'readonly',
|
||||
navigator: 'readonly',
|
||||
window: 'readonly',
|
||||
},
|
||||
rules: {
|
||||
'accessor-pairs': [
|
||||
'error',
|
||||
{
|
||||
enforceForClassMembers: true,
|
||||
setWithoutGet: true,
|
||||
},
|
||||
],
|
||||
'array-callback-return': 'error',
|
||||
'block-scoped-var': 'error',
|
||||
'default-case-last': 'error',
|
||||
eqeqeq: ['error', 'always'],
|
||||
'eslint/no-unreachable': 'error',
|
||||
'new-cap': [
|
||||
'error',
|
||||
{
|
||||
capIsNew: false,
|
||||
newIsCap: true,
|
||||
properties: true,
|
||||
},
|
||||
],
|
||||
'no-alert': 'error',
|
||||
'no-array-constructor': 'error',
|
||||
'no-caller': 'error',
|
||||
'no-case-declarations': 'error',
|
||||
'no-console': ['error', { allow: ['warn', 'error'] }],
|
||||
'no-control-regex': 'off',
|
||||
'no-debugger': 'error',
|
||||
'no-empty': ['error', { allowEmptyCatch: true }],
|
||||
'no-fallthrough': 'error',
|
||||
'no-new-func': 'error',
|
||||
'no-new-object': 'error',
|
||||
'no-new-symbol': 'error',
|
||||
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
|
||||
'no-lone-blocks': 'error',
|
||||
'no-multi-str': 'error',
|
||||
'no-octal': 'error',
|
||||
'no-octal-escape': 'error',
|
||||
'no-proto': 'error',
|
||||
'no-prototype-builtins': 'error',
|
||||
'no-redeclare': ['error', { builtinGlobals: false }],
|
||||
'no-regex-spaces': 'error',
|
||||
'no-self-compare': 'error',
|
||||
'no-sequences': 'error',
|
||||
'no-shadow': 'off',
|
||||
'no-shadow-restricted-names': 'error',
|
||||
'eslint/no-empty-function': [
|
||||
'error',
|
||||
{
|
||||
allow: ['arrowFunctions', 'functions', 'methods'],
|
||||
},
|
||||
],
|
||||
'no-template-curly-in-string': 'error',
|
||||
'no-throw-literal': 'error',
|
||||
'no-undef-init': 'error',
|
||||
'no-unused-expressions': [
|
||||
'error',
|
||||
{
|
||||
allowShortCircuit: true,
|
||||
allowTaggedTemplates: true,
|
||||
allowTernary: true,
|
||||
},
|
||||
],
|
||||
'eslint/no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
'no-var': 'error',
|
||||
'no-eval': 'error',
|
||||
'no-iterator': 'error',
|
||||
'no-new-wrappers': 'error',
|
||||
'no-restricted-globals': [
|
||||
'error',
|
||||
{ message: 'Use `globalThis` instead.', name: 'global' },
|
||||
{ message: 'Use `globalThis` instead.', name: 'self' },
|
||||
],
|
||||
'no-useless-call': 'error',
|
||||
'no-useless-computed-key': 'error',
|
||||
'no-useless-constructor': 'error',
|
||||
'no-useless-return': 'error',
|
||||
'object-shorthand': [
|
||||
'error',
|
||||
'always',
|
||||
{
|
||||
avoidQuotes: true,
|
||||
ignoreConstructors: false,
|
||||
},
|
||||
],
|
||||
'one-var': ['error', { initialized: 'never' }],
|
||||
'prefer-const': [
|
||||
'error',
|
||||
{
|
||||
destructuring: 'all',
|
||||
ignoreReadBeforeAssign: true,
|
||||
},
|
||||
],
|
||||
'eslint/prefer-arrow-callback': [
|
||||
'error',
|
||||
{
|
||||
allowNamedFunctions: false,
|
||||
allowUnboundThis: true,
|
||||
},
|
||||
],
|
||||
'prefer-exponentiation-operator': 'error',
|
||||
'prefer-promise-reject-errors': 'error',
|
||||
'eslint/prefer-regex-literals': [
|
||||
'error',
|
||||
{
|
||||
disallowRedundantWrapping: true,
|
||||
},
|
||||
],
|
||||
'prefer-rest-params': 'error',
|
||||
'prefer-spread': 'error',
|
||||
'prefer-template': 'error',
|
||||
'spaced-comment': 'error',
|
||||
'symbol-description': 'error',
|
||||
'unicode-bom': ['error', 'never'],
|
||||
'use-isnan': [
|
||||
'error',
|
||||
{
|
||||
enforceForIndexOf: true,
|
||||
enforceForSwitchCase: true,
|
||||
},
|
||||
],
|
||||
'valid-typeof': [
|
||||
'error',
|
||||
{
|
||||
requireStringLiterals: true,
|
||||
},
|
||||
],
|
||||
'vars-on-top': 'error',
|
||||
yoda: ['error', 'never'],
|
||||
},
|
||||
};
|
||||
|
||||
export { javascript };
|
||||
11
internal/lint-configs/oxlint-config/src/configs/node.ts
Normal file
11
internal/lint-configs/oxlint-config/src/configs/node.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const node: OxlintConfig = {
|
||||
rules: {
|
||||
'node/no-exports-assign': 'error',
|
||||
'node/no-new-require': 'error',
|
||||
'node/no-path-concat': 'error',
|
||||
},
|
||||
};
|
||||
|
||||
export { node };
|
||||
98
internal/lint-configs/oxlint-config/src/configs/overrides.ts
Normal file
98
internal/lint-configs/oxlint-config/src/configs/overrides.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const overrides: OxlintConfig = {
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.d.ts', '**/*.d.ts'],
|
||||
rules: {
|
||||
'import/no-unassigned-import': 'off',
|
||||
'typescript/triple-slash-reference': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'**/__tests__/**/*.js',
|
||||
'**/__tests__/**/*.cjs',
|
||||
'**/__tests__/**/*.mjs',
|
||||
'**/__tests__/**/*.jsx',
|
||||
'**/__tests__/**/*.ts',
|
||||
'**/__tests__/**/*.cts',
|
||||
'**/__tests__/**/*.mts',
|
||||
'**/__tests__/**/*.tsx',
|
||||
'**/*.spec.js',
|
||||
'**/*.spec.cjs',
|
||||
'**/*.spec.mjs',
|
||||
'**/*.spec.jsx',
|
||||
'**/*.spec.ts',
|
||||
'**/*.spec.cts',
|
||||
'**/*.spec.mts',
|
||||
'**/*.spec.tsx',
|
||||
'**/*.test.js',
|
||||
'**/*.test.cjs',
|
||||
'**/*.test.mjs',
|
||||
'**/*.test.jsx',
|
||||
'**/*.test.ts',
|
||||
'**/*.test.cts',
|
||||
'**/*.test.mts',
|
||||
'**/*.test.tsx',
|
||||
'**/*.bench.js',
|
||||
'**/*.bench.cjs',
|
||||
'**/*.bench.mjs',
|
||||
'**/*.bench.jsx',
|
||||
'**/*.bench.ts',
|
||||
'**/*.bench.cts',
|
||||
'**/*.bench.mts',
|
||||
'**/*.bench.tsx',
|
||||
'**/*.benchmark.js',
|
||||
'**/*.benchmark.cjs',
|
||||
'**/*.benchmark.mjs',
|
||||
'**/*.benchmark.jsx',
|
||||
'**/*.benchmark.ts',
|
||||
'**/*.benchmark.cts',
|
||||
'**/*.benchmark.mts',
|
||||
'**/*.benchmark.tsx',
|
||||
],
|
||||
rules: {
|
||||
'no-console': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['packages/@core/base/shared/src/utils/inference.ts'],
|
||||
rules: {
|
||||
'vue/prefer-import-from-vue': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['packages/@core/ui-kit/menu-ui/src/sub-menu.vue'],
|
||||
rules: {
|
||||
'import/no-self-import': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'scripts/**/*.js',
|
||||
'scripts/**/*.cjs',
|
||||
'scripts/**/*.mjs',
|
||||
'scripts/**/*.jsx',
|
||||
'scripts/**/*.ts',
|
||||
'scripts/**/*.cts',
|
||||
'scripts/**/*.mts',
|
||||
'scripts/**/*.tsx',
|
||||
'internal/**/*.js',
|
||||
'internal/**/*.cjs',
|
||||
'internal/**/*.mjs',
|
||||
'internal/**/*.jsx',
|
||||
'internal/**/*.ts',
|
||||
'internal/**/*.cts',
|
||||
'internal/**/*.mts',
|
||||
'internal/**/*.tsx',
|
||||
],
|
||||
rules: {
|
||||
'no-console': 'off',
|
||||
'unicorn/no-process-exit': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export { overrides };
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const plugins: OxlintConfig = {
|
||||
plugins: ['import', 'node', 'oxc', 'typescript', 'unicorn', 'vitest', 'vue'],
|
||||
};
|
||||
|
||||
export { plugins };
|
||||
@@ -0,0 +1,50 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
import eslintPluginBetterTailwindcss from 'eslint-plugin-better-tailwindcss';
|
||||
import { getDefaultSelectors } from 'eslint-plugin-better-tailwindcss/defaults';
|
||||
import { SelectorKind } from 'eslint-plugin-better-tailwindcss/types';
|
||||
|
||||
const selectors = [
|
||||
...getDefaultSelectors(),
|
||||
{
|
||||
kind: SelectorKind.Attribute,
|
||||
match: [{ type: 'objectValues' }],
|
||||
name: '^classNames$',
|
||||
},
|
||||
];
|
||||
|
||||
const settings = {
|
||||
entryPoint: 'packages/@core/base/design/src/css/global.css',
|
||||
selectors,
|
||||
};
|
||||
|
||||
const tailwindcss: OxlintConfig = {
|
||||
// Generated shadcn-ui internals are intentionally left unmanaged.
|
||||
ignorePatterns: ['packages/@core/ui-kit/shadcn-ui/**/*'],
|
||||
jsPlugins: [
|
||||
{
|
||||
name: 'better-tailwindcss',
|
||||
specifier: 'eslint-plugin-better-tailwindcss',
|
||||
},
|
||||
],
|
||||
rules: {
|
||||
...eslintPluginBetterTailwindcss.configs.recommended.rules,
|
||||
'better-tailwindcss/enforce-consistent-class-order': [
|
||||
'error',
|
||||
{
|
||||
detectComponentClasses: true,
|
||||
unknownClassOrder: 'asc',
|
||||
unknownClassPosition: 'start',
|
||||
},
|
||||
],
|
||||
// Let Prettier own wrapping decisions to avoid ping-pong formatting.
|
||||
'better-tailwindcss/enforce-consistent-line-wrapping': 'off',
|
||||
'better-tailwindcss/no-unknown-classes': 'off',
|
||||
},
|
||||
settings: {
|
||||
'better-tailwindcss': settings,
|
||||
'eslint-plugin-better-tailwindcss': settings,
|
||||
},
|
||||
};
|
||||
|
||||
export { tailwindcss };
|
||||
23
internal/lint-configs/oxlint-config/src/configs/test.ts
Normal file
23
internal/lint-configs/oxlint-config/src/configs/test.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const test: OxlintConfig = {
|
||||
rules: {
|
||||
'jest/no-conditional-expect': 'off',
|
||||
'jest/require-to-throw-message': 'off',
|
||||
'vitest/consistent-test-it': [
|
||||
'error',
|
||||
{
|
||||
fn: 'it',
|
||||
withinDescribe: 'it',
|
||||
},
|
||||
],
|
||||
'vitest/hoisted-apis-on-top': 'off',
|
||||
'vitest/no-focused-tests': 'error',
|
||||
'vitest/no-identical-title': 'error',
|
||||
'vitest/no-import-node-test': 'error',
|
||||
'vitest/prefer-hooks-in-order': 'error',
|
||||
'vitest/prefer-lowercase-title': 'error',
|
||||
},
|
||||
};
|
||||
|
||||
export { test };
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const typescript: OxlintConfig = {
|
||||
rules: {
|
||||
'typescript/ban-ts-comment': 'error',
|
||||
'typescript/no-non-null-assertion': 'error',
|
||||
'typescript/no-var-requires': 'error',
|
||||
'typescript/triple-slash-reference': 'error',
|
||||
},
|
||||
};
|
||||
|
||||
export { typescript };
|
||||
14
internal/lint-configs/oxlint-config/src/configs/unicorn.ts
Normal file
14
internal/lint-configs/oxlint-config/src/configs/unicorn.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const unicorn: OxlintConfig = {
|
||||
rules: {
|
||||
'unicorn/consistent-function-scoping': 'off',
|
||||
'unicorn/no-process-exit': 'error',
|
||||
'unicorn/no-single-promise-in-promise-methods': 'off',
|
||||
'unicorn/no-useless-spread': 'off',
|
||||
'unicorn/prefer-global-this': 'off',
|
||||
'unicorn/prefer-module': 'error',
|
||||
},
|
||||
};
|
||||
|
||||
export { unicorn };
|
||||
9
internal/lint-configs/oxlint-config/src/configs/vue.ts
Normal file
9
internal/lint-configs/oxlint-config/src/configs/vue.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const vue: OxlintConfig = {
|
||||
rules: {
|
||||
'vue/prefer-import-from-vue': 'error',
|
||||
},
|
||||
};
|
||||
|
||||
export { vue };
|
||||
21
internal/lint-configs/oxlint-config/src/index.ts
Normal file
21
internal/lint-configs/oxlint-config/src/index.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
import { defineConfig as defineOxlintConfig } from 'oxlint';
|
||||
|
||||
import { mergeOxlintConfigs, oxlintConfig } from './configs';
|
||||
|
||||
type VbenOxlintConfig = Omit<OxlintConfig, 'extends'> & {
|
||||
extends?: OxlintConfig[];
|
||||
};
|
||||
|
||||
function defineConfig(config: VbenOxlintConfig = {}) {
|
||||
const { extends: extendedConfigs = [], ...restConfig } = config;
|
||||
|
||||
return defineOxlintConfig(
|
||||
mergeOxlintConfigs(oxlintConfig, ...extendedConfigs, restConfig),
|
||||
);
|
||||
}
|
||||
|
||||
export { defineConfig, oxlintConfig };
|
||||
export * from './configs';
|
||||
export type { OxlintConfig, VbenOxlintConfig };
|
||||
6
internal/lint-configs/oxlint-config/tsconfig.json
Normal file
6
internal/lint-configs/oxlint-config/tsconfig.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "@vben/tsconfig/node.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user