96 lines
2.7 KiB
TypeScript
96 lines
2.7 KiB
TypeScript
import { includeIgnoreFile } from '@eslint/compat';
|
|
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
|
|
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
|
|
import pluginImport from 'eslint-plugin-import-x';
|
|
import oxlint from 'eslint-plugin-oxlint';
|
|
import perfectionist from 'eslint-plugin-perfectionist';
|
|
import pluginVue from 'eslint-plugin-vue';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
const gitignorePath = path.resolve(__dirname, '.gitignore');
|
|
|
|
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
|
|
import { configureVueProject } from '@vue/eslint-config-typescript';
|
|
|
|
configureVueProject({ scriptLangs: ['ts', 'tsx', 'js', 'jsx'] });
|
|
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
|
|
|
|
export default defineConfigWithVueTs(
|
|
includeIgnoreFile(gitignorePath), // oxlint . --fix -D correctness --ignore-path .gitignore
|
|
{
|
|
files: ['**/*.{ts,mts,tsx,vue}'],
|
|
name: 'app/files-to-lint',
|
|
},
|
|
|
|
{
|
|
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
|
|
name: 'app/files-to-ignore',
|
|
},
|
|
|
|
pluginVue.configs['flat/essential'],
|
|
vueTsConfigs.recommended,
|
|
|
|
// {
|
|
// ...pluginVitest.configs.recommended,
|
|
// files: ['src/**/__tests__/*'],
|
|
// },
|
|
|
|
// {
|
|
// ...pluginCypress.configs.recommended,
|
|
// files: ['cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}', 'cypress/support/**/*.{js,ts,jsx,tsx}'],
|
|
// },
|
|
...oxlint.configs['flat/recommended'],
|
|
skipFormatting,
|
|
|
|
[
|
|
{
|
|
plugins: {
|
|
import: pluginImport,
|
|
},
|
|
rules: {
|
|
// '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',
|
|
},
|
|
},
|
|
],
|
|
|
|
{
|
|
rules: {
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'vue/block-order': [
|
|
'error',
|
|
{
|
|
order: ['script', 'template', 'style'],
|
|
},
|
|
],
|
|
'vue/define-macros-order': [
|
|
'error',
|
|
{
|
|
order: ['defineOptions', 'defineProps', 'defineEmits', 'defineSlots'],
|
|
},
|
|
],
|
|
'vue/multi-word-component-names': 'off',
|
|
},
|
|
},
|
|
|
|
// https://perfectionist.dev/guide/getting-started
|
|
|
|
[
|
|
perfectionist.configs['recommended-natural'],
|
|
{
|
|
rules: {
|
|
'perfectionist/sort-imports': ['error'],
|
|
},
|
|
},
|
|
],
|
|
);
|